Skip to content

Commit

Permalink
try fix macos gh build
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Sep 8, 2022
1 parent 0e841d3 commit 8bb1697
Showing 1 changed file with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ public String getLanguage() {

@Override
protected void initRuntime() throws Exception {
installTsc();
npmLinkRuntime();
}

private void installTsc() throws Exception {
Processor.run(new String[] {"npm", "--silent", "install", "typescript", "--save-dev"}, NORMALIZED_JAVASCRIPT_RUNTIME_PATH);
}

private void npmLinkRuntime() throws Exception {
File dir = new File(NORMALIZED_JAVASCRIPT_RUNTIME_PATH);
if(!dir.exists())
throw new RuntimeException("Can't locate JavaScript runtime!");
ProcessBuilder pb = new ProcessBuilder()
.command("npm", "--silent", "link")
.directory(dir)
.inheritIO();
Process p = pb.start();
p.waitFor();
Processor.run(new String[] {"npm", "--silent", "link"}, NORMALIZED_JAVASCRIPT_RUNTIME_PATH);
}

@Override
Expand Down Expand Up @@ -81,30 +81,15 @@ protected CompiledState compile(RunOptions runOptions, GeneratedState generatedS
}

private void npmInstall() throws Exception {
ProcessBuilder pb = new ProcessBuilder()
.command("npm", "--silent", "install")
.directory(new File(getTempDirPath()))
.inheritIO();
Process p = pb.start();
p.waitFor();
Processor.run(new String[] {"npm", "--silent", "install"}, getTempDirPath());
}

private void npmLinkAntlr4() throws Exception {
ProcessBuilder pb = new ProcessBuilder()
.command("npm", "--silent", "link", "antlr4")
.directory(new File(getTempDirPath()))
.inheritIO();
Process p = pb.start();
p.waitFor();
Processor.run(new String[] {"npm", "--silent", "link", "antlr4"}, getTempDirPath());
}

private void tscCompile() throws Exception {
ProcessBuilder pb = new ProcessBuilder()
.command("tsc", "--project", "tsconfig.json")
.directory(new File(getTempDirPath()))
.inheritIO();
Process p = pb.start();
p.waitFor();
Processor.run(new String[] {"tsc", "--project", "tsconfig.json"}, getTempDirPath());
}

@Override
Expand Down

0 comments on commit 8bb1697

Please sign in to comment.