Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a TreeSet instead of HashSet to get consistent ordering of results #352

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import org.codehaus.plexus.util.DirectoryScanner;
import org.slf4j.Logger;
Expand Down Expand Up @@ -99,18 +99,22 @@ protected org.codehaus.plexus.logging.Logger getLogger() {

public abstract String getCompilerId();

@Override
public CompilerResult performCompile(CompilerConfiguration configuration) throws CompilerException {
throw new CompilerNotImplementedException("The performCompile method has not been implemented.");
}

@Override
public CompilerOutputStyle getCompilerOutputStyle() {
return compilerOutputStyle;
}

@Override
public String getInputFileEnding(CompilerConfiguration configuration) throws CompilerException {
return inputFileEnding;
}

@Override
public String getOutputFileEnding(CompilerConfiguration configuration) throws CompilerException {
if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE) {
throw new RuntimeException("This compiler implementation doesn't have one output file per input file.");
Expand All @@ -119,6 +123,7 @@ public String getOutputFileEnding(CompilerConfiguration configuration) throws Co
return outputFileEnding;
}

@Override
public String getOutputFile(CompilerConfiguration configuration) throws CompilerException {
if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) {
throw new RuntimeException("This compiler implementation doesn't have one output file for all files.");
Expand All @@ -127,6 +132,7 @@ public String getOutputFile(CompilerConfiguration configuration) throws Compiler
return outputFile;
}

@Override
public boolean canUpdateTarget(CompilerConfiguration configuration) throws CompilerException {
return true;
}
Expand Down Expand Up @@ -174,7 +180,7 @@ protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration c

String[] sourceDirectorySources = scanner.getIncludedFiles();

Set<String> sources = new HashSet<>();
Set<String> sources = new TreeSet<>();

for (String sourceDirectorySource : sourceDirectorySources) {
File f = new File(sourceLocation, sourceDirectorySource);
Expand All @@ -186,7 +192,7 @@ protected static Set<String> getSourceFilesForSourceRoot(CompilerConfiguration c
}

protected static String[] getSourceFiles(CompilerConfiguration config) {
Set<String> sources = new HashSet<>();
Set<String> sources = new TreeSet<>();

Set<File> sourceFiles = config.getSourceFiles();

Expand Down