diff --git a/installer/build.ts b/installer/build.ts index 3198ae3..0e458c6 100644 --- a/installer/build.ts +++ b/installer/build.ts @@ -12,6 +12,7 @@ import * as os from "os"; import * as asar from "asar"; import * as querystring from "querystring"; import request = require("request"); +import * as deployer from "./deploy"; let options: Options = {} as any; let version = parse_version(pkg.version); @@ -354,6 +355,38 @@ new Promise((resolve, reject) => packager(options, (err, appPaths) => err ? reje version = "v" + version; await fs.writeFile(path_helper.join(app_path[0], "version"), version); return app_path; +}).then(async () => { + if(process.argv[2] == "win32") { + console.log("Installing local PDB files"); + + const symbol_binary_path = "native/build/" + os.platform() + "_" + os.arch() + "/"; + const symbol_pdb_path = "native/build/symbols/"; + const symbol_server_path = path_helper.join(__dirname, "..", "native", "build", "symbol-server"); + + const files = []; + for(const file of await fs.readdir(symbol_binary_path)) { + console.error(file); + if(!file.endsWith(".node")) + continue; + let file_name = path_helper.basename(file); + if(file_name.endsWith(".node")) + file_name = file_name.substr(0, file_name.length - 5); + const binary_path = path_helper.join(symbol_binary_path, file); + const pdb_path = path_helper.join(symbol_pdb_path, file_name + ".pdb"); + if(!fs.existsSync(pdb_path)) { + console.warn("Missing PDB file for binary %s", file); + continue; + } + files.push({ + binary: binary_path, + pdb: pdb_path + }); + } + + console.log("Gathered %d files", files.length); + await deployer.deploy_win_dbg_files(files, version, symbol_server_path); + console.log("PDB files deployed"); + } }).then(() => { console.log("Package created"); }).catch(error => { diff --git a/installer/deploy/index.ts b/installer/deploy/index.ts index 210efd3..4230420 100644 --- a/installer/deploy/index.ts +++ b/installer/deploy/index.ts @@ -155,10 +155,10 @@ export type WinDbgFile = { binary: string, pdb: string; }; -export async function deploy_win_dbg_files(files: WinDbgFile[], version: Version) : Promise { +export async function deploy_win_dbg_files(files: WinDbgFile[], version: Version, path?: string) : Promise { //symstore add /r /f .\*.node /s \\deploy.teaspeak.de\symbols /t "TeaClient-Windows-amd64" /v "x.y.z" //symstore add /r /f .\*.* /s \\deploy.teaspeak.de\symbols /t "TeaClient-Windows-amd64" /v "1.0.0" - const server_path = "\\\\deploy.teaspeak.de\\symbols\\symbols"; + const server_path = typeof(path) === "string" && path ? path : "\\\\deploy.teaspeak.de\\symbols\\symbols"; const vstring = version_string(version); const exec = util.promisify(child_process.exec); for(const file of files) { @@ -190,7 +190,7 @@ export async function deploy_win_dbg_files(files: WinDbgFile[], version: Version stderr: string } = error; console.error("Failed to deploy %s file %s:", current_file, file); - console.log(" Code: %d", perror.code) + console.log(" Code: %d", perror.code); { console.error(" Stdout: "); for(const element of perror.stdout.split("\n")) diff --git a/package.json b/package.json index e2257f4..f44f8d0 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "cmake-js": "^4.0.1", "ejs": "^2.7.1", "electron-packager": "8.7.2", - "nodemon": "^1.19.2", + "nodemon": "^1.19.3", "platform-dependent-modules": "0.0.14", - "sass": "^1.22.12", - "typescript": "^3.6.3" + "sass": "^1.23.0", + "typescript": "^3.6.4" }, "dependencies": { "@types/minimist": "^1.2.0", @@ -60,7 +60,7 @@ "jquery": "^3.4.1", "json-stringify-safe": "^5.0.1", "jsprim": "^2.0.0", - "jsrender": "^1.0.4", + "jsrender": "^1.0.5", "nan": "^2.14.0", "node-ssh": "^6.0.0", "only": "0.0.2",