<div dir="ltr">Hi, there. I need help with modules creating.<div><br></div><div>1) I'm trying to make the rule independent of configure, I mean "debug" or "release". For example I have archives containing *.h and *.cpp files. I wrote:</div><div><br></div><div><div>Module</div><div>{</div><div>    property string outputPath: product.sourceDirectory + "/generated"</div><div>    FileTagger {</div><div>        patterns: "*.7z"</div><div>        fileTags: ["unpack7z"]</div><div>    }</div><div><br></div><div>    Rule {</div><div>        id: extractor7z</div><div>        inputs: ["unpack7z"]</div><div><br></div><div>        Artifact {</div><div>            filePath: product.moduleProperty("extractor7z","outputPath")  +</div><div>                      "/" + input.baseDir</div><div>            fileTags: "unpacked"</div><div>        }</div><div><br></div><div>        condition: {</div><div>            return true;</div><div>        }</div><div><br></div><div>        prepare: {</div><div>            var cmdFunc = function() {</div><div>                if ( !File.exists(output.filePath) || </div><div>                    File.lastModified(output.filePath) < File.lastModified(input.filePath))</div><div>                {</div><div>                    var args = [];</div><div>                    args.push("x");</div><div>                    args.push("-y");</div><div>                    args.push("-o" + output.filePath);</div><div>                    args.push(input.filePath);</div><div>                    var cmd = new Command("7z", args);</div><div><br></div><div>                    return cmd;</div><div>                }</div><div>                else</div><div>                {</div><div>                    var cmd = new JavaScriptCommand();</div><div>                    cmd.sourceCode = function() {</div><div>                        print("Do nothing...");</div><div>                    }</div><div>                    return cmd;</div><div>                }</div><div>            }</div><div><br></div><div>            var cmd = cmdFunc();</div><div>            cmd.description = "extracting " + input.fileName;</div><div>            cmd.highlight = "extractor 7z";</div><div><br></div><div>            return cmd;</div><div>        }</div><div><br></div><div>    }</div><div>}</div><div><br></div><div>It works but I'm not sure that it's good idea. Does right way to do it exist?</div><div><br></div><div>And if I update archive I get warning "WARNING: Cannot remove '/home/hokum/progs/qbs-test/hello_world_project/test_unpack/generated/archives'." What does it mean?<br></div><div><br></div><div>May be archive is not good example, but in reality I want to get external dependencies from another source control systems and network shares. Product will have special files with path to external dependencies.</div><div><br></div><div>2) What does "id" property of Rule Item mean?</div><div><br></div><div>3) I can't understand how module "cpp" works. Only CppModule.qbs contains Module Item, other qbs files contain UnixGCC Item, CppModule Item. I guess Module Item from CppModule.qbs describes general properties of module "cpp" and the condition property of Item defines which Item will work. But I had tried to do it and I got error "Module mymodule could not be loaded".</div><div>Could you explain how it works?</div><div><br></div><div>Thank a lot for your support.<br></div>-- </div><div><br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><i><span href="https://www.quora.com/Why-is-Best-Regards-or-Kind-Regards-considered-to-be-bad-English#">Yours faithfully</span>,<br></i></div><div><i>Alexey Shashev</i><br></div></div></div></div></div>
</div></div>