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

Method generateResourcesRules

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

Source from the content-addressed store, hash-verified

1160 generateDependencyRules(tool) {
1161 }
1162 generateResourcesRules(tool) {
1163 var formatPath;
1164 var rotationPath;
1165
1166 if (tool.platform == "zephyr") {
1167 formatPath = "${TMP_DIR}/mc.format.h"; // cmake needs {var} not (var)
1168 rotationPath = "${TMP_DIR}/mc.rotation.h";
1169 }
1170 else {
1171 formatPath = "$(TMP_DIR)" + tool.slash + "mc.format.h";
1172 rotationPath = "$(TMP_DIR)" + tool.slash + "mc.rotation.h";
1173 }
1174
1175 for (var result of tool.resourcesFiles) {
1176 var source = result.source;
1177 var target = result.target;
1178 if (tool.platform == "zephyr") {
1179 var output = "${RESOURCES_DIR}/" + target;
1180 //@@
1181 this.line("add_custom_command(");
1182 this.line("\tCOMMENT copy-resource-file");
1183 this.line("\tOUTPUT " + output);
1184 this.line("\tCOMMAND ${CMAKE_COMMAND} -E copy " + source + " " + output )
1185 this.line("\tDEPENDS " + source);
1186 this.line("\tVERBATIM)");
1187 this.line("");
1188 }
1189 else {
1190 this.line("$(RESOURCES_DIR)", tool.slash, target, ": ", source);
1191 this.echo(tool, "copy ", target);
1192 if (tool.isDirectoryOrFile(source) < 0) {
1193 if (tool.windows)
1194 this.line("\tcopy /E /Y $** $@");
1195 else
1196 this.line("\tcp -R $< $@");
1197 }
1198 else {
1199 if (tool.windows)
1200 this.line("\tcopy /Y $** $@");
1201 else
1202 this.line("\tcp $< $@");
1203 }
1204 }
1205 }
1206
1207 if (tool.clutFiles) {
1208 if (!tool.format?.startsWith("clut")) {
1209 tool.clutFiles.length = 0;
1210 for (var result of tool.bmpColorFiles)
1211 delete result.clutName;
1212 }
1213
1214 for (var result of tool.clutFiles) {
1215 var source = result.source;
1216 var target = result.target;
1217 if (tool.platform == "zephyr") {
1218 this.line(`cmake_path(CONVERT "${source}" TO_NATIVE_PATH_LIST the_source)`);
1219 this.line("add_custom_command (");

Callers 1

generateRulesMethod · 0.95

Calls 10

echoMethod · 0.95
escapePathSpacesMethod · 0.95
resolveFilePathMethod · 0.80
findMethod · 0.80
fromStringMethod · 0.80
mapMethod · 0.80
sliceMethod · 0.65
writeMethod · 0.65
lineMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected