MCPcopy Index your code
hub / github.com/angular/angular-cli / _executeTarget

Function _executeTarget

packages/angular_devkit/architect/bin/architect.ts:62–110  ·  view source on GitHub ↗
(
  parentLogger: logging.Logger,
  workspace: workspaces.WorkspaceDefinition,
  root: string,
  targetStr: string,
  options: json.JsonObject,
  registry: schema.SchemaRegistry,
)

Source from the content-addressed store, hash-verified

60}
61
62async function _executeTarget(
63 parentLogger: logging.Logger,
64 workspace: workspaces.WorkspaceDefinition,
65 root: string,
66 targetStr: string,
67 options: json.JsonObject,
68 registry: schema.SchemaRegistry,
69) {
70 const architectHost = new WorkspaceNodeModulesArchitectHost(workspace, root);
71 const architect = new Architect(architectHost, registry);
72
73 // Split a target into its parts.
74 const [project, target, configuration] = targetStr.split(':');
75 const targetSpec = { project, target, configuration };
76
77 const logger = new logging.Logger('jobs');
78 const logs: logging.LogEntry[] = [];
79 logger.subscribe((entry) => logs.push({ ...entry, message: `${entry.name}: ` + entry.message }));
80
81 const run = await architect.scheduleTarget(targetSpec, options, { logger });
82
83 // Wait for full completion of the builder.
84 try {
85 const result = await run.lastOutput;
86 if (result.success) {
87 parentLogger.info(styleText(['green'], 'SUCCESS'));
88 } else {
89 parentLogger.info(styleText(['red'], 'FAILURE'));
90 }
91 parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));
92
93 parentLogger.info('\nLogs:');
94 logs.forEach((l) => parentLogger.next(l));
95 logs.splice(0);
96
97 await run.stop();
98
99 return result.success ? 0 : 1;
100 } catch (err) {
101 parentLogger.info(styleText(['red'], 'ERROR'));
102 parentLogger.info('\nLogs:');
103 logs.forEach((l) => parentLogger.next(l));
104
105 parentLogger.fatal('Exception:');
106 parentLogger.fatal((err instanceof Error && err.stack) || `${err}`);
107
108 return 2;
109 }
110}
111
112const CLI_OPTION_DEFINITIONS = {
113 'help': { type: 'boolean' },

Callers 1

mainFunction · 0.85

Calls 8

subscribeMethod · 0.95
scheduleTargetMethod · 0.95
nextMethod · 0.80
infoMethod · 0.65
stopMethod · 0.65
fatalMethod · 0.65
pushMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected