MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / generateModulesRules

Method generateModulesRules

tools/mcmanifest.js:664–939  ·  view source on GitHub ↗
(tool)

Source from the content-addressed store, hash-verified

662 this.line("");
663 }
664 generateModulesRules(tool) {
665 const generatedTS = [];
666
667 for (let result of tool.nodered2mcuFiles) {
668 let source = result.source;
669 let target = result.target;
670 const extension = ".js";
671 if (tool.platform == "zephyr") {
672 var output = "${MODULES_DIR}/" + target + extension;
673
674 this.line(`cmake_path(CONVERT ${source} TO_NATIVE_PATH_LIST the_source NORMALIZE)`);
675 this.line(`cmake_path(CONVERT ${output} TO_NATIVE_PATH_LIST the_output NORMALIZE)`);
676 this.line("add_custom_command(");
677 this.line("\tOUTPUT " + output);
678 this.line("\tCOMMAND nodered2mcu ${the_source} -o ${the_output}");
679 this.line("\tDEPENDS " + source);
680 this.line("\tVERBATIM)");
681
682 tool.jsFiles.push({
683 source: tool.modulesPath + "/" + target + extension,
684 target: target + ".xsb"
685 });
686 }
687 else {
688 const output = "$(MODULES_DIR)" + tool.slash + target + extension;
689 this.line(output, ": ", source);
690 this.echo(tool, "nodered2mcu ", target);
691 this.line("\tnodered2mcu ", source, " -o $(@D)");
692
693 tool.jsFiles.push({
694 source: tool.modulesPath + tool.slash + target + extension,
695 target: target + ".xsb"
696 });
697 }
698 }
699
700 for (let result of tool.cdvFiles) {
701 let source = result.source;
702 let target = result.target;
703 const extension = ("typescript" === result.query?.language) ? ".ts" : ".js";
704 let pragmas = "";
705 for (const name in result.query)
706 pragmas += " " + "-p " + name + "=" + result.query[name];
707
708 if (tool.platform == "zephyr") {
709 const output = tool.modulesPath + "/" + target + extension;
710 this.line(`cmake_path(CONVERT ${source} TO_NATIVE_PATH_LIST the_source)`);
711 this.line(`cmake_path(CONVERT ${tool.modulesPath} TO_NATIVE_PATH_LIST the_output)`);
712 this.line("add_custom_command(");
713 this.line("\tOUTPUT " + output);
714 this.line("\tCOMMAND cdv ${the_source} -o ${the_output} -n " + target + pragmas);
715 this.line("\tDEPENDS " + source);
716 this.line("\tVERBATIM)");
717
718 if (".js" === extension) {
719 tool.jsFiles.push({
720 source: tool.modulesPath + "/" + target + extension,
721 target: target + ".xsb"

Callers 1

generateRulesMethod · 0.95

Calls 7

echoMethod · 0.95
mapMethod · 0.80
sliceMethod · 0.65
writeMethod · 0.65
lineMethod · 0.45
pushMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected