Skip to content

Commit 05a1e18

Browse files
committed
Merge branch 'better-eclipse-behavior'
This branch attempts to make the codebase usable from Eclipse. It does not fully succeed; the unit tests still have problems. Fortunately, we will be ditching the SJC2-annotation-based plugins soon, which will hopefully make the remaining the Eclipse-related issues moot.
2 parents dd98459 + f178f00 commit 05a1e18

19 files changed

Lines changed: 101 additions & 49 deletions

File tree

imagej/imagej-ops2/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>

imagej/imagej-ops2/src/main/java/module-info.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
opens net.imagej.ops2.types.maxValue to org.scijava, org.scijava.ops.engine;
117117
opens net.imagej.ops2.types.minValue to org.scijava, org.scijava.ops.engine;
118118

119-
requires java.desktop;
119+
requires java.xml; // TEMP: for org.scijava:scijava-common org.scijava.util.POM
120120
requires java.scripting;
121121
requires net.imagej;
122122
requires net.imagej.mesh;
@@ -125,7 +125,10 @@
125125
requires net.imglib2.roi;
126126
requires org.joml;
127127
requires org.scijava;
128+
requires org.scijava.function;
129+
requires org.scijava.ops.api;
128130
requires org.scijava.ops.engine;
131+
requires org.scijava.ops.spi;
129132
requires org.scijava.parsington;
130133
requires org.scijava.types;
131134

@@ -135,8 +138,5 @@
135138
requires jama;
136139
requires imglib2.algorithm.fft;
137140
requires mines.jtk;
138-
requires org.scijava.function;
139-
requires org.scijava.ops.api;
140-
requires org.scijava.ops.spi;
141141

142142
}

imagej/imagej-ops2/src/main/java/net/imagej/ops2/geom/geom2d/DefaultSizePolygon.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
package net.imagej.ops2.geom.geom2d;
3131

32-
import java.awt.geom.Area;
33-
3432
import net.imglib2.RealLocalizable;
3533
import net.imglib2.roi.geom.real.Polygon2D;
3634
import net.imglib2.type.numeric.real.DoubleType;
@@ -41,7 +39,7 @@
4139
import org.scijava.plugin.Plugin;
4240

4341
/**
44-
* Specific implementation of {@link Area} for a Polygon2D.
42+
* Computes the size (i.e. area) of a {@link Polygon2D}.
4543
*
4644
* @author Daniel Seebacher (University of Konstanz)
4745
*/

imagej/imagej-testutil/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>

pom.xml

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>
66
<groupId>org.scijava</groupId>
77
<artifactId>pom-scijava</artifactId>
8-
<version>30.0.0</version>
8+
<version>31.1.0</version>
99
<relativePath />
1010
</parent>
1111

@@ -179,15 +179,31 @@
179179
<language>ruby</language>
180180
<script>
181181
# Append the source plugin annotations to the test plugin annotations
182+
require 'set'
183+
182184
# Handle windows paths
183185
basedir = '${project.basedir}'.gsub /\\+/, '\\\\'
184-
sourceFile = basedir + '/target/classes/META-INF/json/org.scijava.plugin.Plugin'
185-
destFile = basedir + '/target/test-classes/META-INF/json/org.scijava.plugin.Plugin'
186-
File.open(sourceFile) do |input|
187-
data_to_copy = input.read()
188-
File.open(destFile, 'a') do |output|
189-
output.write(data_to_copy)
190-
end
186+
187+
# Reads plugin metadata into a set of strings, one per plugin declaration.
188+
def read_plugins(path)
189+
delim = 'UNIQUE-SEQUENCE-THAT-NO-PLUGIN-WILL-EVER-USE'
190+
return File.exist?(path) ? File.read(path).sub('}{', '}' + delim + '{').split(delim).to_set : Set.new()
191+
end
192+
193+
# Read in main and test scope plugin annotations.
194+
pluginsPath = 'META-INF/json/org.scijava.plugin.Plugin'
195+
mainPluginsPath = "#{basedir}/target/classes/#{pluginsPath}"
196+
testPluginsPath = "#{basedir}/target/test-classes/#{pluginsPath}"
197+
mainPlugins = read_plugins(mainPluginsPath)
198+
testPlugins = read_plugins(testPluginsPath)
199+
200+
# Write out unioned plugin annotations to test scope plugin annotations.
201+
# Without this, the test scope code does not know of the main scope plugins.
202+
allPlugins = mainPlugins.union(testPlugins)
203+
unless allPlugins.empty?()
204+
require 'fileutils'
205+
FileUtils.mkdir_p File.dirname(testPluginsPath)
206+
File.write(testPluginsPath, allPlugins.to_a.join(''))
191207
end
192208
</script>
193209
</configuration>
@@ -205,4 +221,62 @@
205221
</plugins>
206222
</pluginManagement>
207223
</build>
224+
<profiles>
225+
<!--
226+
This profile lets Eclipse M2E work with the script-maven-plugin.
227+
-->
228+
<profile>
229+
<id>only-eclipse-incubator</id>
230+
<activation>
231+
<property>
232+
<name>m2e.version</name>
233+
</property>
234+
</activation>
235+
<build>
236+
<pluginManagement>
237+
<plugins>
238+
<plugin>
239+
<groupId>org.eclipse.m2e</groupId>
240+
<artifactId>lifecycle-mapping</artifactId>
241+
<version>1.0.0</version>
242+
<configuration>
243+
<lifecycleMappingMetadata>
244+
<pluginExecutions>
245+
<!--
246+
NB: Make Eclipse union the metadata indices on every build; see:
247+
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
248+
-->
249+
<pluginExecution>
250+
<pluginExecutionFilter>
251+
<groupId>com.alexecollins.maven.plugin</groupId>
252+
<artifactId>script-maven-plugin</artifactId>
253+
<versionRange>${script-maven-plugin.version}</versionRange>
254+
<goals>
255+
<goal>execute</goal>
256+
</goals>
257+
</pluginExecutionFilter>
258+
<action>
259+
<execute>
260+
<runOnConfiguration>true</runOnConfiguration>
261+
<!--
262+
NB: You might think we could run the annotations
263+
union script once only, at configuration time.
264+
Unfortunately, when configuration happens in Eclipse,
265+
the plugin annotations have not yet been generated.
266+
So let's redo the union on every incremental build.
267+
That'll show 'em!
268+
-->
269+
<runOnIncremental>true</runOnIncremental>
270+
</execute>
271+
</action>
272+
</pluginExecution>
273+
</pluginExecutions>
274+
</lifecycleMappingMetadata>
275+
</configuration>
276+
</plugin>
277+
</plugins>
278+
</pluginManagement>
279+
</build>
280+
</profile>
281+
</profiles>
208282
</project>

scijava/scijava-discovery/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>

scijava/scijava-function/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>

scijava/scijava-ops-api/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>

scijava/scijava-ops-discovery/.gitignore

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

scijava/scijava-ops-engine/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>

0 commit comments

Comments
 (0)