diff options
author | gjoranv <gv@yahooinc.com> | 2023-06-28 14:19:26 +0200 |
---|---|---|
committer | gjoranv <gv@yahooinc.com> | 2023-06-30 16:31:35 +0200 |
commit | 91d2a3d087225619d77d979314c4333cffb65820 (patch) | |
tree | a8f42844174277c532b1b9c73680bf0278cb3249 /bundle-plugin | |
parent | 4d626ff716f7493553d9c3c76045fa3b81965041 (diff) |
Add new header for CORE bundles: X-JDisc-Provided-Artifact
Diffstat (limited to 'bundle-plugin')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java | 12 | ||||
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java | 4 |
2 files changed, 14 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 814a9667e8a..e20b42da4e6 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 @@ -134,7 +134,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { Map<String, String> manifestContent = generateManifestContent(artifactSet.getJarArtifactsToInclude(), calculatedImports, includedPackages); addAdditionalManifestProperties(manifestContent); - addManifestPropertiesForInternalBundles(manifestContent, includedPackages); + addManifestPropertiesForInternalAndCoreBundles(manifestContent, includedPackages, providedJarArtifacts); addManifestPropertiesForUserBundles(manifestContent, jdiscCore, nonPublicApiUsed); createManifestFile(Paths.get(project.getBuild().getOutputDirectory()), manifestContent); @@ -160,13 +160,21 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { addIfNotEmpty(manifestContent, "WebInfUrl", webInfUrl); } - private void addManifestPropertiesForInternalBundles(Map<String, String> manifestContent, PackageTally includedPackages) { + private void addManifestPropertiesForInternalAndCoreBundles(Map<String, String> manifestContent, + PackageTally includedPackages, + List<Artifact> providedJarArtifacts) { if (effectiveBundleType() == BundleType.USER) return; // TODO: this attribute is not necessary, remove? addIfNotEmpty(manifestContent, "X-JDisc-PublicApi-Package", publicApi(includedPackages)); addIfNotEmpty(manifestContent, "X-JDisc-Non-PublicApi-Export-Package", nonPublicApi(includedPackages)); + + if (effectiveBundleType() == BundleType.CORE) { + addIfNotEmpty(manifestContent, "X-JDisc-Provided-Artifact", providedJarArtifacts.stream() + .map(Artifacts::idAndVersion) + .collect(Collectors.joining(","))); + } } private void addManifestPropertiesForUserBundles(Map<String, String> manifestContent, diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java index bde0c124229..2bbdece06ac 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java @@ -49,6 +49,10 @@ public class Artifacts { } } + public static String idAndVersion(Artifact artifact) { + return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(); + } + public static ArtifactSet getArtifacts(MavenProject project) { return getArtifacts(project, new NoopScopeTranslator()); } public static ArtifactSet getArtifacts(MavenProject project, ScopeTranslator scopeTranslator) { |