From 4c1e7bcfabdf19a53235a0f368bf1700aa7a9ad2 Mon Sep 17 00:00:00 2001 From: Robert Staudinger Date: Wed, 23 Mar 2016 14:05:41 +0100 Subject: [PATCH] Windows: Create WiX wxs file in project root Create the .wxs file in the project root directory rather than current dir, so extension hooks can access, modify and repackage. BUG=XWALK-6606 --- windows/lib/WinPlatform.js | 2 +- windows/lib/WixSDK.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/windows/lib/WinPlatform.js b/windows/lib/WinPlatform.js index 635dd16..1252d87 100644 --- a/windows/lib/WinPlatform.js +++ b/windows/lib/WinPlatform.js @@ -239,7 +239,7 @@ function(configId, args, callback) { var nComponents = manifest.appVersion.split(".").length; var versionPadding = new Array(4 - nComponents + 1).join(".0"); - var sdk = new WixSDK(manifest, this.output); + var sdk = new WixSDK(this.application.rootPath, manifest, this.output); var indicator = output.createInfiniteProgress("Building package"); sdk.onData = function(data) { this.logOutput.write(data); diff --git a/windows/lib/WixSDK.js b/windows/lib/WixSDK.js index a6e3d36..51f9b44 100644 --- a/windows/lib/WixSDK.js +++ b/windows/lib/WixSDK.js @@ -12,12 +12,14 @@ var ShellJS = require("shelljs"); /** * Creates WixSDK object. + * @param {String} rootPath Root path for project * @param {Manifest} manifest Web manifest * @param {OutputIface} output Output * @constructor */ -function WixSDK(manifest, output) { +function WixSDK(rootPath, manifest, output) { + this._rootPath = rootPath; this._manifest = manifest; this._output = output; } @@ -357,13 +359,13 @@ function(app_path, xwalk_path, meta_data, callback) { var xml_str = root.end({ pretty: true }); var basename = meta_data.product + "-" + meta_data.version; - fs.writeFileSync(basename + '.wxs', xml_str); - this.runWix(InQuotes(basename), function(success) { + var wxsPath = path.join(this._rootPath, basename + '.wxs'); + fs.writeFileSync(wxsPath, xml_str); + this.runWix(InQuotes(basename), wxsPath, function(success) { if (success) { // Pass back built package meta_data.msi = path.resolve(basename + ".msi"); // Only delete on success, for debugging reasons. - ShellJS.rm("-f", basename + ".wxs"); ShellJS.rm("-f", basename + ".wixobj"); ShellJS.rm("-f", basename + ".wixpdb"); } @@ -372,9 +374,9 @@ function(app_path, xwalk_path, meta_data, callback) { }; WixSDK.prototype.runWix = -function(basename, callback) { +function(basename, wxsPath, callback) { - var candle = "candle -v " + basename + ".wxs"; + var candle = "candle -v " + wxsPath; this._output.info("Running '" + candle + "'"); var child = child_process.exec(candle);