[QBS] How to run the WIX product in the end?

Denis Shienkov denis.shienkov at gmail.com
Fri Feb 27 15:16:40 CET 2015


Hi all.

Is any trick to run the WIX product only after that all others products (as
applications and as dynamic libraries) are compiled?

I have the project which contains a lot of products (like applications,
libraries and the WIX product). And if I try to build a whole project from
the QtCreator, then I want that the WIX product was started in the end,
i.e. when all others things was ready (was compiled).

To the WIX product I add the Depends{} from the each of desired product.
But the Wix module started not in the end, but somewhere in middle.. And,
in this case I got a wrong installer, that can not contains a desired
applications and libraries.

== qbs/imports/BaseWinInstaller.qbs ==

Product {

    Depends { name: "wix"; condition: qbs.hostOS.contains("windows")
&& qbs.targetOS.contains("windows") }

    type: [ "msi" ]


    readonly property string debugPrefix: {

        return qbs.debugInformation ? "d" : "";

    }


    property string filesDirectory: "../" + destinationDirectory


    property stringList baseDefines: {

        var defines = [];

        defines.push("ProductVersion=" + project.productVersion);

        defines.push("ProductName=" + project.productName);

        defines.push("ProductManufacturer=" + project.productManufacturer);

        defines.push("ProjectFilesDir=" + buildDirectory + "/../" +
destinationDirectory);

        return defines;

    }


    destinationDirectory: project.deployDir


    wix.extensions: [ "WixUIExtension" ]

    wix.cultures: [ "ru-ru" ]


    FileTagger {

        patterns: [ "*.xsl" ]

        fileTags: [ "xsl" ]

    }


    Rule {

        id: heat

        inputs: [ "xsl" ]

        Artifact {

            fileTags: [ "wxs" ]

            filePath: FileInfo.baseName(input.filePath) + ".wxs"

        }


        prepare: {

            var args = [];

            args.push("dir", product.filesDirectory);

            args.push("-cg", "ProductFiles");

            args.push("-gg");

            args.push("-scom");

            args.push("-sreg");

            args.push("-sfrag");

            args.push("-srd");

            args.push("-dr", "INSTALLLOCATION");

            args.push("-var", "var.ProjectFilesDir");

            args.push("-template", "fragment");

            args.push("-t", input.filePath);

            args.push("-out", FileInfo.fileName(output.filePath));


            var cmd = new Command("heat.exe", args)

            cmd.description = "generating " +
FileInfo.fileName(output.filePath);

            cmd.highlight = "generator";

            cmd.workingDirectory = FileInfo.path(output.filePath);

            return cmd;

        }

    }

}

== ConcreteWinInstaller.qbs ==

ConcreteWinInstaller {    condition: qbs.targetOS.contains("windows")
&& qbs.hostOS.contains("windows")
    name: "APP-WiX-Installer"    targetName:
MyFunctions.qtLibraryName(qbs, "Setup_v" + project.productVersion +
"_" + qbs.architecture + project.releaseStatus)
    Depends { name: "APP-Windows-Runtime-Deployer" }    Depends {
name: "APP-Application" }
    Group {        name: "Sources"        files: [ "*.wxs" ]    }
    Group {        name: "Localizations"        files: [ "*.wxl" ]    }
    Group {        name: "XSL Transformer"        files: [ "*.xsl" ]    }
    Group {        id: productIcon        name: "Product Icon"
files: [ "mtr_icon.ico" ]    }
    Group {        id: uiBanner        name: "UI Banner"        files:
[ "banner.bmp" ]    }
    Group {        id: uiDialog        name: "UI Dialog"        files:
[ "dialog.bmp" ]    }
    wix.defines: {        var defines = product.baseDefines;
defines.push("ProductIcon=" + path + "/" + productIcon.files);
defines.push("UiBanner=" + path + "/" + uiBanner.files);
defines.push("UiDialog=" + path + "/" + uiDialog.files);        return
defines;    }
}



Where:

* the APP-Windows-Runtime-Deployer -  is a product which does copying of
the desired
        runtime libraries (as Qt runtime and as MSVC runtime) to the
my-deploy directory

* the APP-Application -  is an usual CppApplication product which
internally has depends
        from the others plugins, libraries products:

    Depends { name: "Plugin1" }

    ...

    Depends { name: "PluginN" }

    ...
    Depends { name: "Library1" }    ...    Depends { name: "LibraryN" }


A project tree like this:

- APP-Application
- Plugins:
    - Plugin1
    - PluginN
- Libraries:
    - Library1
    - LibraryN
- Runtime-Deployer
- Concrete-Win-Installer


So, can anyone help me? How to make that WIX a product was launched at the
end of build of whole project (when all dependences are ready)?

BR,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150227/b128b5b0/attachment.html>


More information about the Qbs mailing list