summaryrefslogtreecommitdiffstats
path: root/bundle-plugin
diff options
context:
space:
mode:
authorgjoranv <gv@yahooinc.com>2023-05-25 13:26:52 +0200
committergjoranv <gv@yahooinc.com>2023-05-25 13:26:52 +0200
commit64f9b6528390d9859f48d37d06ffb163e00215c2 (patch)
treee7f40ac9c2f1932aadcb313712b669f0efbf307b /bundle-plugin
parent1cebc043cbc8aad255af6a0f63f0168462d7899a (diff)
Warn about correct missing provided artifact, based on bundle type
Diffstat (limited to 'bundle-plugin')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
index 21eba6a283a..818e1510bd6 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
@@ -38,6 +38,10 @@ import static com.yahoo.container.plugin.util.Files.allDescendantFiles;
@Mojo(name = "generate-osgi-manifest", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
+ private enum BundleType {
+ CORE, INTERNAL, USER
+ }
+
@Parameter
private String discApplicationClass = null;
@@ -56,6 +60,9 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
@Parameter(alias = "Main-Class")
private String mainClass = null;
+ @Parameter(alias = "Bundle-Type")
+ private BundleType bundleType = BundleType.USER;
+
@Parameter(defaultValue = "false")
private boolean buildLegacyVespaPlatformBundle;
@@ -90,8 +97,8 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
// jdisc_core being provided guarantees that log output does not contain its exported packages
logMissingPackages(exportedPackagesFromProvidedDeps, projectPackages, compileJarsPackages, includedPackages);
} else {
- getLog().warn("This project does not have jdisc_core as provided dependency, so the " +
- "generated 'Import-Package' OSGi header may be missing important packages.");
+ getLog().warn(("This project does not have '%s' as provided dependency, so the generated 'Import-Package' " +
+ "OSGi header may be missing important packages.").formatted(wantedProvidedDependency(bundleType)));
}
logOverlappingPackages(projectPackages, exportedPackagesFromProvidedDeps);
logUnnecessaryPackages(compileJarsPackages, exportedPackagesFromProvidedDeps);
@@ -110,6 +117,14 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
}
}
+ private static String wantedProvidedDependency(BundleType bundleType) {
+ return switch (bundleType) {
+ case CORE -> "jdisc_core";
+ case INTERNAL -> "container-dev";
+ case USER -> "container";
+ };
+ }
+
private void addAdditionalManifestProperties(Map<String, String> manifestContent, PackageTally includedPackages) {
addIfNotEmpty(manifestContent, "X-JDisc-PublicApi-Package", publicApi(includedPackages));
addIfNotEmpty(manifestContent, "Bundle-Activator", bundleActivator);