From 696388047ef656facfee25121d4b6e1646efb9df Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 23 Mar 2015 13:19:26 -0500 Subject: [PATCH 01/70] Change XML comment style to avoid mixed whitespace The previous style required leading tabs followed by five spaces. Consequently, no autoformatting tools supported it, meaning it had to be done manually every time, and thus there were many incorrectly formatted comments around. Let's change to a comment style that uses only leading tabs, and is hence autoformattable by standard tools. --- pom.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 38030e9..b22dab2 100644 --- a/pom.xml +++ b/pom.xml @@ -124,8 +124,10 @@ Institute of Molecular Cell Biology and Genetics. - + tools-jar From 33a693d7db1be46f7dc5f1650f931f78f400fbf6 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 15 Apr 2015 13:35:01 -0500 Subject: [PATCH 02/70] Bump pom-scijava parent to 7.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b22dab2..04e8fa9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 6.0.0 + 7.0.0 From e375ec6c1c638367fd4667a8b9537fe11f1a9bd5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 15 Apr 2015 13:41:18 -0500 Subject: [PATCH 03/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 04e8fa9..ccf07f2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.1-SNAPSHOT + 0.3.2-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From e432e2e70f858a6703567bac5628cadc0714b767 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Apr 2015 23:03:35 -0500 Subject: [PATCH 04/70] README.md: add Jenkins build status badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a683aa9..052a098 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![](http://jenkins.imagej.net/job/scripting-Java/lastBuild/badge/icon) + # Java Scripting This library provides a From e82bdcd245c05489870b2e0d4ca171b4d0391182 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Apr 2015 23:23:31 -0500 Subject: [PATCH 05/70] POM: fix Jenkins URL (http, not https) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ccf07f2..c93165b 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ Jenkins - https://jenkins.imagej.net/job/scripting-Java/ + http://jenkins.imagej.net/job/scripting-Java/ From 32e98b282939b4d29022a1f936f52eef63b3a895 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 29 Apr 2015 14:45:28 -0500 Subject: [PATCH 06/70] README.md: link Jenkins badge to the job --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 052a098..1f95798 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](http://jenkins.imagej.net/job/scripting-Java/lastBuild/badge/icon) +[![](http://jenkins.imagej.net/job/scripting-Java/lastBuild/badge/icon)](http://jenkins.imagej.net/job/scripting-Java/) # Java Scripting From e653768490e8b83be44b5b826df07679bbafcd03 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 11:10:54 -0500 Subject: [PATCH 07/70] Bump parent to pom-scijava 7.3.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c93165b..6f7e5dc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 7.0.0 + 7.3.0 From 37522430636195ec794eabc032bae6ca6331d44d Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 11:12:07 -0500 Subject: [PATCH 08/70] Register script engine with JSR-223 framework Closes #9 --- .../resources/META-INF/services/javax.script.ScriptEngineFactory | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/main/resources/META-INF/services/javax.script.ScriptEngineFactory diff --git a/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory new file mode 100644 index 0000000..bb5de81 --- /dev/null +++ b/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory @@ -0,0 +1 @@ +org.scijava.plugins.scripting.java.JavaScriptLanguage From 3eb2224a6b0c63bcff45ebf3ed71013d7b46e8f2 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 11:14:08 -0500 Subject: [PATCH 09/70] Test Java discovery by JSR-223 framework --- pom.xml | 5 +++++ .../scijava/plugins/scripting/java/JavaEngineTest.java | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6f7e5dc..65eb42e 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,11 @@ junit test + + org.scijava + scijava-common + tests + diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 15bb104..8af1ca5 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.scijava.Context; import org.scijava.object.ObjectService; +import org.scijava.script.AbstractScriptLanguageTest; import org.scijava.script.ScriptLanguage; import org.scijava.script.ScriptService; import org.scijava.test.TestUtils; @@ -57,7 +58,12 @@ * * @author Johannes Schindelin */ -public class JavaEngineTest { +public class JavaEngineTest extends AbstractScriptLanguageTest { + + @Test + public void testDiscovery() { + assertDiscovered(JavaScriptLanguage.class); + } @Before public void assumeJavaC() { From 7ea78c103a062d69738044f58ecae9a54bbd3ab7 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Mon, 15 Jun 2015 11:15:38 -0500 Subject: [PATCH 10/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 65eb42e..f827850 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.2-SNAPSHOT + 0.3.3-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From cc6589a319f72bec5bcc452118a0c8d33fc03ec5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 16 Jun 2015 14:02:23 -0500 Subject: [PATCH 11/70] Use test scope for scijava-common tests lib It was an oversight, which now causes pain because the scijava-common tests library includes some extra services and plugins which hose up downstream applications. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index f827850..ac2b685 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,7 @@ org.scijava scijava-common tests + test From 4933cc27afaa3f106a6d237a1a42308305049068 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 16 Jun 2015 15:45:17 -0500 Subject: [PATCH 12/70] POM: bump to pom-scijava 7.4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac2b685..fead837 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 7.3.0 + 7.4.0 From 04b041882596f2a48c98ce4997e282a43fa6b279 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 16 Jun 2015 16:40:51 -0500 Subject: [PATCH 13/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fead837..8199280 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.3-SNAPSHOT + 0.3.4-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From c72a5d4048ee089712e9dc60bfe23a74ea930134 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 6 Nov 2015 18:39:39 -0600 Subject: [PATCH 14/70] Bump pom-scijava parent to 8.5.0 This fixes an Eclipse lifecycle configuration issue with build-helper-maven-plugin. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8199280..7deff80 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 7.4.0 + 8.5.0 From a082749459327777d7e0411438504ee182fef576 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 08:51:11 -0600 Subject: [PATCH 15/70] POM: remove excess whitespace This makes tidy-maven-plugin happy. --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index 7deff80..deb35da 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,6 @@ JSR-223-compliant Java scripting language plugin. http://scijava.org/ 2008 - Simplified BSD License @@ -69,12 +68,10 @@ HEAD https://github.com/scijava/scripting-java - GitHub Issues https://github.com/scijava/scripting-java/issues - Jenkins http://jenkins.imagej.net/job/scripting-Java/ @@ -154,5 +151,4 @@ Institute of Molecular Cell Biology and Genetics. - From 04cb57c7fd0f1d6443b93eca5a424e6f7e3c7299 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 10:38:37 -0600 Subject: [PATCH 16/70] POM: remove redundant mailingLists section It is inherited from the pom-scijava parent. --- pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pom.xml b/pom.xml index deb35da..e82e06a 100644 --- a/pom.xml +++ b/pom.xml @@ -52,16 +52,6 @@ - - - SciJava - https://groups.google.com/group/scijava - https://groups.google.com/group/scijava - scijava@googlegroups.com - https://groups.google.com/group/scijava - - - scm:git:git://github.com/scijava/scripting-java scm:git:git@github.com:scijava/scripting-java From 5cfcc2ad513cefbc92fccd2cfd06a96c5a9d4a8f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 10:57:05 -0600 Subject: [PATCH 17/70] POM: update developers and contributors See: http://imagej.net/Team --- pom.xml | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index e82e06a..0636582 100644 --- a/pom.xml +++ b/pom.xml @@ -25,32 +25,52 @@ - dscho - Johannes Schindelin - schindelin@wisc.edu - http://loci.wisc.edu/people/johannes-schindelin + ctrueden + Curtis Rueden + ctrueden@wisc.edu + http://loci.wisc.edu/people/curtis-rueden UW-Madison LOCI http://loci.wisc.edu/ - architect + lead developer + debugger + reviewer + support + maintainer -6 - ctrueden - Curtis Rueden - ctrueden@wisc.edu - http://loci.wisc.edu/people/curtis-rueden + hinerm + Mark Hiner + hiner@wisc.edu + http://loci.wisc.edu/people/mark-hiner UW-Madison LOCI http://loci.wisc.edu/ - architect + lead developer + debugger + reviewer + support + maintainer -6 + + + Johannes Schindelin + http://imagej.net/User:Schindelin + founder + dscho + + + Jonathan Hale + Squareys + + scm:git:git://github.com/scijava/scripting-java From e83a41b23d0ddbe5cbb0c39848e9ce42be973fff Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 10:57:09 -0600 Subject: [PATCH 18/70] POM: bump parent to pom-scijava 9.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0636582..4f6d94f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 8.5.0 + 9.0.0 From 91e2d867e67b0e62a2a62a890a684b19e9409bd7 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 19 Nov 2015 12:52:49 -0600 Subject: [PATCH 19/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4f6d94f..6b6a69b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.4-SNAPSHOT + 0.3.5-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From 06d8ee7d5c910a4aeac454125ed7f1d023e704a5 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Dec 2015 13:48:36 -0600 Subject: [PATCH 20/70] JavaEngine: avoid setting classloader If a ClassLoader sticks around it will prevent future versions of classes from being loaded. There is no evidence that preserving the ClassLoader is actually necessary for annotation processing at this time. --- .../org/scijava/plugins/scripting/java/JavaEngine.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 93f0cde..10a85b8 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -222,12 +222,9 @@ public Class compile(String script) throws ScriptException { for (int i = 0; i < urls.length; i++) urls[i] = new URL("file:" + paths[i] + (paths[i].endsWith(".jar") ? "" : "/")); - URLClassLoader classLoader = - new URLClassLoader(urls, Thread.currentThread() - .getContextClassLoader()); - // needed for annotation processing - Thread.currentThread().setContextClassLoader(classLoader); + final URLClassLoader classLoader = new URLClassLoader(urls, Thread.currentThread() + .getContextClassLoader()); // load main class return classLoader.loadClass(mainClass); From 44c044d4f98b95f33eb0dd5fcd29343d8cd20cd9 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Dec 2015 14:36:49 -0600 Subject: [PATCH 21/70] JavaEngineTest: add annotation test Test that annotations are preserved --- .../scripting/java/JavaEngineTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 8af1ca5..ec9ce95 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -167,6 +167,32 @@ public void testEvalReader() throws Exception { assertTrue(result); } + @Test + public void testAnnotations() { + boolean result = true; + final String source = "" + // + "import org.scijava.command.Command;\n" + // + "import org.scijava.plugin.Plugin;\n" + // + "@Plugin(type = Command.class)\n" + // + "public class PluginTest implements Command {\n" + // + "\t@Override\n" + // + "\tpublic void run() {\n" + // + "\t\tSystem.out.println(\"I am a plugin!\");\n" + // + "\t}\n" + // + "}"; + + final ScriptEngine miniMaven = miniMaven(); + try { + miniMaven.eval(source); + } + catch (final ScriptException e) { + e.printStackTrace(); + result = false; + } + + assertTrue(result); + } + // -- helper functions private File makeMinimalProject() throws IOException { From 6c713b119e18a2a6dea2c64509a161ee9820d9a4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 7 Dec 2015 13:28:59 -0600 Subject: [PATCH 22/70] POM: bump parent to pom-scijava 9.1.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6b6a69b..42c50c0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 9.0.0 + 9.1.0 From 37ae753477e058843c3f68c88fae6badc708168c Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 7 Dec 2015 13:36:54 -0600 Subject: [PATCH 23/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 42c50c0..6768e81 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.5-SNAPSHOT + 0.3.6-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From d19ff0d06bcebc4711cbc397a0eae57d69b2f878 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 21 Dec 2015 14:41:36 -0600 Subject: [PATCH 24/70] JavaEngine: respect SciJava log level If it's set to INFO, set verbose=true. If it's set to DEBUG, set debug=true. --- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 10a85b8..02874d5 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -470,8 +470,8 @@ public void println(final String line) throws IOException { * @return the created {@link BuildEnvironment}. */ private BuildEnvironment createBuildEnvironment() { - boolean verbose = "true".equals(get("verbose")); - boolean debug = "true".equals(get("debug")); + boolean verbose = "true".equals(get("verbose")) || log().isInfo(); + boolean debug = "true".equals(get("debug")) || log().isDebug(); return new BuildEnvironment(err, true, verbose, debug); } From f6625e8ce4b0ecb1dccfd56c33eaa2477c3e37e3 Mon Sep 17 00:00:00 2001 From: Gabriel Einsdorf Date: Wed, 2 Mar 2016 14:06:15 -0600 Subject: [PATCH 25/70] Fix NPE when reader reads null line. Old code called trim() on ``line``, and tested for ``line == null`` afterwards. If ``line`` is actually ``null`` this will cause an ``NullPointerException`` --- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 02874d5..7ef7b91 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -550,8 +550,9 @@ private static String getFullClassName(final File file) throws IOException { Pattern.compile(".*public class ([a-zA-Z0-9_]*).*"); final BufferedReader reader = new BufferedReader(new FileReader(file)); for (;;) { - String line = reader.readLine().trim(); + String line = reader.readLine(); if (line == null) break; + line = line.trim(); outerLoop: while (line.startsWith("/*")) { int end = line.indexOf("*/", 2); From e6aa298610a35486da16f5a25f400d8b1bc89818 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 1 Apr 2016 13:54:18 -0500 Subject: [PATCH 26/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6768e81..6742682 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From e93616aa0d978f923982d5f53dad90077cda7c20 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 6 Feb 2015 05:42:00 -0600 Subject: [PATCH 27/70] JavaEngine: split Builder initialization logic Rather than doing all the work in the constructor, and throwing a bunch of exceptions, let's keep construction as simple as possible, then do all that initialization in its own method. This will make error handling more robust in that we will be able to attempt calls to builder.cleanup() even if something went wrong during initialization. --- .../plugins/scripting/java/JavaEngine.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 7ef7b91..7231e2c 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -188,21 +188,19 @@ public Class compile(String script) throws ScriptException { File file = path == null ? null : new File(path); final Writer writer = getContext().getErrorWriter(); + final Builder builder = new Builder(); try { - - final Builder builder; - if (file != null && file.exists()) { // if the filename set in engine scope bindings is valid, // ignore the given script and use that file instead. - builder = new Builder(file, writer); + builder.initialize(file, writer); } else { // script may be null, but then we cannot create a StringReader for it, // therefore null is passed if script is null. final Reader reader = (script == null) ? null : new StringReader(script); - builder = new Builder(reader, writer); + builder.initialize(reader, writer); } final MavenProject project = builder.project; String mainClass = builder.mainClass; @@ -292,10 +290,11 @@ public void compile(final File file) { * @see #compile(String) */ public void compile(final File file, final Writer errorWriter) { + final Writer writer = + (errorWriter == null) ? getContext().getErrorWriter() : errorWriter; + final Builder builder = new Builder(); try { - final Writer writer = - (errorWriter == null) ? getContext().getErrorWriter() : errorWriter; - final Builder builder = new Builder(file, writer); + builder.initialize(file, writer); try { builder.project.build(); } @@ -319,8 +318,9 @@ public void compile(final File file, final Writer errorWriter) { public void makeJar(final File file, final boolean includeSources, final File output, final Writer errorWriter) { + final Builder builder = new Builder(); try { - final Builder builder = new Builder(file, errorWriter); + builder.initialize(file, errorWriter); try { builder.project.build(true, true, includeSources); final File target = builder.project.getTarget(); @@ -368,14 +368,17 @@ private void printOrThrow(Throwable t, Writer errorWriter) { */ private class Builder { - private final PrintStream err; - private final File temporaryDirectory; + private PrintStream err; + private File temporaryDirectory; private String mainClass; private MavenProject project; /** * Constructs a wrapper around a possibly project for a source or maven * project file. + *

+ * This method is intended to be called only once. + *

* * @param file the {@code .java} file to build (or null, if {@code reader} * is set). @@ -388,7 +391,7 @@ private class Builder { * @throws TransformerException * @throws TransformerFactoryConfigurationError */ - private Builder(final File file, final Writer errorWriter) + private void initialize(final File file, final Writer errorWriter) throws ScriptException, IOException, ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, TransformerFactoryConfigurationError @@ -411,6 +414,9 @@ private Builder(final File file, final Writer errorWriter) /** * Constructs a wrapper around a possibly temporary project for source code * generated by a Reader. + *

+ * This method is intended to be called only once. + *

* * @param reader provides the Java source if {@code file} is {@code null} * @param errorWriter where to write the error output. @@ -422,7 +428,7 @@ private Builder(final File file, final Writer errorWriter) * @throws TransformerException * @throws TransformerFactoryConfigurationError */ - private Builder(final Reader reader, final Writer errorWriter) + private void initialize(final Reader reader, final Writer errorWriter) throws ScriptException, IOException, ParserConfigurationException, SAXException, TransformerConfigurationException, TransformerException, TransformerFactoryConfigurationError From 52b6d50a37869af2b41f65d726e79d20918e2921 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 6 Feb 2015 05:46:05 -0600 Subject: [PATCH 28/70] JavaEngine: always to try clean up the mess Even if the error occurred during the builder initialization, rather than the build step, let's make sure to try calling cleanup() afterward. This change makes the code simpler, too, since we no longer need nested try/catch/finally blocks. This is an attempted bug-fix for Fiji BugZilla issue #906: http://fiji.sc/bugzilla/show_bug.cgi?id=906 This patch looks best with "git show -b" to ignore whitespace changes. --- .../plugins/scripting/java/JavaEngine.java | 64 +++++++++---------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 7231e2c..8db0bef 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -205,31 +205,26 @@ public Class compile(String script) throws ScriptException { final MavenProject project = builder.project; String mainClass = builder.mainClass; - try { - project.build(true); + project.build(true); + if (mainClass == null) { + mainClass = project.getMainClass(); if (mainClass == null) { - mainClass = project.getMainClass(); - if (mainClass == null) { - throw new ScriptException("No main class found for file " + file); - } + throw new ScriptException("No main class found for file " + file); } + } - // make class loader - String[] paths = project.getClassPath(false).split(File.pathSeparator); - URL[] urls = new URL[paths.length]; - for (int i = 0; i < urls.length; i++) - urls[i] = - new URL("file:" + paths[i] + (paths[i].endsWith(".jar") ? "" : "/")); + // make class loader + String[] paths = project.getClassPath(false).split(File.pathSeparator); + URL[] urls = new URL[paths.length]; + for (int i = 0; i < urls.length; i++) + urls[i] = + new URL("file:" + paths[i] + (paths[i].endsWith(".jar") ? "" : "/")); - final URLClassLoader classLoader = new URLClassLoader(urls, Thread.currentThread() - .getContextClassLoader()); + final URLClassLoader classLoader = new URLClassLoader(urls, Thread.currentThread() + .getContextClassLoader()); - // load main class - return classLoader.loadClass(mainClass); - } - finally { - builder.cleanup(); - } + // load main class + return classLoader.loadClass(mainClass); } catch (Exception e) { if (writer != null) { @@ -242,6 +237,9 @@ public Class compile(String script) throws ScriptException { throw new ScriptException(e); } } + finally { + builder.cleanup(); + } return null; } @@ -295,16 +293,14 @@ public void compile(final File file, final Writer errorWriter) { final Builder builder = new Builder(); try { builder.initialize(file, writer); - try { - builder.project.build(); - } - finally { - builder.cleanup(); - } + builder.project.build(); } catch (Throwable t) { printOrThrow(t, errorWriter); } + finally { + builder.cleanup(); + } } /** @@ -321,20 +317,18 @@ public void makeJar(final File file, final boolean includeSources, final Builder builder = new Builder(); try { builder.initialize(file, errorWriter); - try { - builder.project.build(true, true, includeSources); - final File target = builder.project.getTarget(); - if (output != null && !target.equals(output)) { - BuildEnvironment.copyFile(target, output); - } - } - finally { - builder.cleanup(); + builder.project.build(true, true, includeSources); + final File target = builder.project.getTarget(); + if (output != null && !target.equals(output)) { + BuildEnvironment.copyFile(target, output); } } catch (Throwable t) { printOrThrow(t, errorWriter); } + finally { + builder.cleanup(); + } } /** From e37ab7f362b9b90f4ccd634c971871b314e1f100 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Dec 2015 11:37:32 -0600 Subject: [PATCH 29/70] POM: bump to pom-scijava parent 10.0.1 In particular, this updates the minimaven dependency to 2.2.0. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6b6a69b..a7780c1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.scijava pom-scijava - 9.0.0 + 10.0.1 scripting-java - 0.3.5-SNAPSHOT + 0.4.0-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From efa69682896ef3debb9bdbc0f3f7d4d9653a4ab6 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 4 Apr 2016 10:52:11 -0500 Subject: [PATCH 30/70] POM: switch to Java 1.8 We are not going to support Java 6 anymore; see: http://imagej.net/2015-12-22_-_The_road_to_Java_8 --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index a7780c1..905d907 100644 --- a/pom.xml +++ b/pom.xml @@ -87,6 +87,10 @@ http://jenkins.imagej.net/job/scripting-Java/ + + 1.8 + + From cf5607ba5392a56d7fe91671e2b6bdf72f087cfd Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Dec 2015 11:37:52 -0600 Subject: [PATCH 31/70] Remove com.sun.tools profile --- pom.xml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/pom.xml b/pom.xml index 905d907..b4ba64b 100644 --- a/pom.xml +++ b/pom.xml @@ -141,28 +141,4 @@ Institute of Molecular Cell Biology and Genetics. - - - - tools-jar - - - - ${java.home}/../lib/tools.jar - - - - - com.sun - tools - 1.4.2 - system - ${java.home}/../lib/tools.jar - - - - From 2f899f634e7e9a7eaab29e286b248f91f682d1f6 Mon Sep 17 00:00:00 2001 From: Mark Hiner Date: Wed, 2 Dec 2015 12:01:17 -0600 Subject: [PATCH 32/70] JavaEngineTest: remove com.sun.tools use --- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index ec9ce95..5317c92 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -70,7 +70,7 @@ public void assumeJavaC() { boolean found = false; try { final ClassLoader classLoader = getClass().getClassLoader(); - found = classLoader.loadClass("com.sun.tools.javac.Main") != null; + found = classLoader.loadClass("javax.tools.ToolProvider") != null; } catch (final Throwable t) { // NB: No action needed. From 6855b6127885628393432e025614b4c755dac4fe Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 6 Apr 2016 16:06:46 -0500 Subject: [PATCH 33/70] Happy New Year 2016 --- LICENSE.txt | 2 +- .../org/scijava/plugins/scripting/java/AbstractJavaRunner.java | 2 +- .../org/scijava/plugins/scripting/java/CommandJavaRunner.java | 2 +- .../org/scijava/plugins/scripting/java/DefaultJavaService.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaRunner.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaService.java | 2 +- .../java/org/scijava/plugins/scripting/java/MainJavaRunner.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index cce13af..886feee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2015, Board of Regents of the University of +Copyright (c) 2008 - 2016, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java index 9c4165b..8512648 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java +++ b/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java index 37daa90..ab6bf54 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java +++ b/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java b/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java index 81b27f7..e4b394f 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java +++ b/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 8db0bef..dda10c2 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index 173165c..bfdf665 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java index 005696c..5bcb385 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index 0aa43dd..fe0fbc8 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaService.java b/src/main/java/org/scijava/plugins/scripting/java/JavaService.java index 232d1b8..2659ef2 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaService.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaService.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java index b4dea91..53d2187 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java +++ b/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 5317c92..59b0521 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index 5729664..ab72c1a 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index 6d168ce..bda38a6 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2015 Board of Regents of the University of + * Copyright (C) 2008 - 2016 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From 14c035cc78a3a10ae253523ad43093e7c4ed7e19 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 5 Apr 2016 19:37:53 -0500 Subject: [PATCH 34/70] Remove the JavaService in favor of the RunService The core logic of JavaService was generalized and moved to SciJava Common in the form of the org.scijava.run package and friends. See: https://github.com/scijava/scijava-common/issues/226 --- pom.xml | 3 +- .../scripting/java/AbstractJavaRunner.java | 53 ----------- .../scripting/java/CommandJavaRunner.java | 74 --------------- .../scripting/java/DefaultJavaService.java | 83 ---------------- .../plugins/scripting/java/JavaEngine.java | 7 +- .../plugins/scripting/java/JavaRunner.java | 58 ----------- .../plugins/scripting/java/JavaService.java | 51 ---------- .../scripting/java/MainJavaRunner.java | 95 ------------------- .../scripting/java/JavaEngineTest.java | 3 +- 9 files changed, 7 insertions(+), 420 deletions(-) delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/JavaService.java delete mode 100644 src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java diff --git a/pom.xml b/pom.xml index b4ba64b..b9f0d6d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 10.0.1 + 10.1.0 @@ -140,5 +140,4 @@ Institute of Molecular Cell Biology and Genetics. - diff --git a/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java deleted file mode 100644 index 8512648..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/AbstractJavaRunner.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import org.scijava.plugin.AbstractHandlerPlugin; - -/** - * Abstract superclass of {@link JavaRunner} implementations. - * - * @author Curtis Rueden - */ -public abstract class AbstractJavaRunner extends - AbstractHandlerPlugin> implements JavaRunner -{ - - // -- Typed methods -- - - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Class> getType() { - return (Class) Class.class; - } - -} diff --git a/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java deleted file mode 100644 index ab6bf54..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/CommandJavaRunner.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import org.scijava.command.Command; -import org.scijava.command.CommandInfo; -import org.scijava.command.CommandService; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.Plugin; -import org.scijava.plugin.PluginService; - -/** - * Runs the given {@link Command} class. - * - * @author Curtis Rueden - */ -@Plugin(type = JavaRunner.class) -public class CommandJavaRunner extends AbstractJavaRunner { - - @Parameter - private PluginService pluginService; - - @Parameter - private CommandService commandService; - - // -- JavaRunner methods -- - - @Override - public void run(final Class c) { - @SuppressWarnings("unchecked") - final Class commandClass = (Class) c; - final Plugin annotation = c.getAnnotation(Plugin.class); - final CommandInfo info = new CommandInfo(commandClass, annotation); - pluginService.addPlugin(info); - commandService.run(info, true); - } - - // -- Typed methods -- - - @Override - public boolean supports(final Class c) { - return Command.class.isAssignableFrom(c); - } - -} diff --git a/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java b/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java deleted file mode 100644 index e4b394f..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/DefaultJavaService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import javax.script.ScriptException; - -import org.scijava.log.LogService; -import org.scijava.plugin.AbstractHandlerService; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.Plugin; -import org.scijava.service.Service; - -/** - * Default service for managing available {@link JavaRunner} plugins. - * - * @author Curtis Rueden - */ -@Plugin(type = Service.class) -public class DefaultJavaService extends - AbstractHandlerService, JavaRunner> implements JavaService -{ - - @Parameter - private LogService log; - - // -- JavaService methods -- - - @Override - public void run(final Class c) throws ScriptException { - for (final JavaRunner runner : getInstances()) { - if (runner.supports(c)) { - runner.run(c); - return; - } - } - log.error("Unknown class type: " + c.getName()); - } - - // -- PTService methods -- - - @Override - public Class getPluginType() { - return JavaRunner.class; - } - - // -- Typed methods -- - - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Class> getType() { - return (Class) Class.class; - } - -} diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index dda10c2..76b5b7f 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -73,6 +73,7 @@ import org.scijava.minimaven.MavenProject; import org.scijava.plugin.Parameter; import org.scijava.plugin.PluginService; +import org.scijava.run.RunService; import org.scijava.script.AbstractScriptEngine; import org.scijava.util.FileUtils; import org.scijava.util.LineOutputStream; @@ -114,14 +115,14 @@ public class JavaEngine extends AbstractScriptEngine { private CommandService commandService; @Parameter - private JavaService javaService; + private RunService runService; /** * Compiles and runs the specified {@code .java} class. If a filename is set * in the engine scope bindings via the {@link ScriptEngine#FILENAME} key, * this method compiles that file and runs the resulting main class instead. *

- * The currently active {@link JavaService} is responsible for running the + * The currently active {@link RunService} is responsible for running the * class. *

* @@ -133,7 +134,7 @@ public Object eval(String script) throws ScriptException { final Writer writer = getContext().getErrorWriter(); try { final Class clazz = compile(script); - javaService.run(clazz); + runService.run(clazz); } catch (Exception e) { if (writer != null) { diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java deleted file mode 100644 index 5bcb385..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaRunner.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import javax.script.ScriptException; - -import org.scijava.plugin.HandlerPlugin; -import org.scijava.plugin.Plugin; - -/** - * A plugin which extends the Java script language's execution handling. A - * {@code JavaRunner} knows how to execute certain classes, beyond just Java's - * usual {@code main} method. - *

- * Java runner plugins discoverable at runtime must implement this interface and - * be annotated with @{@link Plugin} with attribute {@link Plugin#type()} = - * {@link JavaRunner}.class. While it possible to create an console argument - * plugin merely by implementing this interface, it is encouraged to instead - * extend {@link AbstractJavaRunner}, for convenience. - *

- * - * @author Curtis Rueden - */ -public interface JavaRunner extends HandlerPlugin> { - - /** Executes the given class. */ - void run(Class c) throws ScriptException; - -} diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaService.java b/src/main/java/org/scijava/plugins/scripting/java/JavaService.java deleted file mode 100644 index 2659ef2..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import javax.script.ScriptException; - -import org.scijava.plugin.HandlerService; -import org.scijava.service.SciJavaService; - -/** - * Interface for service that manages available {@link JavaRunner} plugins. - * - * @author Curtis Rueden - */ -public interface JavaService extends - HandlerService, JavaRunner>, SciJavaService -{ - - /** Executes the given class using the most appropriate handler. */ - void run(Class c) throws ScriptException; - -} diff --git a/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java b/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java deleted file mode 100644 index 53d2187..0000000 --- a/src/main/java/org/scijava/plugins/scripting/java/MainJavaRunner.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * JSR-223-compliant Java scripting language plugin. - * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ - -package org.scijava.plugins.scripting.java; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import javax.script.ScriptException; - -import org.scijava.Priority; -import org.scijava.log.LogService; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.Plugin; - -/** - * Executes the given class's {@code main} method. - * - * @author Curtis Rueden - */ -@Plugin(type = JavaRunner.class, priority = Priority.LOW_PRIORITY) -public class MainJavaRunner extends AbstractJavaRunner { - - @Parameter(required = false) - private LogService log; - - // -- JavaRunner methods -- - - @Override - public void run(final Class c) throws ScriptException { - try { - getMain(c).invoke(null, new Object[] { new String[0] }); - } - catch (final IllegalArgumentException exc) { - throw new ScriptException(exc); - } - catch (final IllegalAccessException exc) { - throw new ScriptException(exc); - } - catch (final InvocationTargetException exc) { - throw new ScriptException(exc); - } - } - - // -- Typed methods -- - - @Override - public boolean supports(final Class c) { - return getMain(c) != null; - } - - // -- Helper methods -- - - private Method getMain(final Class c) { - try { - return c.getMethod("main", String[].class); - } - catch (final SecurityException exc) { - if (log != null) log.debug(exc); - return null; - } - catch (final NoSuchMethodException exc) { - if (log != null) log.debug(exc); - return null; - } - } - -} diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 59b0521..3187231 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.scijava.Context; import org.scijava.object.ObjectService; +import org.scijava.run.RunService; import org.scijava.script.AbstractScriptLanguageTest; import org.scijava.script.ScriptLanguage; import org.scijava.script.ScriptService; @@ -273,7 +274,7 @@ private void writeFiles(final File dir, final String... args) private ScriptEngine miniMaven() { final Context context = - new Context(ScriptService.class, ObjectService.class, JavaService.class); + new Context(ScriptService.class, ObjectService.class, RunService.class); final ObjectService objectService = context.getService(ObjectService.class); final ScriptLanguage java = objectService.getObjects(JavaScriptLanguage.class).get(0); From 0795edb1f033a5ebcfa41347354e46b384da66e5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 6 Apr 2016 16:30:10 -0500 Subject: [PATCH 35/70] Bump to next development cycle Signed-off-by: Jenkins --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b9f0d6d..669955e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From afd3de8ae6a2061388360a0306e367f69ec2e7f8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 4 May 2016 13:48:46 -0500 Subject: [PATCH 36/70] Use imagej.net URL for all developers And remove the superfluous (and prone to obsolescence) other info. --- pom.xml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 669955e..d8ec2d7 100644 --- a/pom.xml +++ b/pom.xml @@ -27,10 +27,7 @@ ctrueden Curtis Rueden - ctrueden@wisc.edu - http://loci.wisc.edu/people/curtis-rueden - UW-Madison LOCI - http://loci.wisc.edu/ + http://imagej.net/User:Rueden lead developer @@ -39,15 +36,11 @@ support maintainer - -6 hinerm Mark Hiner - hiner@wisc.edu - http://loci.wisc.edu/people/mark-hiner - UW-Madison LOCI - http://loci.wisc.edu/ + http://imagej.net/User:Hinerm lead developer @@ -56,7 +49,6 @@ support maintainer - -6 From 1eeec9553811fd6fa701e02e2620501ab93b5ec4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Jun 2016 15:48:35 -0500 Subject: [PATCH 37/70] POM: add Gabriel Einsdorf to contributors list --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index d8ec2d7..533e764 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,11 @@ founder dscho + + Gabriel Einsdorf + http://imagej.net/User:Gab1one + gab1one + Jonathan Hale Squareys From b462aee72e4177ba20350df60addd072e7c9ba2c Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Jun 2016 15:48:44 -0500 Subject: [PATCH 38/70] POM: goodbye Mark! --- pom.xml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 533e764..d0f1fad 100644 --- a/pom.xml +++ b/pom.xml @@ -37,19 +37,6 @@ maintainer - - hinerm - Mark Hiner - http://imagej.net/User:Hinerm - - lead - developer - debugger - reviewer - support - maintainer - - @@ -67,6 +54,11 @@ Jonathan Hale Squareys + + Mark Hiner + http://imagej.net/User:Hinerm + hinerm + From 1a10d069f3ede5ffe8efc4d1ab221f61eb6b3215 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 1 Jan 2017 21:04:59 -0600 Subject: [PATCH 39/70] Update parent to org.scijava:pom-scijava:12.0.0 See: http://forum.imagej.net/t/split-boms-from-parent-configuration/2563 --- pom.xml | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index d0f1fad..29fe637 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 10.1.0 + 12.0.0 @@ -16,6 +16,10 @@ JSR-223-compliant Java scripting language plugin. http://scijava.org/ 2008 + + SciJava + http://scijava.org/ + Simplified BSD License @@ -61,6 +65,16 @@ + + + SciJava + https://groups.google.com/group/scijava + https://groups.google.com/group/scijava + scijava.com + https://groups.google.com/group/scijava + + + scm:git:git://github.com/scijava/scripting-java scm:git:git@github.com:scijava/scripting-java @@ -77,7 +91,11 @@ - 1.8 + org.scijava.plugins.scripting.java + bsd_2 + Board of Regents of the University of +Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck +Institute of Molecular Cell Biology and Genetics. @@ -104,29 +122,4 @@ test
- - - - - maven-jar-plugin - - - - org.scijava.plugins.scripting.java - - - - - - org.codehaus.mojo - license-maven-plugin - - bsd_2 - Board of Regents of the University of -Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck -Institute of Molecular Cell Biology and Genetics. - - - - From b32e2f9b765b866b3d79bbe08a34a08576d65ec3 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 1 Jan 2017 21:05:01 -0600 Subject: [PATCH 40/70] Happy New Year 2017 --- LICENSE.txt | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 886feee..28fb714 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2016, Board of Regents of the University of +Copyright (c) 2008 - 2017, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 76b5b7f..eeaa8df 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index bfdf665..0cf76eb 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index fe0fbc8..00be7fe 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 3187231..d2128ab 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index ab72c1a..60794b7 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index bda38a6..5e788c4 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2016 Board of Regents of the University of + * Copyright (C) 2008 - 2017 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From ced55268db2a60ad1d9f06b47a68553756ea50ee Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 28 Feb 2017 08:17:56 -0600 Subject: [PATCH 41/70] Switch from Jenkins to Travis CI --- .travis.yml | 12 ++++++++++++ .travis/build.sh | 7 +++++++ .travis/notify.sh | 2 ++ .travis/settings.xml | 14 ++++++++++++++ README.md | 2 +- pom.xml | 4 ++-- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100755 .travis/build.sh create mode 100755 .travis/notify.sh create mode 100644 .travis/settings.xml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..90caa27 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: java +jdk: oraclejdk8 +branches: + only: master +install: true +script: ".travis/build.sh" +after_success: ".travis/notify.sh Travis-Success" +after_failure: ".travis/notify.sh Travis-Failure" +env: + global: + - secure: mx1gt8i3B+jBlKcmOp4kDdWQID9ypKY2h7p0nwLcMbUh8BliMyyHqhT8i1O9UJ7KOWTDi56njVe/OpL/Yq4n8iI5Qc6U8JsUMko7IVEKl6s2DUBjZ0RlVuKcVBJCUZV/nd++brRt6KAOq+rIKo2JBGcih2t4xQ8pSk2Z567uuN8= + - secure: OvoesZlbqzxVHsPKkgjgbl9oaW7LLcdSkPjkjoCPi5NYn1Cm4dilAOOPV4qmwRInpsJY5YKecx8s++y36G09HW5M44MmIKFkGbyi7ug/lEYY2bfUWWow/Avgl8/EL4GN0nu4vLo0jwlFilYF/tFZxisTbRmMiVCIi2J7JY5v/Lw= diff --git a/.travis/build.sh b/.travis/build.sh new file mode 100755 index 0000000..4c2f8d2 --- /dev/null +++ b/.travis/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +dir="$(dirname "$0")" +test "$TRAVIS_SECURE_ENV_VARS" = true \ + -a "$TRAVIS_PULL_REQUEST" = false \ + -a "$TRAVIS_BRANCH" = master && + mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" || + mvn install diff --git a/.travis/notify.sh b/.travis/notify.sh new file mode 100755 index 0000000..b3b239e --- /dev/null +++ b/.travis/notify.sh @@ -0,0 +1,2 @@ +#!/bin/sh +curl -fs "https://jenkins.imagej.net/job/$1/buildWithParameters?token=$TOKEN_NAME&repo=$TRAVIS_REPO_SLUG&commit=$TRAVIS_COMMIT&pr=$TRAVIS_PULL_REQUEST" diff --git a/.travis/settings.xml b/.travis/settings.xml new file mode 100644 index 0000000..71a5630 --- /dev/null +++ b/.travis/settings.xml @@ -0,0 +1,14 @@ + + + + imagej.releases + travis + ${env.MAVEN_PASS} + + + imagej.snapshots + travis + ${env.MAVEN_PASS} + + + diff --git a/README.md b/README.md index 1f95798..e66ba40 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](http://jenkins.imagej.net/job/scripting-Java/lastBuild/badge/icon)](http://jenkins.imagej.net/job/scripting-Java/) +[![](https://travis-ci.org/scijava/scripting-java.svg?branch=master)](https://travis-ci.org/scijava/scripting-java) # Java Scripting diff --git a/pom.xml b/pom.xml index 29fe637..4dec96a 100644 --- a/pom.xml +++ b/pom.xml @@ -86,8 +86,8 @@ https://github.com/scijava/scripting-java/issues - Jenkins - http://jenkins.imagej.net/job/scripting-Java/ + Travis CI + https://travis-ci.org/scijava/scripting-java From bd3ae4511721858789b2e1681945ca2ee962e4b4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2017 11:34:11 -0600 Subject: [PATCH 42/70] POM: fix typo in mailing list address --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4dec96a..0410ab0 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ SciJava https://groups.google.com/group/scijava https://groups.google.com/group/scijava - scijava.com + scijava@googlegroups.com https://groups.google.com/group/scijava From 49bd7757aadc491b088254bebafd37ee24d380b6 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 9 Mar 2017 11:35:23 -0600 Subject: [PATCH 43/70] Update parent to org.scijava:pom-scijava:14.0.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0410ab0..a307b6e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 12.0.0 + 14.0.0 @@ -14,7 +14,7 @@ SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. - http://scijava.org/ + https://github.com/scijava/scripting-java 2008 SciJava From 6ccd0519f5baef76fa54f4fe62d627bcea7a15c2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 26 Apr 2017 15:39:43 -0500 Subject: [PATCH 44/70] Fix the Travis configuration Without this, failed builds of master trigger another "mvn install". See: https://gist.github.com/ctrueden/ae0f024a0cdf2cb53c915d75b0759553 --- .travis/build.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis/build.sh b/.travis/build.sh index 4c2f8d2..8cddb5f 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -1,7 +1,10 @@ #!/bin/sh dir="$(dirname "$0")" -test "$TRAVIS_SECURE_ENV_VARS" = true \ +if [ "$TRAVIS_SECURE_ENV_VARS" = true \ -a "$TRAVIS_PULL_REQUEST" = false \ - -a "$TRAVIS_BRANCH" = master && - mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" || + -a "$TRAVIS_BRANCH" = master ] +then + mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" +else mvn install +fi From af9b612017df93d4d347c6b9f29a6c3b2bafc230 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 27 Apr 2017 14:06:20 -0500 Subject: [PATCH 45/70] Fix javadoc errors --- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index eeaa8df..2225447 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -155,7 +155,7 @@ public Object eval(String script) throws ScriptException { * in the engine scope bindings via the {@link ScriptEngine#FILENAME} key, * this method compiles that file and runs the resulting main class instead. *

- * The currently active {@link JavaService} is responsible for running the + * The currently active {@link RunService} is responsible for running the * class. *

* From 72d5cf0cbc1265c266eaf3ffd91b9d8b0310b95f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 30 Apr 2017 14:12:30 -0500 Subject: [PATCH 46/70] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a307b6e..109b48b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From b7ac7a2b60a1212528020f57b28d1fa5b85389c7 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:12 -0500 Subject: [PATCH 47/70] Update Travis configuration This will hopefully reduce the need for future en masse updates. --- .travis.yml | 6 +++--- .travis/build.sh | 11 ++--------- .travis/notify.sh | 2 -- 3 files changed, 5 insertions(+), 14 deletions(-) delete mode 100755 .travis/notify.sh diff --git a/.travis.yml b/.travis.yml index 90caa27..e75d18c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: java jdk: oraclejdk8 branches: - only: master + only: + - master + - "/.*-[0-9]+\\..*/" install: true script: ".travis/build.sh" -after_success: ".travis/notify.sh Travis-Success" -after_failure: ".travis/notify.sh Travis-Failure" env: global: - secure: mx1gt8i3B+jBlKcmOp4kDdWQID9ypKY2h7p0nwLcMbUh8BliMyyHqhT8i1O9UJ7KOWTDi56njVe/OpL/Yq4n8iI5Qc6U8JsUMko7IVEKl6s2DUBjZ0RlVuKcVBJCUZV/nd++brRt6KAOq+rIKo2JBGcih2t4xQ8pSk2Z567uuN8= diff --git a/.travis/build.sh b/.travis/build.sh index 8cddb5f..e939b6c 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -1,10 +1,3 @@ #!/bin/sh -dir="$(dirname "$0")" -if [ "$TRAVIS_SECURE_ENV_VARS" = true \ - -a "$TRAVIS_PULL_REQUEST" = false \ - -a "$TRAVIS_BRANCH" = master ] -then - mvn -Pdeploy-to-imagej deploy --settings "$dir/settings.xml" -else - mvn install -fi +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh +sh travis-build.sh diff --git a/.travis/notify.sh b/.travis/notify.sh deleted file mode 100755 index b3b239e..0000000 --- a/.travis/notify.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -curl -fs "https://jenkins.imagej.net/job/$1/buildWithParameters?token=$TOKEN_NAME&repo=$TRAVIS_REPO_SLUG&commit=$TRAVIS_COMMIT&pr=$TRAVIS_PULL_REQUEST" From e52618e94eb2b41c3146d4232902448dda0ee806 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:12 -0500 Subject: [PATCH 48/70] POM: update pom-scijava parent to 17.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 109b48b..75fbe41 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 14.0.0 + 17.1.1 From f634f1bee81c75f5594f94555c0a5bde1161abce Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 5 Oct 2017 16:40:12 -0500 Subject: [PATCH 49/70] POM: deploy releases to the ImageJ repository --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 75fbe41..f08af3c 100644 --- a/pom.xml +++ b/pom.xml @@ -96,6 +96,9 @@ Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. + + + deploy-to-imagej
From 3a428e249cb3613efe10c4fb06eb0f3559cd82c9 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 4 Apr 2019 13:35:18 -0500 Subject: [PATCH 50/70] POM: use HTTPS where feasible --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index f08af3c..d3fbcd3 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 2008 SciJava - http://scijava.org/ + https://scijava.org/ @@ -31,7 +31,7 @@ ctrueden Curtis Rueden - http://imagej.net/User:Rueden + https://imagej.net/User:Rueden lead developer @@ -45,13 +45,13 @@ Johannes Schindelin - http://imagej.net/User:Schindelin + https://imagej.net/User:Schindelin founder dscho Gabriel Einsdorf - http://imagej.net/User:Gab1one + https://imagej.net/User:Gab1one gab1one @@ -60,7 +60,7 @@ Mark Hiner - http://imagej.net/User:Hinerm + https://imagej.net/User:Hinerm hinerm From e65334a10dc781121a54aa14ba3afbb5ec6cb430 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Apr 2019 17:04:49 -0500 Subject: [PATCH 51/70] POM: maven.imagej.net -> maven.scijava.org --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d3fbcd3..5df6352 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 17.1.1 + 26.0.0 @@ -97,8 +97,8 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - - deploy-to-imagej + + deploy-to-scijava From 9891c3bb418b61be296eeb0ed87156558d92d654 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Apr 2019 17:04:49 -0500 Subject: [PATCH 52/70] Travis: build using openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e75d18c..8c3e3dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -jdk: oraclejdk8 +jdk: openjdk8 branches: only: - master From c5e29f18b3a49bb06dadeabbacbba61da49677b4 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Apr 2019 17:04:49 -0500 Subject: [PATCH 53/70] Travis: remove obsolete Maven settings --- .travis/settings.xml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .travis/settings.xml diff --git a/.travis/settings.xml b/.travis/settings.xml deleted file mode 100644 index 71a5630..0000000 --- a/.travis/settings.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - imagej.releases - travis - ${env.MAVEN_PASS} - - - imagej.snapshots - travis - ${env.MAVEN_PASS} - - - From fde688f07019fec3f219889346509f3162858ad5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 1 Jul 2021 15:45:53 -0500 Subject: [PATCH 54/70] Switch from Travis CI to GitHub Actions --- {.travis => .github}/build.sh | 4 +-- .github/setup.sh | 3 +++ .github/workflows/build-main.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/build-pr.yml | 35 ++++++++++++++++++++++++++ .travis.yml | 12 --------- README.md | 2 +- pom.xml | 6 ++--- 7 files changed, 86 insertions(+), 18 deletions(-) rename {.travis => .github}/build.sh (61%) create mode 100755 .github/setup.sh create mode 100644 .github/workflows/build-main.yml create mode 100644 .github/workflows/build-pr.yml delete mode 100644 .travis.yml diff --git a/.travis/build.sh b/.github/build.sh similarity index 61% rename from .travis/build.sh rename to .github/build.sh index e939b6c..7da4262 100755 --- a/.travis/build.sh +++ b/.github/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh -sh travis-build.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-build.sh +sh ci-build.sh diff --git a/.github/setup.sh b/.github/setup.sh new file mode 100755 index 0000000..f359bbe --- /dev/null +++ b/.github/setup.sh @@ -0,0 +1,3 @@ +#!/bin/sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-setup-github-actions.sh +sh ci-setup-github-actions.sh diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..45b6b5e --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,42 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh + env: + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASS: ${{ secrets.MAVEN_PASS }} + OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + SIGNING_ASC: ${{ secrets.SIGNING_ASC }} diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 0000000..92a0192 --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,35 @@ +name: build PR + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8c3e3dd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: java -jdk: openjdk8 -branches: - only: - - master - - "/.*-[0-9]+\\..*/" -install: true -script: ".travis/build.sh" -env: - global: - - secure: mx1gt8i3B+jBlKcmOp4kDdWQID9ypKY2h7p0nwLcMbUh8BliMyyHqhT8i1O9UJ7KOWTDi56njVe/OpL/Yq4n8iI5Qc6U8JsUMko7IVEKl6s2DUBjZ0RlVuKcVBJCUZV/nd++brRt6KAOq+rIKo2JBGcih2t4xQ8pSk2Z567uuN8= - - secure: OvoesZlbqzxVHsPKkgjgbl9oaW7LLcdSkPjkjoCPi5NYn1Cm4dilAOOPV4qmwRInpsJY5YKecx8s++y36G09HW5M44MmIKFkGbyi7ug/lEYY2bfUWWow/Avgl8/EL4GN0nu4vLo0jwlFilYF/tFZxisTbRmMiVCIi2J7JY5v/Lw= diff --git a/README.md b/README.md index e66ba40..09650b7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://travis-ci.org/scijava/scripting-java.svg?branch=master)](https://travis-ci.org/scijava/scripting-java) +[![](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml) # Java Scripting diff --git a/pom.xml b/pom.xml index 5df6352..fa66a58 100644 --- a/pom.xml +++ b/pom.xml @@ -86,8 +86,8 @@ https://github.com/scijava/scripting-java/issues - Travis CI - https://travis-ci.org/scijava/scripting-java + GitHub Actions + https://github.com/scijava/scripting-java/actions @@ -98,7 +98,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - deploy-to-scijava + sign,deploy-to-scijava From 9aa1f2b0419337475f62ae785f560876f6fc797f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Jul 2021 09:49:47 -0500 Subject: [PATCH 55/70] CI: build release tags --- .github/workflows/build-main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 45b6b5e..3fb5622 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - "*-[0-9]+.*" jobs: build: From 67489be2ffc7d7803bc0559ab573ccaac14fa739 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 8 Nov 2021 15:42:36 -0600 Subject: [PATCH 56/70] POM: Stop using git:// protocol with github.com The GitHub platform is discontinuing support for it. See: https://github.blog/2021-09-01-improving-git-protocol-security-github/#whats-changing --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa66a58..44cf8af 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ - scm:git:git://github.com/scijava/scripting-java + scm:git:https://github.com/scijava/scripting-java scm:git:git@github.com:scijava/scripting-java HEAD https://github.com/scijava/scripting-java From e9b4179bcb8ca3b585dc6d5de99fe1e7b6e33462 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 14 Jun 2022 15:54:27 -0500 Subject: [PATCH 57/70] CI: cache ~/.m2/repository correctly --- .github/workflows/build-main.yml | 18 +++--------------- .github/workflows/build-pr.yml | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 3fb5622..5ef5692 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -13,24 +13,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 92a0192..925b576 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -11,24 +11,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build From 714c51401ddfef8cc389efc7e0ea48bd7e2d810d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 14 Aug 2025 15:31:52 +0200 Subject: [PATCH 58/70] Switched using classloader to using classgraph library. --- pom.xml | 6 +- .../plugins/scripting/java/JavaEngine.java | 133 +++++------------- 2 files changed, 40 insertions(+), 99 deletions(-) diff --git a/pom.xml b/pom.xml index 44cf8af..1035e79 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,11 @@ Institute of Molecular Cell Biology and Genetics. org.scijava scijava-common - + + io.github.classgraph + classgraph + 4.8.172 + junit diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 2225447..6d61f5d 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -31,6 +31,33 @@ package org.scijava.plugins.scripting.java; +import io.github.classgraph.ClassGraph; +import org.scijava.command.CommandService; +import org.scijava.minimaven.BuildEnvironment; +import org.scijava.minimaven.Coordinate; +import org.scijava.minimaven.MavenProject; +import org.scijava.plugin.Parameter; +import org.scijava.plugin.PluginService; +import org.scijava.run.RunService; +import org.scijava.script.AbstractScriptEngine; +import org.scijava.util.FileUtils; +import org.scijava.util.LineOutputStream; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import javax.script.ScriptEngine; +import javax.script.ScriptException; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -43,44 +70,13 @@ import java.io.Reader; import java.io.StringReader; import java.io.Writer; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; -import java.util.jar.Attributes.Name; -import java.util.jar.JarFile; -import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.script.ScriptEngine; -import javax.script.ScriptException; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.scijava.command.CommandService; -import org.scijava.minimaven.BuildEnvironment; -import org.scijava.minimaven.Coordinate; -import org.scijava.minimaven.MavenProject; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.PluginService; -import org.scijava.run.RunService; -import org.scijava.script.AbstractScriptEngine; -import org.scijava.util.FileUtils; -import org.scijava.util.LineOutputStream; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.SAXException; - /** * A pseudo-{@link ScriptEngine} compiling and executing Java classes. *

@@ -787,23 +783,14 @@ private static Element append(final Document document, final Element parent, getAllDependencies(final BuildEnvironment env) { final List result = new ArrayList(); - for (ClassLoader loader = Thread.currentThread().getContextClassLoader(); loader != null; loader = - loader.getParent()) - { - if (loader instanceof URLClassLoader) { - for (final URL url : ((URLClassLoader) loader).getURLs()) { - if (url.getProtocol().equals("file")) { - final File file = new File(url.getPath()); - if (url.toString().matches( - ".*/target/surefire/surefirebooter[0-9]*\\.jar")) - { - getSurefireBooterURLs(file, url, env, result); - continue; - } - result.add(fakeDependency(env, file)); - } - } - } + ClassGraph cg = new ClassGraph(); + String cp = cg.getClasspath(); + String[] candidates = cp.split(File.pathSeparator); + + for( String candidate : candidates ){ + File file = new File(candidate); + Coordinate c = fakeDependency(env, file); + result.add(c); } return result; } @@ -830,56 +817,6 @@ private static Coordinate fakeDependency(final BuildEnvironment env, return dependency; } - /** - * Figures out the class path given a {@code .jar} file generated by the - * {@code maven-surefire-plugin}. - *

- * A little-known feature of JAR files is that their manifest can specify - * additional class path elements in a {@code Class-Path} entry. The - * {@code maven-surefire-plugin} makes extensive use of that: the URLs of the - * of the active {@link URLClassLoader} will consist of only a single - * {@code .jar} file that is empty except for a manifest whose sole purpose is - * to specify the dependencies. - *

- *

- * This method can be used to discover those additional class path elements. - *

- * - * @param file the {@code .jar} file generated by the - * {@code maven-surefire-plugin} - * @param baseURL the {@link URL} of the {@code .jar} file, needed for class - * path elements specified as relative paths - * @param env the {@link BuildEnvironment}, to store the Maven POMs faked for - * the class path elements - * @param result the list of dependencies to which the discovered dependencies - * are added - */ - private static void getSurefireBooterURLs(final File file, final URL baseURL, - final BuildEnvironment env, final List result) - { - try { - final JarFile jar = new JarFile(file); - Manifest manifest = jar.getManifest(); - if (manifest != null) { - final String classPath = - manifest.getMainAttributes().getValue(Name.CLASS_PATH); - if (classPath != null) { - for (final String element : classPath.split(" +")) - try { - final File dependency = - new File(new URL(baseURL, element).getPath()); - result.add(fakeDependency(env, dependency)); - } - catch (MalformedURLException e) { - e.printStackTrace(); - } - } - } - } - catch (final IOException e) { - e.printStackTrace(); - } - } /** * Read complete contents of a Reader and return as String. From b72274b82acbfb1dd156f88856ce1c29c5993edf Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:21:29 -0500 Subject: [PATCH 59/70] POM: update parent to pom-scijava 42.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1035e79..fd8fc39 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 26.0.0 + 42.0.0 From c3fecc77595cc7e359b115da1690709e952d009d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:22:07 -0500 Subject: [PATCH 60/70] Update copyright blurbs for 2025 --- LICENSE.txt | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 28fb714..3ee5b32 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2017, Board of Regents of the University of +Copyright (c) 2008 - 2025, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 6d61f5d..88d7e51 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index 0cf76eb..ea82a3d 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index 00be7fe..6ecad22 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index d2128ab..7c413d8 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index 60794b7..ae0b60f 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index 5e788c4..3b86531 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From 40cb95da3abcc76611e0625c8acc277d34629d85 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:22:54 -0500 Subject: [PATCH 61/70] POM: declare classgraph version as a property --- pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fd8fc39..5f354c6 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,8 @@ Institute of Molecular Cell Biology and Genetics. sign,deploy-to-scijava + + 4.8.172 @@ -111,11 +113,14 @@ Institute of Molecular Cell Biology and Genetics. org.scijava scijava-common
+ + io.github.classgraph classgraph - 4.8.172 + ${classgraph.version} + junit From d6918c0570c430832946b593f7cf456c5fca95f8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:25:36 -0500 Subject: [PATCH 62/70] Update CI to current standards; rename main branch --- .github/build.sh | 2 +- .github/setup.sh | 2 +- .github/workflows/build-pr.yml | 23 ------------------- .../workflows/{build-main.yml => build.yml} | 8 +++++-- README.md | 2 +- 5 files changed, 9 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/build-pr.yml rename .github/workflows/{build-main.yml => build.yml} (81%) diff --git a/.github/build.sh b/.github/build.sh index 7da4262..523abeb 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-build.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh sh ci-build.sh diff --git a/.github/setup.sh b/.github/setup.sh index f359bbe..a03464b 100755 --- a/.github/setup.sh +++ b/.github/setup.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-setup-github-actions.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh sh ci-setup-github-actions.sh diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml deleted file mode 100644 index 925b576..0000000 --- a/.github/workflows/build-pr.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: build PR - -on: - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Java - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'zulu' - cache: 'maven' - - name: Set up CI environment - run: .github/setup.sh - - name: Execute the build - run: .github/build.sh diff --git a/.github/workflows/build-main.yml b/.github/workflows/build.yml similarity index 81% rename from .github/workflows/build-main.yml rename to .github/workflows/build.yml index 5ef5692..b0a181e 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,12 @@ name: build on: push: branches: - - master + - main tags: - "*-[0-9]+.*" + pull_request: + branches: + - main jobs: build: @@ -28,5 +31,6 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASS: ${{ secrets.MAVEN_PASS }} - OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + CENTRAL_USER: ${{ secrets.CENTRAL_USER }} + CENTRAL_PASS: ${{ secrets.CENTRAL_PASS }} SIGNING_ASC: ${{ secrets.SIGNING_ASC }} diff --git a/README.md b/README.md index 09650b7..a16ffca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml) +[![](https://github.com/scijava/scripting-java/actions/workflows/build.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build.yml) # Java Scripting From 31fd9c6ca0983caba169d5e259e6b7987e8304dd Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:29:18 -0500 Subject: [PATCH 63/70] POM: bump version to 1.0.0-SNAPSHOT It's past time to start deploying SciJava components like this one to Maven Central! --- pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 5f354c6..73afaf8 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.4.2-SNAPSHOT + 1.0.0-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. @@ -97,9 +97,6 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - - sign,deploy-to-scijava - 4.8.172 From e8af7611ac12e369706f0414e263ac8854234da2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:30:49 -0500 Subject: [PATCH 64/70] POM: use HTTPS for schema location URL Maven no longer supports plain HTTP for the schema location. And using HTTP now generates errors in Eclipse (and probably other IDEs). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 73afaf8..808b03d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - + 4.0.0 From 4b1c9dd6f7311796a490923125415f46fc9a970e Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:31:01 -0500 Subject: [PATCH 65/70] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 808b03d..cd79974 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From 2d382bf0d2ceda6e817b59c6d3d0d4fdb83a54ee Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 18:37:27 -0500 Subject: [PATCH 66/70] Update license headers for 2026 --- LICENSE.txt | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 3ee5b32..b4d1bd0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2025, Board of Regents of the University of +Copyright (c) 2008 - 2026, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 88d7e51..3b19983 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index ea82a3d..7620396 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index 6ecad22..7c4d08f 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 7c413d8..6e9e68b 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index ae0b60f..39dff7c 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index 3b86531..a26e8cd 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From b63325f502457b9c5e4d366cc6281de01df2b5ca Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 18:37:40 -0500 Subject: [PATCH 67/70] POM: update parent to pom-scijava 44.0.0 --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index cd79974..cbced05 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 42.0.0 + 44.0.0 @@ -91,13 +91,12 @@ + 8 org.scijava.plugins.scripting.java bsd_2 Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - - 4.8.172 @@ -115,7 +114,6 @@ Institute of Molecular Cell Biology and Genetics. io.github.classgraph classgraph - ${classgraph.version} From 9ae808e63746431de3a4eb3c84804d832d58e24a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:21:46 -0500 Subject: [PATCH 68/70] Update CI to current configuration --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0a181e..612b61d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,17 +15,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '8' distribution: 'zulu' cache: 'maven' - name: Set up CI environment run: .github/setup.sh + shell: bash - name: Execute the build run: .github/build.sh + shell: bash env: GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} From b7075bd159d0ee895dd1190b2c45f2b55e279b3a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:22:23 -0500 Subject: [PATCH 69/70] Fix extraneous whitespace in generated POM files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Java 11 only (not 8, 17, or 21!), tests failed with errors like: java.lang.AssertionError: Unexpected: META-INF/maven/ org.scijava.scripting.java / Dummy /pom.xml Cause: the generated pom.xml has whitespace-polluted , , and values. Here's what was happening: 1. fakePOM() builds an XML document where each element's content is stored as a CDATA section via document.createCDATASection(content). 2. The transformer is configured with OutputKeys.INDENT = "yes". 3. In Java 8 (Xalan), the transformer writes CDATA content inline: . 4. In Java 11, the internal XSLT transformer changed its indentation behavior for CDATA nodes — it treats a CDATA section as a child node distinct from inline text, and inserts a newline + indent before it and after it: 5. When MiniMaven parses this POM back, getTextContent() on returns "\n org.scijava.scripting.java\n ", which then gets embedded verbatim into the JAR entry path and into download URLs — causing the MalformedURLException and the wrong JAR entry names. The fix is in the append method: replace createCDATASection with createTextNode. XSLT transformers universally treat text-only elements (those with a single text-node child and no element children) as opaque and don't inject indentation whitespace inside them. CDATA sections and text nodes are semantically identical in XML, but Java 11's XSLT transformer treats a CDATA node as a distinct child and wraps it with indentation whitespace when INDENT=yes. Plain text nodes in text-only elements are left inline. Co-authored-by: Claude Sonnet 4.6 --- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 3b19983..ea2a4fa 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -759,7 +759,7 @@ private static Element append(final Document document, final Element parent, { Element child = document.createElement(tag); if (content != null) child - .appendChild(document.createCDATASection(content)); + .appendChild(document.createTextNode(content)); parent.appendChild(child); return child; } From a0534cd515808e40196d6e8bd10c82ff733ea0c9 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:24:37 -0500 Subject: [PATCH 70/70] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cbced05..459e65e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin.