Skip to content

Commit 11e4fad

Browse files
authored
Merge pull request #147 from marcphilipp/reproducible-file-order
Make order of collected files reproducible
2 parents a2e2b11 + 00798b5 commit 11e4fad

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovySourcesMojo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public abstract class AbstractGroovySourcesMojo extends AbstractGroovyMojo {
5050
* @param includeJavaSources Whether to include Java sources
5151
* @return The included files from the specified sources
5252
*/
53-
protected Set<File> getFiles(final FileSet[] fromSources, final boolean includeJavaSources) {
54-
Set<File> files = new HashSet<File>();
53+
protected SortedSet<File> getFiles(final FileSet[] fromSources, final boolean includeJavaSources) {
54+
SortedSet<File> files = new TreeSet<File>();
5555
FileSetManager fileSetManager = new FileSetManager(getLog());
5656

5757
for (FileSet fileSet : getFilesets(fromSources, includeJavaSources)) {
@@ -70,8 +70,8 @@ protected Set<File> getFiles(final FileSet[] fromSources, final boolean includeJ
7070
* @param includeJavaSources Whether to include Java sources
7171
* @return The included files from the specified sources
7272
*/
73-
protected Set<File> getTestFiles(final FileSet[] fromSources, final boolean includeJavaSources) {
74-
Set<File> files = new HashSet<File>();
73+
protected SortedSet<File> getTestFiles(final FileSet[] fromSources, final boolean includeJavaSources) {
74+
SortedSet<File> files = new TreeSet<File>();
7575
FileSetManager fileSetManager = new FileSetManager(getLog());
7676

7777
for (FileSet fileSet : getTestFilesets(fromSources, includeJavaSources)) {

src/test/java/org/codehaus/gmavenplus/mojo/CompileMojoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import java.io.File;
3232
import java.lang.reflect.InvocationTargetException;
3333
import java.net.MalformedURLException;
34-
import java.util.HashSet;
3534
import java.util.Set;
35+
import java.util.TreeSet;
3636

3737
import static org.junit.Assert.assertFalse;
3838
import static org.junit.Assert.assertTrue;
@@ -51,7 +51,7 @@ public class CompileMojoTest {
5151
@Before
5252
public void setup() {
5353
MockitoAnnotations.initMocks(this);
54-
Set<File> sources = new HashSet<File>();
54+
Set<File> sources = new TreeSet<File>();
5555
sources.add(mock(File.class));
5656
doReturn(sources).when(compileMojo).getTestFiles(any(FileSet[].class), eq(false));
5757
compileMojo.outputDirectory = mock(File.class);

src/test/java/org/codehaus/gmavenplus/mojo/CompileTestsMojoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import java.io.File;
3232
import java.lang.reflect.InvocationTargetException;
3333
import java.net.MalformedURLException;
34-
import java.util.HashSet;
3534
import java.util.Set;
35+
import java.util.TreeSet;
3636

3737
import static org.junit.Assert.assertFalse;
3838
import static org.junit.Assert.assertTrue;
@@ -51,7 +51,7 @@ public class CompileTestsMojoTest {
5151
@Before
5252
public void setup() {
5353
MockitoAnnotations.initMocks(this);
54-
Set<File> sources = new HashSet<File>();
54+
Set<File> sources = new TreeSet<File>();
5555
sources.add(mock(File.class));
5656
doReturn(sources).when(compileTestsMojo).getTestFiles(any(FileSet[].class), eq(false));
5757
compileTestsMojo.testOutputDirectory = mock(File.class);

src/test/java/org/codehaus/gmavenplus/mojo/GenerateStubsMojoTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.io.File;
3232
import java.lang.reflect.InvocationTargetException;
3333
import java.net.MalformedURLException;
34-
import java.util.HashSet;
34+
import java.util.TreeSet;
3535

3636
import static org.junit.Assert.assertFalse;
3737
import static org.junit.Assert.assertTrue;
@@ -50,8 +50,8 @@ public class GenerateStubsMojoTest {
5050
@Before
5151
public void setup() {
5252
MockitoAnnotations.initMocks(this);
53-
doReturn(new HashSet<File>()).when(generateStubsMojo).getFiles(any(FileSet[].class), eq(false));
54-
doReturn(new HashSet<File>()).when(generateStubsMojo).getStubs(any(File.class));
53+
doReturn(new TreeSet<File>()).when(generateStubsMojo).getFiles(any(FileSet[].class), eq(false));
54+
doReturn(new TreeSet<File>()).when(generateStubsMojo).getStubs(any(File.class));
5555
generateStubsMojo.project = mock(MavenProject.class);
5656
generateStubsMojo.stubsOutputDirectory = mock(File.class);
5757
doReturn(mock(Build.class)).when(generateStubsMojo.project).getBuild();

src/test/java/org/codehaus/gmavenplus/mojo/GenerateTestStubsMojoTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.io.File;
3232
import java.lang.reflect.InvocationTargetException;
3333
import java.net.MalformedURLException;
34-
import java.util.HashSet;
34+
import java.util.TreeSet;
3535

3636
import static org.junit.Assert.assertFalse;
3737
import static org.junit.Assert.assertTrue;
@@ -50,8 +50,8 @@ public class GenerateTestStubsMojoTest {
5050
@Before
5151
public void setup() {
5252
MockitoAnnotations.initMocks(this);
53-
doReturn(new HashSet<File>()).when(generateTestStubsMojo).getTestFiles(any(FileSet[].class), eq(false));
54-
doReturn(new HashSet<File>()).when(generateTestStubsMojo).getStubs(any(File.class));
53+
doReturn(new TreeSet<File>()).when(generateTestStubsMojo).getTestFiles(any(FileSet[].class), eq(false));
54+
doReturn(new TreeSet<File>()).when(generateTestStubsMojo).getStubs(any(File.class));
5555
generateTestStubsMojo.project = mock(MavenProject.class);
5656
generateTestStubsMojo.testStubsOutputDirectory = mock(File.class);
5757
doReturn(mock(Build.class)).when(generateTestStubsMojo.project).getBuild();

src/test/java/org/codehaus/gmavenplus/mojo/GroovyDocMojoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import java.io.File;
3131
import java.lang.reflect.InvocationTargetException;
3232
import java.net.MalformedURLException;
33-
import java.util.HashSet;
3433
import java.util.Set;
34+
import java.util.TreeSet;
3535

3636
import static org.junit.Assert.assertFalse;
3737
import static org.junit.Assert.assertTrue;
@@ -50,7 +50,7 @@ public class GroovyDocMojoTest {
5050
@Before
5151
public void setup() {
5252
MockitoAnnotations.initMocks(this);
53-
Set<File> sources = new HashSet<File>();
53+
Set<File> sources = new TreeSet<File>();
5454
sources.add(mock(File.class));
5555
doReturn(sources).when(groovyDocMojo).getTestFiles(any(FileSet[].class), eq(false));
5656
groovyDocMojo.groovyDocOutputDirectory = mock(File.class);

src/test/java/org/codehaus/gmavenplus/mojo/GroovyDocTestsMojoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import java.io.File;
3131
import java.lang.reflect.InvocationTargetException;
3232
import java.net.MalformedURLException;
33-
import java.util.HashSet;
3433
import java.util.Set;
34+
import java.util.TreeSet;
3535

3636
import static org.junit.Assert.assertFalse;
3737
import static org.junit.Assert.assertTrue;
@@ -50,7 +50,7 @@ public class GroovyDocTestsMojoTest {
5050
@Before
5151
public void setup() {
5252
MockitoAnnotations.initMocks(this);
53-
Set<File> sources = new HashSet<File>();
53+
Set<File> sources = new TreeSet<File>();
5454
sources.add(mock(File.class));
5555
doReturn(sources).when(groovyDocTestsMojo).getTestFiles(any(FileSet[].class), eq(false));
5656
groovyDocTestsMojo.testGroovyDocOutputDirectory = mock(File.class);

0 commit comments

Comments
 (0)