Skip to content

Commit 9667fb9

Browse files
committed
Merge branch 'script-processors'
This branch improves the script framework, adding a new ScriptProcessor plugin so that scripts can be preprocessed (in a way similar to the C preprocessor) prior to execution. The parameter declaration syntax has been changed: #@input String name #@output String greeting The old syntax is still supported, but the new syntax will mesh better with other similar preprocessing directives such as: #@repository("https://maven.imagej.net/content/groups/public") #@dependency("net.imagej:imagej:2.0.0-rc-60") (See the new scijava/scijava-grab repository for this feature.) This branch also adds a new "shebang" syntax to declare language; e.g.: #!groovy So now it is no longer necessary to provide a dummy pseudo-path just so the script framework can glean the language from the extension. In all of these cases, the directives are stripped from the script prior to execution (replaced with blank lines), to avoid confusing the script engine itself. The script processing mechanism itself is very general, allowing processors to arbitrary mutate lines of scripts, so in the future, this mechanism could allow for a variety of other neat features.
2 parents 059e699 + e5e496d commit 9667fb9

File tree

13 files changed

+801
-264
lines changed

13 files changed

+801
-264
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>scijava-common</artifactId>
13-
<version>2.63.1-SNAPSHOT</version>
13+
<version>2.64.0-SNAPSHOT</version>
1414

1515
<name>SciJava Common</name>
1616
<description>SciJava Common is a shared library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, backed by its own annotation processor, so that plugins can be loaded dynamically. It is used by downstream projects in the SciJava ecosystem, such as ImageJ and SCIFIO.</description>

src/main/java/org/scijava/plugin/PTService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* <p>
4141
* There are many kinds of services, but most of them share one common
4242
* characteristic: they provide API specific to a particular type of plugin. A
43-
* few examples from ImageJ:
43+
* few examples:
4444
* </p>
4545
* <ul>
4646
* <li>The {@link org.scijava.command.CommandService} works with

src/main/java/org/scijava/script/DefaultScriptService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.scijava.plugin.Plugin;
6363
import org.scijava.plugin.PluginService;
6464
import org.scijava.plugin.SciJavaPlugin;
65+
import org.scijava.script.process.ScriptProcessorService;
6566
import org.scijava.service.Service;
6667
import org.scijava.util.ClassUtils;
6768
import org.scijava.util.ColorRGB;
@@ -90,6 +91,9 @@ public class DefaultScriptService extends
9091
@Parameter
9192
private AppService appService;
9293

94+
@Parameter
95+
private ScriptProcessorService scriptProcessorService;
96+
9397
@Parameter
9498
private ParseService parser;
9599

0 commit comments

Comments
 (0)