summaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src/main/java/com/yahoo/container
diff options
context:
space:
mode:
authorgjoranv <gv@yahooinc.com>2023-05-25 14:20:41 +0200
committergjoranv <gv@yahooinc.com>2023-05-25 14:20:41 +0200
commit5f1b9a5f27353083e44477e635243f632acf1f41 (patch)
tree2bc17228b6ee5df0f37a36f1e59c3a3a52f9d1b5 /bundle-plugin/src/main/java/com/yahoo/container
parent64f9b6528390d9859f48d37d06ffb163e00215c2 (diff)
Add special handling for bundles with groupId 'com.yahoo.vespa'
- Effective bundle type is INTERNAL, unless set to CORE. Caveat: Setting it explicitly to USER will have no effect.
Diffstat (limited to 'bundle-plugin/src/main/java/com/yahoo/container')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java15
1 files changed, 11 insertions, 4 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 818e1510bd6..2781decdf79 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
@@ -39,7 +39,9 @@ import static com.yahoo.container.plugin.util.Files.allDescendantFiles;
public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
private enum BundleType {
- CORE, INTERNAL, USER
+ CORE, // up to container-dev
+ INTERNAL, // other vespa bundles (need not be set for groupId 'com.yahoo.vespa')
+ USER
}
@Parameter
@@ -98,7 +100,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
logMissingPackages(exportedPackagesFromProvidedDeps, projectPackages, compileJarsPackages, includedPackages);
} else {
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)));
+ "OSGi header may be missing important packages.").formatted(wantedProvidedDependency()));
}
logOverlappingPackages(projectPackages, exportedPackagesFromProvidedDeps);
logUnnecessaryPackages(compileJarsPackages, exportedPackagesFromProvidedDeps);
@@ -117,14 +119,19 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
}
}
- private static String wantedProvidedDependency(BundleType bundleType) {
- return switch (bundleType) {
+ private String wantedProvidedDependency() {
+ return switch (effectiveBundleType()) {
case CORE -> "jdisc_core";
case INTERNAL -> "container-dev";
case USER -> "container";
};
}
+ private BundleType effectiveBundleType() {
+ if (bundleType != BundleType.USER) return bundleType;
+ return project.getGroupId().equals("com.yahoo.vespa") ? BundleType.INTERNAL : BundleType.USER;
+ }
+
private void addAdditionalManifestProperties(Map<String, String> manifestContent, PackageTally includedPackages) {
addIfNotEmpty(manifestContent, "X-JDisc-PublicApi-Package", publicApi(includedPackages));
addIfNotEmpty(manifestContent, "Bundle-Activator", bundleActivator);