in core/index.js [161:213]
function registerTaskByProcessors(taskName, taskDef) {
if (configs.buildInfos.targets.length <= 0
|| taskDef["ignore-target"] === true) {
gulp.task(taskName, generateTaskByProcessors(taskDef, undefined));
return;
}
/** @type {Array.<string>} */
const subTasks = [];
/** @type {RegExp} */
const targetRegex = /^([A-Za-z0-9\-\_]+)(\@([A-Za-z0-9\-\_]+))?$/i;
for (const target of configs.buildInfos.targets) {
const targetMatchResult = targetRegex.exec(target);
if (!targetMatchResult) {
throw new Error(`Build target is not valid: ${target}`);
}
/** @type {IBuildTaget} */
const buildTarget = {
// @ts-ignore
platform: targetMatchResult[1],
// @ts-ignore
arch: targetMatchResult[3]
};
if (buildTarget.platform !== process.platform) {
continue;
}
if (taskDef.targets
&& !taskDef.targets.find((targetItem) => targetItem === buildTarget.platform || targetItem === target)) {
continue;
}
const subTaskName = `${taskName}:${buildTarget.platform}${buildTarget.arch ? "@" + buildTarget.arch : ""}`;
subTasks.push(subTaskName);
gulp.task(subTaskName, generateTaskByProcessors(taskDef, buildTarget));
}
gulp.task(taskName,
subTasks.length > 0
? gulp.series(subTasks)
: () => {
console.log("TASK", "Target", `Skipping: Task "${taskName}" has no matched targets.`);
return Promise.resolve();
});
}