Skip to content

Commit b817b59

Browse files
committed
Merge PluginInfo with ruby instead of bash
Bash scripts are less portable[1]. In this case the unionPluginInfo.sh script failed to run on a 64-bit windows 10 Git Bash installation. Using a dedicated Maven scripting plugin, instead of the Exec maven plugin, works on Win10 and will hopefully give a better chance of working cross-platform. NB: we use ruby because on windows, project.basedir will have backslashes that do not play well with the maven integration of other languages (e.g. groovy). [1] - https://stackoverflow.com/a/8433726
1 parent cc1c4ee commit b817b59

5 files changed

Lines changed: 55 additions & 37 deletions

File tree

‎imagej/imagej-ops2/pom.xml‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,8 @@
219219
<build>
220220
<plugins>
221221
<plugin>
222-
<groupId>org.codehaus.mojo</groupId>
223-
<artifactId>exec-maven-plugin</artifactId>
224-
<executions>
225-
<execution>
226-
<id>union-metadata-indices</id>
227-
<phase>process-test-classes</phase>
228-
<goals>
229-
<goal>exec</goal>
230-
</goals>
231-
<configuration>
232-
<executable>${basedir}/unionPluginInfo.sh</executable>
233-
</configuration>
234-
</execution>
235-
</executions>
222+
<groupId>com.alexecollins.maven.plugin</groupId>
223+
<artifactId>script-maven-plugin</artifactId>
236224
</plugin>
237225
</plugins>
238226
</build>

‎imagej/imagej-ops2/unionPluginInfo.sh‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎pom.xml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585

8686
<guava.version>28.2-jre</guava.version>
8787
<geantyref.version>1.3.6</geantyref.version>
88+
89+
<script-maven.version>1.0.0</script-maven.version>
90+
<jruby.version>9.2.11.1</jruby.version>
8891
</properties>
8992

9093
<build>
@@ -102,5 +105,47 @@
102105
</configuration>
103106
</plugin>
104107
</plugins>
108+
<pluginManagement>
109+
<plugins>
110+
<plugin>
111+
<groupId>com.alexecollins.maven.plugin</groupId>
112+
<artifactId>script-maven-plugin</artifactId>
113+
<version>${script-maven.version}</version>
114+
<executions>
115+
<execution>
116+
<id>union-metadata-indices</id>
117+
<phase>process-test-classes</phase>
118+
<goals>
119+
<goal>execute</goal>
120+
</goals>
121+
<configuration>
122+
<language>ruby</language>
123+
<script>
124+
# Append the source plugin annotations to the test plugin annotations
125+
# Handle windows paths
126+
basedir = '${project.basedir}'.gsub /\\+/, '\\\\'
127+
sourceFile = basedir + '/target/classes/META-INF/json/org.scijava.plugin.Plugin'
128+
destFile = basedir + '/target/test-classes/META-INF/json/org.scijava.plugin.Plugin'
129+
input = File.open(sourceFile)
130+
data_to_copy = input.read()
131+
output = File.open(destFile, 'a')
132+
output.write(data_to_copy)
133+
input.close()
134+
output.close()
135+
</script>
136+
</configuration>
137+
</execution>
138+
</executions>
139+
<dependencies>
140+
<dependency>
141+
<groupId>org.jruby</groupId>
142+
<artifactId>jruby-complete</artifactId>
143+
<version>${jruby.version}</version>
144+
<scope>runtime</scope>
145+
</dependency>
146+
</dependencies>
147+
</plugin>
148+
</plugins>
149+
</pluginManagement>
105150
</build>
106151
</project>

‎scijava/scijava-ops/pom.xml‎

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,14 @@
9595
<license.copyrightOwners>SciJava developers.</license.copyrightOwners>
9696
</properties>
9797

98-
<build>
99-
<plugins>
100-
<plugin>
101-
<groupId>org.codehaus.mojo</groupId>
102-
<artifactId>exec-maven-plugin</artifactId>
103-
<version>${exec-maven-plugin.version}</version>
104-
<executions>
105-
<execution>
106-
<id>union-metadata-indices</id>
107-
<phase>process-test-classes</phase>
108-
<goals>
109-
<goal>exec</goal>
110-
</goals>
111-
<configuration>
112-
<executable>${basedir}/unionPluginInfo.sh</executable>
113-
</configuration>
114-
</execution>
115-
</executions>
116-
</plugin>
117-
</plugins>
118-
</build>
98+
<build>
99+
<plugins>
100+
<plugin>
101+
<groupId>com.alexecollins.maven.plugin</groupId>
102+
<artifactId>script-maven-plugin</artifactId>
103+
</plugin>
104+
</plugins>
105+
</build>
119106
<dependencies>
120107
<!-- SciJava dependencies -->
121108
<dependency>

‎scijava/scijava-ops/unionPluginInfo.sh‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)