Skip to content

Commit b05e8c5

Browse files
authored
Correct Fix to make sure debugger dependencies are copied (#1621)
* Correct Fix to make sure debugger dependencies are copied Fix double compile and make sure that it is only run once. * Fix log * Andrew requested outDir
1 parent 523e8c9 commit b05e8c5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Extension/src/Support/prepublish.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,25 @@
1111

1212
const fs = require("fs");
1313
const cp = require("child_process");
14+
const path = require("path");
1415
if (!process.env.CPPTOOLS_DEV && fs.existsSync('./node_modules')) {
1516
console.log("Skipping npm install since it appears to have been executed already.");
1617
} else {
1718
console.log(">> npm install");
18-
cp.execSync("npm install", {stdio:[0, 1, 2]});
19+
cp.execSync("npm install", { stdio: [0, 1, 2] });
1920
}
2021

21-
console.log(">> tsc -p ./");
22-
cp.execSync("tsc -p ./", {stdio:[0, 1, 2]});
23-
// Required for nightly builds. Nightly builds do not enable CPPTOOLS_DEV.
24-
console.log(">> node ./out/src/Support/copyDebuggerDependencies.js");
25-
cp.execSync("node ./out/src/Support/copyDebuggerDependencies.js", {stdio:[0, 1, 2]});
22+
// If the required debugger file doesn't exist, make sure it is copied.
23+
if (process.env.CPPTOOLS_DEV || !fs.existsSync('./debugAdapters/bin/cpptools.ad7Engine.json')) {
24+
const outDir = './out/src/Support/'
25+
const copyDebuggerDependenciesJSFile = path.join(outDir, 'copyDebuggerDependencies.js');
26+
if (!fs.existsSync('./out/src/Support/copyDebuggerDependencies.js'))
27+
{
28+
console.log(">> tsc ./src/Support/copyDebuggerDependencies.ts -- outDir" + outDir);
29+
cp.execSync("tsc ./src/Support/copyDebuggerDependencies.ts --outDir " + outDir, { stdio: [0, 1, 2] });
30+
}
31+
32+
// Required for nightly builds. Nightly builds do not enable CPPTOOLS_DEV.
33+
console.log(">> node " + copyDebuggerDependenciesJSFile);
34+
cp.execSync("node " + copyDebuggerDependenciesJSFile, { stdio: [0, 1, 2] });
35+
}

0 commit comments

Comments
 (0)