Skip to content

Commit ae8e500

Browse files
committed
Merge branch 'master' into parallel
2 parents 6d4f829 + d864930 commit ae8e500

File tree

488 files changed

+21184
-1101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

488 files changed

+21184
-1101
lines changed

Diff for: .github/workflows/build-main.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,12 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v2
16-
17-
- name: Cache m2 folder
18-
uses: actions/cache@v2
19-
env:
20-
cache-name: cache-m2
21-
with:
22-
path: ~/.m2/repository
23-
key: ${{ runner.os }}-build-${{ env.cache-name }}
24-
restore-keys: |
25-
${{ runner.os }}-build-${{ env.cache-name }}-
26-
${{ runner.os }}-build-
27-
${{ runner.os }}-
28-
29-
- name: Set up JDK 8
30-
uses: actions/setup-java@v2
16+
- name: Set up Java
17+
uses: actions/setup-java@v3
3118
with:
3219
java-version: '8'
3320
distribution: 'zulu'
21+
cache: 'maven'
3422
- name: Set up CI environment
3523
run: .github/setup.sh
3624
- name: Execute the build

Diff for: .github/workflows/build-pr.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,12 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
15-
- name: Cache m2 folder
16-
uses: actions/cache@v2
17-
env:
18-
cache-name: cache-m2
19-
with:
20-
path: ~/.m2/repository
21-
key: ${{ runner.os }}-build-${{ env.cache-name }}
22-
restore-keys: |
23-
${{ runner.os }}-build-${{ env.cache-name }}-
24-
${{ runner.os }}-build-
25-
${{ runner.os }}-
26-
27-
- name: Set up JDK 8
28-
uses: actions/setup-java@v2
14+
- name: Set up Java
15+
uses: actions/setup-java@v3
2916
with:
3017
java-version: '8'
3118
distribution: 'zulu'
19+
cache: 'maven'
3220
- name: Set up CI environment
3321
run: .github/setup.sh
3422
- name: Execute the build

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/.project
33
/.settings/
44
/target/
5+
.DS_Store
56

67
# IntelliJ
78
/.idea/

Diff for: LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2009 - 2021, Tobias Pietzsch, Stephan Preibisch, Stephan Saalfeld,
1+
Copyright (c) 2009 - 2024, Tobias Pietzsch, Stephan Preibisch, Stephan Saalfeld,
22
John Bogovic, Albert Cardona, Barry DeZonia, Christian Dietz, Jan Funke,
33
Aivar Grislis, Jonathan Hale, Grant Harris, Stefan Helfrich, Mark Hiner,
44
Martin Horn, Steffen Jaensch, Lee Kamentsky, Larry Lindsey, Melissa Linkert,

Diff for: bin/generate.groovy

+238
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
#!/usr/bin/env groovy
2+
3+
/*
4+
* #%L
5+
* SciJava Operations: a framework for reusable algorithms.
6+
* %%
7+
* Copyright (C) 2018 SciJava developers.
8+
* %%
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice,
13+
* this list of conditions and the following disclaimer.
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
22+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28+
* POSSIBILITY OF SUCH DAMAGE.
29+
* #L%
30+
*/
31+
32+
debug = System.getenv('DEBUG')
33+
def debug(msg) {
34+
if (debug) System.err.println("[DEBUG] $msg")
35+
}
36+
37+
@Grab('org.apache.velocity:velocity:1.7')
38+
import org.apache.velocity.app.VelocityEngine
39+
40+
// TODO: Get path to Groovy script and make these dirs relative to that.
41+
templateDirectory = 'templates'
42+
outputDirectory = 'src'
43+
44+
knownFiles = new java.util.HashSet();
45+
46+
/* Gets the last modified timestamp for the given file. */
47+
def timestamp(dir, file) {
48+
if (file == null) return Long.MAX_VALUE;
49+
file = new java.io.File(dir, file);
50+
knownFiles.add(file);
51+
return file.lastModified();
52+
}
53+
54+
/* Processes a template using Apache Velocity. */
55+
def processTemplate(engine, context, templateFile, outFilename) {
56+
debug("processTemplate('$engine', '$context', '$templateFile', '$outFilename')")
57+
58+
if (outFilename == null) return; // nothing to do
59+
60+
// create output directory if it does not already exist
61+
outFile = new java.io.File(outputDirectory, outFilename);
62+
knownFiles.add(outFile);
63+
if (outFile.getParentFile() != null) outFile.getParentFile().mkdirs();
64+
65+
// apply the template and write out the result
66+
t = engine.getTemplate(templateFile);
67+
writer = new StringWriter();
68+
t.merge(context, writer);
69+
out = new PrintWriter(outFile, "UTF-8");
70+
out.print(writer.toString());
71+
out.close();
72+
}
73+
74+
/* Evaluates a string using Groovy. */
75+
def parseValue(sh, translationsFile, key, expression) {
76+
try {
77+
result = sh.evaluate(expression)
78+
sh.setVariable(key, result)
79+
return result
80+
}
81+
catch (groovy.lang.GroovyRuntimeException e) {
82+
print("[WARNING] $translationsFile: " +
83+
"key '$key' has unparseable value: " + e.getMessage());
84+
}
85+
}
86+
87+
/* Reads a translations File */
88+
def readTranslation(engine, globalContext, reader, templateSubdirectory, templateFile, translationsFile, isInclude){
89+
sh = new groovy.lang.GroovyShell();
90+
for (;;) {
91+
// read the line
92+
line = reader.readLine();
93+
94+
if (line == null) break;
95+
// check if the line starts a new section
96+
if (line.startsWith("[") && line.endsWith("]")) {
97+
// if we are parsing a .include file, return when we hit any sections
98+
if(isInclude){
99+
println("[WARNING] $translationsFile: Section definition in .include file. Ending processing of $translationsFile");
100+
return context;
101+
}
102+
// write out the previous file
103+
processTemplate(engine, context, templateFile, outputFilename);
104+
105+
// start a new file
106+
outputFilename = line.substring(1, line.length() - 1);
107+
if (!templateDirectory.equals(templateSubdirectory)) {
108+
subPath = templateSubdirectory.substring(templateDirectory.length() + 1);
109+
outputFilename = "$subPath/$outputFilename";
110+
}
111+
context = new org.apache.velocity.VelocityContext(globalContext);
112+
continue;
113+
}
114+
115+
// ignore blank lines
116+
trimmedLine = line.trim();
117+
if (trimmedLine.isEmpty()) continue;
118+
119+
// ignore comments
120+
if (trimmedLine.startsWith("#")) continue;
121+
122+
// include any global files
123+
if (trimmedLine.startsWith(".include")){
124+
includeFile = line.substring(9);
125+
if(includeFile.startsWith("templates")){
126+
includeSubdirectory = includeFile.substring(0, includeFile.lastIndexOf("/"))
127+
includeFile = includeFile.substring(includeFile.lastIndexOf("/"))
128+
}
129+
else{
130+
includeSubdirectory = templateSubdirectory
131+
}
132+
globalReader = new java.io.BufferedReader(new java.io.FileReader("$includeSubdirectory/$includeFile"));
133+
encapsulatedContext = new org.apache.velocity.VelocityContext(context)
134+
context = readTranslation(engine, encapsulatedContext, globalReader, templateSubdirectory, templateFile, includeFile, true)
135+
continue;
136+
}
137+
138+
if (!line.contains('=')) {
139+
print("[WARNING] $translationsFile: Ignoring spurious line: $line");
140+
continue;
141+
}
142+
143+
int idx = line.indexOf('=');
144+
key = line.substring(0, idx).trim();
145+
value = line.substring(idx + 1);
146+
147+
if (value.trim().equals('```')) {
148+
// multi-line value
149+
builder = new StringBuilder();
150+
for (;;) {
151+
line = reader.readLine();
152+
if (line == null) {
153+
throw new RuntimeException("Unfinished value: " + builder.toString());
154+
}
155+
if (line.equals('```')) {
156+
break;
157+
}
158+
if (builder.length() > 0) {
159+
builder.append("\n");
160+
}
161+
builder.append(line);
162+
}
163+
value = builder.toString();
164+
}
165+
166+
context.put(key, parseValue(sh, translationsFile, key, value));
167+
}
168+
169+
return context;
170+
}
171+
172+
/*
173+
* Translates a template into many files in the outputDirectory,
174+
* given a translations file in INI style; e.g.:
175+
*
176+
* [filename1]
177+
* variable1 = value1
178+
* variable2 = value2
179+
* ...
180+
* [filename2]
181+
* variable1 = value3
182+
* variable2 = value4
183+
* ...
184+
*/
185+
def translate(templateSubdirectory, templateFile, translationsFile) {
186+
debug("translate('$templateSubdirectory', '$templateFile', '$translationsFile')")
187+
188+
// initialize the Velocity engine
189+
engine = new org.apache.velocity.app.VelocityEngine();
190+
p = new java.util.Properties();
191+
// fail if template uses an invalid expression; e.g., an undefined variable
192+
p.setProperty("runtime.references.strict", "true");
193+
// tell Velocity where the templates are located
194+
p.setProperty("file.resource.loader.path", "$templateSubdirectory");
195+
// tell Velocity to log to stderr rather than to a velocity.log file
196+
p.setProperty(org.apache.velocity.runtime.RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
197+
"org.apache.velocity.runtime.log.SystemLogChute");
198+
engine.init(p);
199+
200+
// read translation lines
201+
outputFilename = null;
202+
context = globalContext = new org.apache.velocity.VelocityContext();
203+
reader = new java.io.BufferedReader(new java.io.FileReader("$templateSubdirectory/$translationsFile"));
204+
205+
readTranslation(engine, context, reader, templateSubdirectory, templateFile, translationsFile, false);
206+
207+
reader.close();
208+
209+
// process the template
210+
processTemplate(engine, context, templateFile, outputFilename);
211+
}
212+
213+
/* Recursively translates all templates in the given directory. */
214+
def translateDirectory(templateSubdirectory) {
215+
debug("translateDirectory('$templateSubdirectory')")
216+
217+
for (file in new java.io.File(templateSubdirectory).listFiles()) {
218+
if (file.isDirectory()) {
219+
// process subdirectories recursively
220+
translateDirectory(file.getPath());
221+
}
222+
else {
223+
// process Velocity template files only
224+
name = file.getName();
225+
if (!name.endsWith('.vm')) continue;
226+
prefix = name.substring(0, name.lastIndexOf('.'));
227+
translate(templateSubdirectory, name, prefix + '.list');
228+
}
229+
}
230+
}
231+
232+
try {
233+
translateDirectory(templateDirectory);
234+
}
235+
catch (Throwable t) {
236+
t.printStackTrace(System.err);
237+
throw t;
238+
}

Diff for: pom.xml

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
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>31.1.0</version>
8+
<version>39.0.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<groupId>net.imglib2</groupId>
1313
<artifactId>imglib2-algorithm</artifactId>
14-
<version>0.12.2-SNAPSHOT</version>
14+
<version>0.17.3-SNAPSHOT</version>
1515

1616
<name>ImgLib2 Algorithms</name>
1717
<description>Useful image processing algorithms.</description>
@@ -166,7 +166,7 @@
166166
<mailingLists>
167167
<mailingList>
168168
<name>Image.sc Forum</name>
169-
<archive>https://forum.image.sc/tags/imglib2</archive>
169+
<archive>https://forum.image.sc/tag/imglib2</archive>
170170
</mailingList>
171171
</mailingLists>
172172

@@ -200,7 +200,8 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
200200

201201
<!-- NB: Deploy releases to the SciJava Maven repository. -->
202202
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
203-
<imglib2.version>5.13.0</imglib2.version>
203+
204+
<imglib2.version>7.1.4</imglib2.version>
204205
</properties>
205206

206207
<repositories>
@@ -225,6 +226,10 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
225226
<groupId>net.imglib2</groupId>
226227
<artifactId>imglib2-realtransform</artifactId>
227228
</dependency>
229+
<dependency>
230+
<groupId>net.imglib2</groupId>
231+
<artifactId>imglib2-cache</artifactId>
232+
</dependency>
228233

229234
<!-- Third-party dependencies -->
230235
<dependency>
@@ -239,12 +244,18 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
239244
<groupId>org.ojalgo</groupId>
240245
<artifactId>ojalgo</artifactId>
241246
</dependency>
247+
248+
<!-- Test dependencies -->
249+
<dependency>
250+
<groupId>sc.fiji</groupId>
251+
<artifactId>bigdataviewer-core</artifactId>
252+
<scope>test</scope>
253+
</dependency>
242254
<dependency>
243255
<groupId>net.imglib2</groupId>
244-
<artifactId>imglib2-cache</artifactId>
256+
<artifactId>imglib2-ij</artifactId>
257+
<scope>test</scope>
245258
</dependency>
246-
247-
<!-- Test dependencies -->
248259
<dependency>
249260
<groupId>junit</groupId>
250261
<artifactId>junit</artifactId>
@@ -261,15 +272,4 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
261272
<scope>test</scope>
262273
</dependency>
263274
</dependencies>
264-
265-
<build>
266-
<plugins>
267-
<plugin>
268-
<artifactId>maven-javadoc-plugin</artifactId>
269-
<configuration>
270-
<additionalparam>--allow-script-in-comments -header '&lt;script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;&lt;/script&gt;'</additionalparam>
271-
</configuration>
272-
</plugin>
273-
</plugins>
274-
</build>
275275
</project>

0 commit comments

Comments
 (0)