diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-11-25 22:11:54 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-11-30 15:34:53 +0000 |
commit | 7f6ec1cc271aa4b9cd3d6d53dbcadd0da1b39d23 (patch) | |
tree | 3b5ae087571a33e75059f5ec64f79f0d4cef7a96 /tests/auto/blackbox/testdata/wixDependencies | |
parent | 08ce978733b33c1b1a64e5e1e62dea22cde6148c (diff) |
Installer modules: add a "helper" file tag to pull in dependent inputs
Use case: building an Inno Setup, NSIS, or WiX project often depends on
artifacts created by other products (executables, shared libraries,
etc.). This allows the rules which create these installer files to
depend on relevant installable artifacts.
[ChangeLog] The Inno Setup, NSIS, and WiX modules' rules now have a
dependency on installable artifacts of dependencies by default, via
the default item templates InnoSetup, NSISSetup,
and WindowsInstallerPackage. This can be explicitly controlled via the
dependsOnInstallables boolean property of those item templates.
Change-Id: Ia12f7d9965091c06ab83ba86836ec989c899f765
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata/wixDependencies')
3 files changed, 104 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs b/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs new file mode 100644 index 000000000..ec839a269 --- /dev/null +++ b/tests/auto/blackbox/testdata/wixDependencies/QbsSetup.wxs @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + <Product Id="*" Name="QbsSetup" Language="1033" Version="1.0.0.0" Manufacturer="Qt Project" UpgradeCode="f60f643e-b002-44d5-b3f4-edafd078314c"> + <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> + + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> + <MediaTemplate /> + + <Feature Id="ProductFeature" Title="QbsSetup" Level="1"> + <ComponentGroupRef Id="ProductComponents" /> + </Feature> + </Product> + + <Fragment> + <Directory Id="TARGETDIR" Name="SourceDir"> + <?ifdef Win64 ?> + <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?> + <?else ?> + <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?> + <?endif ?> + <Directory Id="$(var.PlatformProgramFilesFolder)"> + <Directory Id="INSTALLFOLDER" Name="QbsSetup" /> + </Directory> + </Directory> + </Fragment> + + <Fragment> + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> + <Component Id="ProductComponent"> + <File Source="$(var.project.buildDirectory)/app.exe" /> + </Component> + <Component Id="ProductComponent2"> + <File Source="$(var.project.buildDirectory)/lib.dll" /> + </Component> + </ComponentGroup> + </Fragment> +</Wix> diff --git a/tests/auto/blackbox/testdata/wixDependencies/main.c b/tests/auto/blackbox/testdata/wixDependencies/main.c new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata/wixDependencies/main.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs b/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs new file mode 100644 index 000000000..e913124e9 --- /dev/null +++ b/tests/auto/blackbox/testdata/wixDependencies/wixDependencies.qbs @@ -0,0 +1,66 @@ +import qbs +import qbs.FileInfo + +Project { + WindowsInstallerPackage { + Depends { name: "app" } + Depends { name: "lib" } + name: "QbsSetup" + targetName: "qbs" + files: ["QbsSetup.wxs"] + wix.extensions: ["WixBalExtension", "WixUIExtension"] + destinationDirectory: project.buildDirectory + } + + Application { + Depends { name: "cpp" } + name: "app" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + destinationDirectory: project.buildDirectory + } + + DynamicLibrary { + Depends { name: "cpp" } + name: "lib" + files: ["main.c"] + Group { + fileTagsFilter: product.type + qbs.install: true + } + Rule { + // This rule tries to provoke the installer into building too early (and the test + // verifies that it does not) by causing the build of the installables to take + // a lot longer. + inputs: ["qbs"] + outputFileTags: ["c"] + outputArtifacts: { + var artifacts = []; + for (var i = 0; i < 96; ++i) + artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.silent = true; + cmd.sourceCode = function() { + for (var i = 0; i < outputs["c"].length; ++i) { + var tf; + try { + tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); + tf.writeLine("int main" + i + "() { return 0; }"); + } finally { + if (tf) + tf.close(); + } + } + }; + return [cmd]; + } + } + destinationDirectory: project.buildDirectory + } +} |