[Qbs] Installing the same artifact to different locations

Orgad Shaneh orgads at gmail.com
Thu Oct 16 13:36:10 CEST 2025


Hi,

I have a product with a custom Rule. I want to install the file in 2
different directories. How should it be done? I tried the following, but it
only installs once (in pluginInstallPrefix).

Product {
    name: "InstallScript"
    type: ["install-script"]
    property string wsVersion: project.wsVersion
    property string pluginInstallPrefix: project.pluginInstallPrefix
    property string otherInstallPath: project.otherInstallPath

    Group {
        name: "Template"
        files: ["install.bat.in"]
        fileTags: ["install-template"]
    }

    Rule {
        multiplex: false
        inputs: ["install-template"]
        Artifact {
            filePath: "install.bat"
            fileTags: ["install-script", "install-script-other"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "Generating " + output.fileName;
            cmd.highlight = "codegen";
            cmd.sourceCode = function() {
                var file = new TextFile(input.filePath);
                var content = file.readAll();
                file.close()
                content = content.replace("$$VER$$", product.wsVersion);
                file = new TextFile(output.filePath, TextFile.WriteOnly);
                file.write(content);
                file.close();
            }
            return [cmd];
        }
    }

    Group {
        name: "Install"
        fileTagsFilter: ["install-script"]
        qbs.install: true
        qbs.installDir: product.pluginInstallPrefix
    }
    Group {
        name: "Install Other"
        fileTagsFilter: ["install-script-other"]
        qbs.install: true
        qbs.installDir: product.otherInstallPath
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20251016/129503bd/attachment.htm>


More information about the Qbs mailing list