50
50
import com .semmle .util .trap .pathtransformers .PathTransformer ;
51
51
52
52
public class OdasaOutput {
53
- // either these are set ...
54
53
private final File trapFolder ;
55
54
private final File sourceArchiveFolder ;
56
55
57
- // ... or this one is set
58
- private final PopulationSpecFile specFile ;
59
-
60
56
private File currentSourceFile ;
61
57
private TrapSet trapsCreated ;
62
58
private TrapDependencies trapDependenciesForSource ;
@@ -72,29 +68,21 @@ public class OdasaOutput {
72
68
OdasaOutput (File outputRoot , Logger log ) {
73
69
this .trapFolder = new File (outputRoot , "trap" );
74
70
this .sourceArchiveFolder = new File (outputRoot , "src_archive" );
75
- this .specFile = null ;
76
71
this .trackClassOrigins = false ;
77
72
this .log = log ;
78
73
}
79
74
80
75
public OdasaOutput (boolean trackClassOrigins , Logger log ) {
81
76
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 );
98
86
this .trackClassOrigins = trackClassOrigins ;
99
87
this .log = log ;
100
88
}
@@ -123,11 +111,8 @@ public void setCurrentSourceFile(File f) {
123
111
124
112
/** The output paths for that file, or null if it shouldn't be included */
125
113
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 )));
131
116
}
132
117
133
118
/*
0 commit comments