diff options
author | gjoranv <gv@yahooinc.com> | 2023-06-05 11:16:33 +0200 |
---|---|---|
committer | gjoranv <gv@yahooinc.com> | 2023-06-05 11:18:57 +0200 |
commit | d714a273a70c1302c177d27a504b586e83ca6f40 (patch) | |
tree | a3111f0a45de42ec4dc64fe02dc2be856682a81d /bundle-plugin | |
parent | dba3bd1dfedd62cec24c4fd5ba3984c2e81a468f (diff) |
Add individual suppressWarning settings
.. to allow using failOnWarning for most projects.
Diffstat (limited to 'bundle-plugin')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java | 13 |
1 files changed, 11 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 f7cdd325f69..eef74365b92 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 @@ -68,6 +68,13 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { private BundleType bundleType = BundleType.USER; @Parameter(defaultValue = "false") + private boolean suppressWarningMissingImportPackages; + @Parameter(defaultValue = "false") + private boolean suppressWarningPublicApi; + @Parameter(defaultValue = "false") + private boolean suppressWarningOverlappingPackages; + + @Parameter(defaultValue = "false") private boolean failOnWarnings; @Parameter(defaultValue = "false") @@ -105,7 +112,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { if (hasJdiscCoreProvided(providedJarArtifacts)) { // jdisc_core being provided guarantees that log output does not contain its exported packages logMissingPackages(exportedPackagesFromProvidedDeps, projectPackages, compileJarsPackages, includedPackages); - } else { + } else if (! suppressWarningMissingImportPackages) { warnOrThrow(("This project does not have '%s' as provided dependency, so the generated 'Import-Package' " + "OSGi header may be missing important packages.").formatted(wantedProvidedDependency())); } @@ -158,7 +165,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { } private void logNonPublicApiUsage(List<String> nonPublicApiUsed) { - if (effectiveBundleType() != BundleType.USER || nonPublicApiUsed.isEmpty()) return; + if (suppressWarningPublicApi || effectiveBundleType() != BundleType.USER || nonPublicApiUsed.isEmpty()) return; warnOrThrow("This project uses packages that are not part of Vespa's public api: %s".formatted(nonPublicApiUsed)); } @@ -201,6 +208,8 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { private void logOverlappingPackages(PackageTally projectPackages, Set<String> exportedPackagesFromProvidedDeps) { + if (suppressWarningOverlappingPackages) return; + Set<String> overlappingProjectPackages = Sets.intersection(projectPackages.definedPackages(), exportedPackagesFromProvidedDeps); if (! overlappingProjectPackages.isEmpty()) { warnOrThrow("This project defines packages that are also defined in provided scoped dependencies " + |