Skip to content

Commit dc30dcf

Browse files
committed
TS: Only require SCRATCH_DIR when installing dependencies
1 parent 7e8fb14 commit dc30dcf

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ public class AutoBuild {
202202
private final Set<String> xmlExtensions = new LinkedHashSet<>();
203203
private ProjectLayout filters;
204204
private final Path LGTM_SRC, SEMMLE_DIST;
205-
private final Path scratchDir;
206205
private final TypeScriptMode typeScriptMode;
207206
private final String defaultEncoding;
208207
private ExecutorService threadPool;
@@ -216,7 +215,6 @@ public class AutoBuild {
216215
public AutoBuild() {
217216
this.LGTM_SRC = toRealPath(getPathFromEnvVar("LGTM_SRC"));
218217
this.SEMMLE_DIST = Paths.get(EnvironmentVariables.getExtractorRoot());
219-
this.scratchDir = Paths.get(EnvironmentVariables.getScratchDir());
220218
this.outputConfig = new ExtractorOutputConfig(LegacyLanguage.JAVASCRIPT);
221219
this.trapCache = mkTrapCache();
222220
this.typeScriptMode =
@@ -643,7 +641,7 @@ private String getChildAsString(JsonObject obj, String name) {
643641
* Some packages must be downloaded while others exist within the same repo ("monorepos")
644642
* but are not in a location where TypeScript would look for it.
645643
* <p>
646-
* Downloaded packages are intalled under {@link #scratchDir}, in a mirrored directory hierarchy
644+
* Downloaded packages are intalled under <tt>SCRATCH_DIR</tt>, in a mirrored directory hierarchy
647645
* we call the "virtual source root".
648646
* Each <tt>package.json</tt> file is rewritten and copied to the virtual source root,
649647
* where <tt>yarn install</tt> is invoked.
@@ -662,7 +660,7 @@ protected DependencyInstallationResult installDependencies(Set<Path> filesToExtr
662660
}
663661

664662
final Path sourceRoot = Paths.get(".").toAbsolutePath();
665-
final Path virtualSourceRoot = this.scratchDir.toAbsolutePath();
663+
final Path virtualSourceRoot = Paths.get(EnvironmentVariables.getScratchDir()).toAbsolutePath();
666664

667665
// Read all package.json files and index them by name.
668666
Map<Path, JsonObject> packageJsonFiles = new LinkedHashMap<>();

0 commit comments

Comments
 (0)