[java-idp-plugin-scripting] branch master updated: IDP-1595 More kitting changes

Rod Widdowson rdw at steadingsoftware.com
Mon Jul 13 13:31:55 UTC 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-idp-plugin-scripting.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-scripting.git;a=commit;h=092bc311775365afcd028ba6c999ff35d03b62bc

The following commit(s) were added to refs/heads/master by this push:
       new  092bc31   IDP-1595 More kitting changes
092bc31 is described below

commit 092bc311775365afcd028ba6c999ff35d03b62bc
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jul 13 11:02:38 2020 +0100

    IDP-1595 More kitting changes
    
    https://issues.shibboleth.net/jira/browse/IDP-1595
    
     * Artefact names have changed
     * Add licensing information to distribution (and description)
     * Add local dependencies to pom file allowing us to collect
       the jar from the impl project.
     * Fix the downloading information for Nashorn
---
 .../src/main/assembly/nashorn-assembly.xml         | 18 +++----
 .../doc/{nashhorn-plugin => nashorn-plugin}        |  0
 nashorn-impl/pom.xml                               |  2 +-
 .../scripting/nashorn/NashornDescription.java      | 57 +++++++++++++---------
 rhino-dist/src/main/assembly/rhino-assembly.xml    | 17 +++----
 rhino-impl/pom.xml                                 |  2 +-
 .../plugin/scripting/rhino/RhinoDescription.java   |  2 +-
 7 files changed, 50 insertions(+), 48 deletions(-)

diff --git a/nashorn-dist/src/main/assembly/nashorn-assembly.xml b/nashorn-dist/src/main/assembly/nashorn-assembly.xml
index 608967d..bf02716 100644
--- a/nashorn-dist/src/main/assembly/nashorn-assembly.xml
+++ b/nashorn-dist/src/main/assembly/nashorn-assembly.xml
@@ -9,7 +9,8 @@
             <directory>../nashorn-impl/target</directory>
             <outputDirectory>edit-webapp/WEB-INF/lib</outputDirectory>
             <includes>
-                <include>nashorn-impl-*.jar</include>
+                <include>idp-plugin-nashorn-impl-*.jar</include>
+                <include>idp-plugin-scripting-api-*.jar</include>
                 <include>asm-*.jar</include>   <!--  https://asm.ow2.io/license.html -->
                 <include>icu4j-*.jar</include> <!--  http://userguide.icu-project.org/icufaq#TOC-How-is-the-ICU-licensed- -->
             </includes>
@@ -20,20 +21,15 @@
             </excludes>
         </fileSet>
         <fileSet>
-            <directory>../scripting-api/target</directory>
-            <outputDirectory>edit-webapp/WEB-INF/lib</outputDirectory>
+            <directory>src/main/resources/conf</directory>
+            <outputDirectory>conf</outputDirectory>
             <includes>
-                <include>scripting-api-*.jar</include>
+                <include>*</include>
             </includes>
-            <excludes>
-                <exclude>*test*.jar</exclude>
-                <exclude>*javadoc.jar</exclude>
-                <exclude>*sources.jar</exclude>
-            </excludes>
         </fileSet>
         <fileSet>
-            <directory>src/main/resources/conf</directory>
-            <outputDirectory>conf</outputDirectory>
+            <directory>src/main/resources/doc</directory>
+            <outputDirectory>doc</outputDirectory>
             <includes>
                 <include>*</include>
             </includes>
diff --git a/nashorn-dist/src/main/resources/doc/nashhorn-plugin b/nashorn-dist/src/main/resources/doc/nashorn-plugin
similarity index 100%
rename from nashorn-dist/src/main/resources/doc/nashhorn-plugin
rename to nashorn-dist/src/main/resources/doc/nashorn-plugin
diff --git a/nashorn-impl/pom.xml b/nashorn-impl/pom.xml
index 48b9ffb..a806aa9 100644
--- a/nashorn-impl/pom.xml
+++ b/nashorn-impl/pom.xml
@@ -28,7 +28,7 @@
 	     (NOT GRAAL itself) are provided and test -->
 	<dependency>
             <groupId>net.shibboleth.idp.plugin.scripting</groupId>
-            <artifactId>scripting-api</artifactId>
+            <artifactId>idp-plugin-scripting-api</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
 
diff --git a/nashorn-impl/src/main/java/net/shibboleth/idp/plugin/scripting/nashorn/NashornDescription.java b/nashorn-impl/src/main/java/net/shibboleth/idp/plugin/scripting/nashorn/NashornDescription.java
index 4800320..82663f3 100644
--- a/nashorn-impl/src/main/java/net/shibboleth/idp/plugin/scripting/nashorn/NashornDescription.java
+++ b/nashorn-impl/src/main/java/net/shibboleth/idp/plugin/scripting/nashorn/NashornDescription.java
@@ -18,9 +18,9 @@
 package net.shibboleth.idp.plugin.scripting.nashorn;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.file.Path;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.springframework.core.io.ClassPathResource;
@@ -34,15 +34,10 @@ import net.shibboleth.utilities.java.support.plugin.AbstractPluginDescription;
  */
 public class NashornDescription extends AbstractPluginDescription {
 
-	static final String GRAAL_VERSION = "20.0.0";
-	static final String MAVEN_REPO = "https://repo1.maven.org/maven2/";
-	/** These are the files that are not packagable.  */
-	static final List<String> jars = List.of(MAVEN_REPO + "org/graalvm/sdk/graal-sdk/" + GRAAL_VERSION + "/graal-sdk-" + GRAAL_VERSION +".jar",
-			MAVEN_REPO + "org/graalvm/js/js/" + GRAAL_VERSION + "/js-" + GRAAL_VERSION +".jar",
-			MAVEN_REPO + "org/graalvm/regex/regex/" + GRAAL_VERSION + "/regex-" + GRAAL_VERSION +".jar",
-			MAVEN_REPO + "org/graalvm/truffle/truffle-api/" + GRAAL_VERSION + "/truffle-api-" + GRAAL_VERSION +".jar");
+        static final String GRAAL_VERSION = "20.0.0";
+        static final String MAVEN_REPO = "https://repo1.maven.org/maven2/";
 
-    @Override
+        @Override
     public String getPluginId() {
         return "net.shibboleth.idp.plugin.scripting.nashorn";
     }
@@ -52,28 +47,42 @@ public class NashornDescription extends AbstractPluginDescription {
         return List.of(new ClassPathResource("META-INF/plugins/").getURL());
     }
 
+    /** Create a {@link Pair } as needed.
+     * @param dirPath dir part of the coordinates (no version)
+     * @param jar the name name  (no version)
+     * @param parent where to make the path relative to
+     * @return an appropriare pair
+     * @throws MalformedURLException if the URL comes up wrong
+     */
+    private Pair<URL,Path> downloadPair(final String dirPath, final String jar, final Path parent) throws MalformedURLException {
+        // example graal-sdk-20.0.0.jar
+        final String jarName = new StringBuilder(jar)
+                                        .append('-')
+                                        .append(GRAAL_VERSION)
+                                        .append(".jar")
+                                        .toString();
+        // example https://repo1.maven.org/maven2/org/graalvm/sdk/graal-sdk/20.0.0/graal-sdk-20.0.0.jar
+        final URL url = new URL(new StringBuilder(MAVEN_REPO)
+                                        .append(dirPath)
+                                        .append(GRAAL_VERSION)
+                                        .append('/')
+                                        .append(jarName)
+                                        .toString());
+        return new Pair<URL, Path>(url, parent.resolve(jarName));
+    }
+
     @Override
     public List<Pair<URL, Path>> getExternalFilePathsToCopy() throws IOException {
-
         final Path to = Path.of("dist", "edit-webapp-" + getPluginId(), "WEB-INF", "lib");
-        try {
-            List<Pair<URL, Path>> result = new ArrayList<>(jars.size());
-            for (String url : jars) {
-                // cannot use stream because the constructor throws and pipes hate that
-                result.add( new Pair<>(new URL(url), to));
-            }
-            return List.copyOf(result);
-        } catch (Exception e) {
-            if (e instanceof IOException) {
-				throw (IOException) e;
-			}
-            throw new IOException("Failed to create HTTPClient", e);
-        }
+        return List.of(downloadPair("org/graalvm/sdk/graal-sdk/", "graal-sdk", to),
+                        downloadPair("org/graalvm/js/js/", "js", to),
+                        downloadPair("org/graalvm/regex/regex/", "regex", to),
+                        downloadPair("org/graalvm/truffle/truffle-api/", "truffle-api", to));
     }
         
     @Override
     public List<Path> getFilePathsToCopy() {
-        return List.of(Path.of("conf", "testfile.xml"));
+        return List.of(Path.of("conf", "testfile.xml"), Path.of("doc", "nashorn-plugin"));
     }
 
     @Override
diff --git a/rhino-dist/src/main/assembly/rhino-assembly.xml b/rhino-dist/src/main/assembly/rhino-assembly.xml
index 45dafbf..bdcba87 100644
--- a/rhino-dist/src/main/assembly/rhino-assembly.xml
+++ b/rhino-dist/src/main/assembly/rhino-assembly.xml
@@ -9,6 +9,8 @@
             <directory>../rhino-impl/target</directory>
             <outputDirectory>edit-webapp/WEB-INF/lib</outputDirectory>
             <includes>
+                <include>idp-plugin-rhino-impl-*.jar</include>
+                <include>idp-plugin-scripting-api-*.jar</include>
                 <include>rhino-*.jar</include> <!-- https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/License -->
             </includes>
             <excludes>
@@ -18,20 +20,15 @@
             </excludes>
         </fileSet>
         <fileSet>
-            <directory>../scripting-api/target</directory>
-            <outputDirectory>edit-webapp/WEB-INF/lib</outputDirectory>
+            <directory>src/main/resources/conf</directory>
+            <outputDirectory>conf</outputDirectory>
             <includes>
-                <include>scripting-api-*.jar</include>
+                <include>*</include>
             </includes>
-            <excludes>
-                <exclude>*test*.jar</exclude>
-                <exclude>*javadoc.jar</exclude>
-                <exclude>*sources.jar</exclude>
-            </excludes>
         </fileSet>
         <fileSet>
-            <directory>src/main/resources/conf</directory>
-            <outputDirectory>conf</outputDirectory>
+            <directory>src/main/resources/doc</directory>
+            <outputDirectory>doc</outputDirectory>
             <includes>
                 <include>*</include>
             </includes>
diff --git a/rhino-impl/pom.xml b/rhino-impl/pom.xml
index 5b70353..c0039fe 100644
--- a/rhino-impl/pom.xml
+++ b/rhino-impl/pom.xml
@@ -26,7 +26,7 @@
     <dependencies>
         <dependency>
             <groupId>net.shibboleth.idp.plugin.scripting</groupId>
-            <artifactId>scripting-api</artifactId>
+            <artifactId>idp-plugin-scripting-api</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
diff --git a/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoDescription.java b/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoDescription.java
index 1f76179..984069c 100644
--- a/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoDescription.java
+++ b/rhino-impl/src/main/java/net/shibboleth/idp/plugin/scripting/rhino/RhinoDescription.java
@@ -51,7 +51,7 @@ public class RhinoDescription extends AbstractPluginDescription {
         
     @Override
     public List<Path> getFilePathsToCopy() {
-        return List.of(Path.of("conf", "testfile.xml"));
+        return List.of(Path.of("conf", "testfile.xml"), Path.of("doc", "rhino-plugin"));
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list