Skip to content

Commit 4885e58

Browse files
authored
Merge pull request github#13042 from igfoo/igfoo/ODASA_JAVA_LAYOUT
Kotlin: Remove ODASA_JAVA_LAYOUT support
2 parents 510febf + 712561f commit 4885e58

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@
5050
import com.semmle.util.trap.pathtransformers.PathTransformer;
5151

5252
public class OdasaOutput {
53-
// either these are set ...
5453
private final File trapFolder;
5554
private final File sourceArchiveFolder;
5655

57-
// ... or this one is set
58-
private final PopulationSpecFile specFile;
59-
6056
private File currentSourceFile;
6157
private TrapSet trapsCreated;
6258
private TrapDependencies trapDependenciesForSource;
@@ -72,29 +68,21 @@ public class OdasaOutput {
7268
OdasaOutput(File outputRoot, Logger log) {
7369
this.trapFolder = new File(outputRoot, "trap");
7470
this.sourceArchiveFolder = new File(outputRoot, "src_archive");
75-
this.specFile = null;
7671
this.trackClassOrigins = false;
7772
this.log = log;
7873
}
7974

8075
public OdasaOutput(boolean trackClassOrigins, Logger log) {
8176
String trapFolderVar = Env.systemEnv().getFirstNonEmpty("CODEQL_EXTRACTOR_JAVA_TRAP_DIR", Var.TRAP_FOLDER.name());
82-
if (trapFolderVar != null) {
83-
String sourceArchiveVar = Env.systemEnv().getFirstNonEmpty("CODEQL_EXTRACTOR_JAVA_SOURCE_ARCHIVE_DIR", Var.SOURCE_ARCHIVE.name());
84-
if (sourceArchiveVar == null)
85-
throw new ResourceError(Var.TRAP_FOLDER + " was set to '" + trapFolderVar + "', but "
86-
+ Var.SOURCE_ARCHIVE + " was not set");
87-
this.trapFolder = new File(trapFolderVar);
88-
this.sourceArchiveFolder = new File(sourceArchiveVar);
89-
this.specFile = null;
90-
} else {
91-
this.trapFolder = null;
92-
this.sourceArchiveFolder = null;
93-
String specFileVar = Env.systemEnv().get(Var.ODASA_JAVA_LAYOUT);
94-
if (specFileVar == null)
95-
throw new ResourceError("Neither " + Var.TRAP_FOLDER + " nor " + Var.ODASA_JAVA_LAYOUT + " was set");
96-
this.specFile = new PopulationSpecFile(new File(specFileVar));
97-
}
77+
if (trapFolderVar == null) {
78+
throw new ResourceError("CODEQL_EXTRACTOR_JAVA_TRAP_DIR was not set");
79+
}
80+
String sourceArchiveVar = Env.systemEnv().getFirstNonEmpty("CODEQL_EXTRACTOR_JAVA_SOURCE_ARCHIVE_DIR", Var.SOURCE_ARCHIVE.name());
81+
if (sourceArchiveVar == null) {
82+
throw new ResourceError("CODEQL_EXTRACTOR_JAVA_SOURCE_ARCHIVE_DIR was not set");
83+
}
84+
this.trapFolder = new File(trapFolderVar);
85+
this.sourceArchiveFolder = new File(sourceArchiveVar);
9886
this.trackClassOrigins = trackClassOrigins;
9987
this.log = log;
10088
}
@@ -123,11 +111,8 @@ public void setCurrentSourceFile(File f) {
123111

124112
/** The output paths for that file, or null if it shouldn't be included */
125113
private SpecFileEntry entryFor() {
126-
if (specFile != null)
127-
return specFile.getEntryFor(currentSourceFile);
128-
else
129-
return new SpecFileEntry(trapFolder, sourceArchiveFolder,
130-
Arrays.asList(PathTransformer.std().fileAsDatabaseString(currentSourceFile)));
114+
return new SpecFileEntry(trapFolder, sourceArchiveFolder,
115+
Arrays.asList(PathTransformer.std().fileAsDatabaseString(currentSourceFile)));
131116
}
132117

133118
/*

0 commit comments

Comments
 (0)