diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-12-08 16:16:11 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-12-09 19:17:20 +0000 |
commit | babbf2156579e6e0bbdac973aa5fc8c30d00b806 (patch) | |
tree | 6b928ea94a30ddd059e29f3eb4bf3c43725cec4f | |
parent | 64e336b7af5b863de7e8108448f9103706786714 (diff) |
Fix some issues in the WiX module causing the autotest to fail
This allows qbs.architecture to be undefined for WiX, in which case the
WiX default architecture of x86 will be used. The autotest would fail if
there was no architecture set in the profile (which is allowed).
This also corrects the registry key name for finding WiX, leading to
incorrect autotest failures if WiX tools were in not in the PATH or
WiX properties were not set in a profile.
Lastly, this fixes a wrong concatenation of product.buildDirectory and
improves the output and error reporting for the autotest.
Change-Id: I227924b681131c13fcb09d2d5010b372ff44b241
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | share/qbs/modules/wix/WiXModule.qbs | 30 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/wix/WiXInstallers.qbs | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 18 |
3 files changed, 33 insertions, 19 deletions
diff --git a/share/qbs/modules/wix/WiXModule.qbs b/share/qbs/modules/wix/WiXModule.qbs index 1ef816f87..e605b5e21 100644 --- a/share/qbs/modules/wix/WiXModule.qbs +++ b/share/qbs/modules/wix/WiXModule.qbs @@ -208,14 +208,16 @@ Module { } var arch = product.moduleProperty("qbs", "architecture"); - if (!["x86", "x86_64", "ia64", "arm"].contains(arch)) { - // http://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html - throw("WiX: unsupported architecture '" + arch + "'"); - } - // QBS uses "x86_64", Microsoft uses "x64" - if (arch === "x86_64") { + // http://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html + switch (arch) { + case "x86_64": arch = "x64"; + break; + case "armv7": + case "armv7a": + arch = "arm"; + break; } // Visual Studio defines these variables along with various solution and project names and paths; @@ -245,10 +247,10 @@ Module { throw("WiX: Unsupported product type '" + product.type + "'"); } - var builtBinaryFilePath = FileInfo.joinPaths(product.buildDirectory, product.destinationDirectory, product.targetName + productTargetExt); + var builtBinaryFilePath = FileInfo.joinPaths(product.destinationDirectory, product.targetName + productTargetExt); args.push("-dOutDir=" + FileInfo.toWindowsSeparators(FileInfo.path(builtBinaryFilePath))); // in VS, relative to the project file by default - args.push("-dPlatform=" + arch); + args.push("-dPlatform=" + (arch || "x86")); args.push("-dProjectName=" + project.name); @@ -301,8 +303,11 @@ Module { args.push("-out"); args.push(FileInfo.toWindowsSeparators(output.filePath)); - args.push("-arch"); - args.push(arch); + + if (arch) { + args.push("-arch"); + args.push(arch); + } var extensions = ModUtils.moduleProperty(input, "extensions"); for (i in extensions) { @@ -316,6 +321,11 @@ Module { cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.workingDirectory = FileInfo.path(output.filePath); + // candle.exe outputs the file name. We filter that out. + cmd.inputFileName = input.fileName; + cmd.stdoutFilterFunction = function(output) { + return output.split(inputFileName + "\r\n").join(""); + }; return cmd; } } diff --git a/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs index 3e7facd7d..2c4c0b3c1 100644 --- a/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs +++ b/tests/auto/blackbox/testdata/wix/WiXInstallers.qbs @@ -4,7 +4,7 @@ import qbs.FileInfo Project { WindowsInstallerPackage { name: "QbsSetup" - targetName: "qbs-" + qbs.architecture + targetName: "qbs" files: ["QbsSetup.wxs", "ExampleScript.bat"] wix.defines: ["scriptName=ExampleScript.bat"] wix.extensions: ["WixBalExtension", "WixUIExtension"] @@ -23,6 +23,7 @@ Project { name: "QbsBootstrapper" targetName: "qbs-setup-" + qbs.architecture files: ["QbsBootstrapper.wxs"] + qbs.architecture: original || "x86" } WindowsInstallerPackage { @@ -30,5 +31,6 @@ Project { files: ["QbsSetup.wxs", "Qt.wxs", "de.wxl"] wix.defines: ["scriptName=ExampleScript.bat"] wix.cultures: [] + qbs.architecture: original || "x86" } } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 6577ebbc4..7453944c6 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3849,8 +3849,8 @@ static bool haveWiX(const Profile &profile) } QStringList regKeys; - regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML") - << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML"); + regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") + << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); @@ -3887,20 +3887,22 @@ void TestBlackbox::wix() return; } - const QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); + QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); + if (arch.isEmpty()) + arch = QByteArrayLiteral("x86"); QDir::setCurrent(testDataDir + "/wix"); QbsRunParameters params; if (!HostOsInfo::isWindowsHost()) params.arguments << "qbs.targetOS:windows"; QCOMPARE(runQbs(params), 0); - QVERIFY(m_qbsStdout.contains("compiling QbsSetup.wxs")); - QVERIFY(m_qbsStdout.contains("linking qbs-" + arch + ".msi")); - QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs-" + arch + ".msi")); + QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); + QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.msi")); if (HostOsInfo::isWindowsHost()) { - QVERIFY(m_qbsStdout.contains("compiling QbsBootstrapper.wxs")); - QVERIFY(m_qbsStdout.contains("linking qbs-setup-" + arch + ".exe")); + QVERIFY2(m_qbsStdout.contains("compiling QbsBootstrapper.wxs"), m_qbsStdout); + QVERIFY2(m_qbsStdout.contains("linking qbs-setup-" + arch + ".exe"), m_qbsStdout); QVERIFY(regularFileExists(relativeProductBuildDir("QbsBootstrapper") + "/qbs-setup-" + arch + ".exe")); } |