From d714a273a70c1302c177d27a504b586e83ca6f40 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Mon, 5 Jun 2023 11:16:33 +0200 Subject: Add individual suppressWarning settings .. to allow using failOnWarning for most projects. --- .../container/plugin/mojo/GenerateOsgiManifestMojo.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'bundle-plugin') 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 @@ -67,6 +67,13 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { @Parameter(alias = "Bundle-Type") 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; @@ -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 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 exportedPackagesFromProvidedDeps) { + if (suppressWarningOverlappingPackages) return; + Set overlappingProjectPackages = Sets.intersection(projectPackages.definedPackages(), exportedPackagesFromProvidedDeps); if (! overlappingProjectPackages.isEmpty()) { warnOrThrow("This project defines packages that are also defined in provided scoped dependencies " + -- cgit v1.2.3