summaryrefslogtreecommitdiffstats
path: root/bundle-plugin
diff options
context:
space:
mode:
authorgjoranv <gv@yahooinc.com>2023-06-12 16:16:16 +0200
committergjoranv <gv@yahooinc.com>2023-06-13 10:12:32 +0200
commit632f31828dbc1c6a0d4c83504caf249e88fcbb5a (patch)
treeafa767b4d61b4c09325fddd0a01b7ac33cf864d5 /bundle-plugin
parentfbc1d03e255878b20a5c7e36e355ecd635f3a930 (diff)
For USER bundles, add Vespa build version to manifest.
Diffstat (limited to 'bundle-plugin')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java19
1 files changed, 12 insertions, 7 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 ff802668427..261518d13f3 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
@@ -111,7 +111,11 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
logDebugPackageSets(exportedPackagesFromProvidedJars, includedPackages);
- if (hasJdiscCoreProvided(providedJarArtifacts)) {
+ Optional<Artifact> jdiscCore = providedJarArtifacts.stream()
+ .filter(artifact -> artifact.getArtifactId().equals("jdisc_core"))
+ .findAny();
+
+ if (jdiscCore.isPresent()) {
// jdisc_core being provided guarantees that log output does not contain its exported packages
logMissingPackages(exportedPackagesFromProvidedDeps, projectPackages, compileJarsPackages, includedPackages);
} else if (! suppressWarningMissingImportPackages) {
@@ -131,7 +135,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
Map<String, String> manifestContent = generateManifestContent(artifactSet.getJarArtifactsToInclude(), calculatedImports, includedPackages);
addAdditionalManifestProperties(manifestContent);
addManifestPropertiesForInternalBundles(manifestContent, includedPackages);
- addManifestPropertiesForUserBundles(manifestContent, nonPublicApiUsed);
+ addManifestPropertiesForUserBundles(manifestContent, jdiscCore, nonPublicApiUsed);
createManifestFile(Paths.get(project.getBuild().getOutputDirectory()), manifestContent);
} catch (Exception e) {
@@ -170,8 +174,13 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
addIfNotEmpty(manifestContent, "X-JDisc-Non-PublicApi-Export-Package", nonPublicApi(includedPackages));
}
- private void addManifestPropertiesForUserBundles(Map<String, String> manifestContent, List<String> nonPublicApiUsed) {
+ private void addManifestPropertiesForUserBundles(Map<String, String> manifestContent,
+ Optional<Artifact> jdiscCore,
+ List<String> nonPublicApiUsed) {
if (effectiveBundleType() != BundleType.USER) return;
+
+ jdiscCore.ifPresent(
+ artifact -> addIfNotEmpty(manifestContent, "X-JDisc-Vespa-Build-Version", artifact.getVersion()));
addIfNotEmpty(manifestContent, "X-JDisc-Non-PublicApi-Import-Package", String.join(",", nonPublicApiUsed));
}
@@ -197,10 +206,6 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
}
}
- private boolean hasJdiscCoreProvided(List<Artifact> providedArtifacts) {
- return providedArtifacts.stream().anyMatch(artifact -> artifact.getArtifactId().equals("jdisc_core"));
- }
-
private void logMissingPackages(Set<String> exportedPackagesFromProvidedJars,
PackageTally projectPackages,
PackageTally compileJarPackages,