[QBS] Rule generating lots of files

Stephan Gatzka stephan.gatzka at gmail.com
Wed Aug 26 17:24:39 CEST 2015


Hi!

For a specific project I wrote a Rule which generates a lot of C code (a 
complete board support package):

Module {
   Rule {
     multiplex: true
     inputs:  ["bsp_settings", "bsp_sopcinfo"]

     outputFileTags: ["cpp"]
     outputArtifacts: [
       {filePath: "*.c", fileTags: ["cpp"]}
     ]
     prepare: {
       File.copy(inputs.bsp_settings[0].filePath,
         FileInfo.joinPaths(product.buildDirectory,
         FileInfo.fileName(inputs.bsp_settings[0].filePath)));


       var cmd = new Command("nios2-bsp");
       cmd.arguments = [
         "hal",
         product.buildDirectory,
         inputs.bsp_sopcinfo[0].filePath,
         "--cpu-name",
         "main_cpu"
       ];
       cmd.description = "Generating BSP...";
       cmd.highlight = "codegen";

       return cmd;
     }
   }
}

My problem is, that I can't specify wildcards in the outputArtifacts 
property, so currently I only see to specify every single file by hand 
in outputArtifacts, which is rather tedious and in addition might change 
because depending from the inputs.

Is there a clever way to achieve this? A workaround might be to generate 
a list of C files in the prepare script and hand over that list to 
outputArtifacts?

Ideas are very welcome.

Regards,

Stephan



More information about the Qbs mailing list