summaryrefslogtreecommitdiffstats
path: root/bundle-plugin
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-07-08 10:59:09 +0200
committerGitHub <noreply@github.com>2020-07-08 10:59:09 +0200
commit8a419bfbb5894216ab52cec0b12805daedab5faa (patch)
tree1740237fb951f7b75bb95be57afef1108f6054c2 /bundle-plugin
parent2382c0b85d828457ecad27856f71839a0d615372 (diff)
parentb970b3e21fc63e6ae7c762d308622801b31782fd (diff)
Merge pull request #13827 from vespa-engine/fail-upon-discPreInstallBundle
Fail upon discPreInstallBundle
Diffstat (limited to 'bundle-plugin')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java6
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JdkPackages.java40
2 files changed, 6 insertions, 40 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 d5aaa5888b2..be71c9c149f 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
@@ -55,8 +55,14 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo {
@Parameter(alias = "Main-Class")
private String mainClass = null;
+ @Parameter(defaultValue = "false")
+ private boolean buildVespaPlatformBundle;
+
public void execute() throws MojoExecutionException {
try {
+ if (discPreInstallBundle != null && ! buildVespaPlatformBundle)
+ throw new MojoExecutionException("The 'discPreInstallBundle' parameter can only be used by Vespa platform bundles.");
+
Artifacts.ArtifactSet artifactSet = Artifacts.getArtifacts(project);
warnOnUnsupportedArtifacts(artifactSet.getNonJarArtifacts());
warnIfInternalContainerArtifactsAreIncluded(artifactSet.getJarArtifactsToInclude());
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JdkPackages.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JdkPackages.java
deleted file mode 100644
index c6171e71319..00000000000
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JdkPackages.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.plugin.util;
-
-import java.net.URL;
-
-/**
- * @author gjoranv
- */
-public class JdkPackages {
-
- /**
- * Returns a boolean indicating (via best effort) if the given package is part of the JDK.
- */
- public static boolean isJdkPackage(String pkg) {
- return hasJdkExclusivePrefix(pkg)
- || isResourceInPlatformClassLoader(pkg); // TODO: must be a class, not a package, due to module encapsulation
- }
-
- private static boolean isResourceInPlatformClassLoader(String klass) {
- String klassAsPath = klass.replaceAll("\\.", "/") + ".class";
- URL resource = getPlatformClassLoader().getResource(klassAsPath);
- return !(resource == null);
- }
-
- private static ClassLoader getPlatformClassLoader() {
- ClassLoader platform = JdkPackages.class.getClassLoader().getParent();
-
- // Will fail upon changes in classloader hierarchy between JDK versions
- assert (platform.getName().equals("platform"));
-
- return platform;
- }
-
- private static boolean hasJdkExclusivePrefix(String pkg) {
- return pkg.startsWith("java.")
- || pkg.startsWith("sun.");
- }
-
-}
-