summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundle-plugin-test/test-bundles/main/pom.xml1
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java19
2 files changed, 18 insertions, 2 deletions
diff --git a/bundle-plugin-test/test-bundles/main/pom.xml b/bundle-plugin-test/test-bundles/main/pom.xml
index b5f8f7b9a6a..603e0e95aa4 100644
--- a/bundle-plugin-test/test-bundles/main/pom.xml
+++ b/bundle-plugin-test/test-bundles/main/pom.xml
@@ -34,6 +34,7 @@
<artifactId>bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
+ <bundleType>INTERNAL</bundleType>
<Import-Package>
manualImport.withoutVersion,
manualImport.withVersion;version="12.3.4",
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);