0

I want to create automatic crossplatform installation builder for my project. For this reason I made this file myprojectpackage.qbs:

Product {
   type: "mypackage"

   Depends { name: "myproject" } // <- this one has type "application"
   Depends { name: "applicationpackage" }
}

applicationpackage.qbs uses some submodules and looks like:

Module {
   name: "applicationpackage"
   Depends { name: "qtlibsbinariespackage" }
   Depends { name: "3rdpartybinariespackage" }
   Depends { name: "resourcepackage" }
}

All these modules try to find something and copy to package directory. After they finish, I have a folder with a portable version of application. Every module of this group have typical structure:

Module {
    name: "somepackage"

    Rule {
        condition: qbs.targetOS.contains("windows")
        multiplex: true
        alwaysRun: true
        inputsFromDependencies: ["application"]

        Artifact {
            filePath: "Copied_files.txt"
            fileTags: "mypackage"
        }

        prepare: {
            var cmdQt = new JavaScriptCommand()
            // prepare paths
            cmdQt.sourceCode = function() {
                // copy some files and write to Copied_files.txt
            }
            return [cmdQt]
        }
    }
}

After portable folder package complete, I want to make a zip archieve. So, I need another Module, which will run after package modules. I think, that only way to do like this is taking .txt files, that were created by modules in applicationpackage, as inputs for another Rule.

I have tried a lot of things (FileTaggers, outputFileTags etc.), but noone worked properly. So is there any way to do make modules work in pipeline as I want to do?

1 Answers1

0

Do I understand correctly that you want to "merge" the contents of the txt files tagged "mypackage" into the archive, i.e. everything listed in all the files is supposed to end up there? If so, then you simply need a "top-level" rule that does the aggregation. Your existing rules would tag their outputs as e.g. "mypackage.part" and then a multiplex rule would take these as inputs and create a "mypackage" artifact. Note that there is the archiver module (https://doc.qt.io/qbs/archiver-module.html) that can do the final step of creating the package for you from the aggregated txt file.

  • So, these files actually are not tagged anyhow. For example: Module qtlibsbinariespackage copies file A (which can be just built application executable) to the portable directory, Module 3rdpartybinariespackage copies file B and directory C and so on. The order of execution here is not important. So I want to write another Module in application package, which will work after all files are already copied. It should create the archieve and installations for some systems. I don't understand how can new included module in applicationpackage get access of artifacts of other included modules. – Max Bespalov Jan 16 '18 at 10:48
  • Everything works via file tags. If an input tag of one rule matches an output tag of another, then that forces an ordering (and makes the respective output artifacts available in the other rule). – Christian Kandeler Jan 16 '18 at 14:53
  • I'm not sure I understand the problem. Whenever an input tag of one rule matches an output tag of another, that enforces an ordering (and makes the output artifacts accessible in the other rule). If you want to see concrete code, you will need to show us the actual project (or preferably a minimal (but complete) stripped down version of it). – Christian Kandeler Jan 16 '18 at 14:58
  • Ok, problem was in my missunderstanding of build graph creation. So, my module somepackage should produce artifacts with tag "mypackage.part" and new module should take them as inputs. This works for me. Thanks! – Max Bespalov Jan 17 '18 at 10:53