Skip to content

Commit

Permalink
Provide IDE name in TLC statistics, tlaplus#114
Browse files Browse the repository at this point in the history
  • Loading branch information
alygin authored and lemmy committed Jun 10, 2021
1 parent 2b248d8 commit 73c2e5e
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/tla2tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,26 @@ export async function runPlusCal(tlaFilePath: string): Promise<ToolProcessInfo>
return runTool(
TlaTool.PLUS_CAL,
tlaFilePath,
buildPlusCalOptions(tlaFilePath, customOptions)
buildPlusCalOptions(tlaFilePath, customOptions),
[]
);
}

export async function runSany(tlaFilePath: string): Promise<ToolProcessInfo> {
return runTool(
TlaTool.SANY,
tlaFilePath,
[ path.basename(tlaFilePath) ]
[ path.basename(tlaFilePath) ],
[]
);
}

export async function runTex(tlaFilePath: string): Promise<ToolProcessInfo> {
return runTool(
TlaTool.TEX,
tlaFilePath,
[ path.basename(tlaFilePath) ]
[ path.basename(tlaFilePath) ],
[]
);
}

Expand All @@ -87,14 +90,20 @@ export async function runTlc(tlaFilePath: string, cfgFilePath: string): Promise<
return runTool(
TlaTool.TLC,
tlaFilePath,
buildTlcOptions(tlaFilePath, cfgFilePath, customOptions)
buildTlcOptions(tlaFilePath, cfgFilePath, customOptions),
[ '-Dtlc2.TLC.ide=vscode' ]
);
}

async function runTool(toolName: string, filePath: string, toolOptions: string[]): Promise<ToolProcessInfo> {
async function runTool(
toolName: string,
filePath: string,
toolOptions: string[],
javaOptions: string[]
): Promise<ToolProcessInfo> {
const javaPath = await obtainJavaPath();
const cfgOptions = getConfigOptions(CFG_JAVA_OPTIONS);
const args = buildJavaOptions(cfgOptions).concat(toolsBaseArgs);
const args = buildJavaOptions(cfgOptions).concat(toolsBaseArgs).concat(javaOptions);
args.push(toolName);
toolOptions.forEach(opt => args.push(opt));
const proc = spawn(javaPath, args, { cwd: path.dirname(filePath) });
Expand Down

0 comments on commit 73c2e5e

Please sign in to comment.