MCPcopy Create free account
hub / github.com/angular/angular / resolveSidecarBinary

Function resolveSidecarBinary

packages/compiler-cli/preprocessor/test/utils.ts:86–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86export function resolveSidecarBinary(): string {
87 const ext = process.platform === 'win32' ? '.exe' : '';
88 const runfilesDir = process.env['JS_BINARY__RUNFILES'] || process.env['RUNFILES_DIR'];
89 if (runfilesDir) {
90 const candidates = [
91 path.join(
92 runfilesDir,
93 `_main/packages/compiler-cli/preprocessor/ng-analyze/ng_analyze_bin${ext}`,
94 ),
95 path.join(
96 runfilesDir,
97 `angular/packages/compiler-cli/preprocessor/ng-analyze/ng_analyze_bin${ext}`,
98 ),
99 path.join(runfilesDir, `packages/compiler-cli/preprocessor/ng-analyze/ng_analyze_bin${ext}`),
100 ];
101 for (const c of candidates) {
102 if (fsSync.existsSync(c)) {
103 return c;
104 }
105 }
106 }
107 const relativeCandidates = [
108 path.resolve(
109 process.cwd(),
110 `../../packages/compiler-cli/preprocessor/ng-analyze/ng_analyze_bin${ext}`,
111 ),
112 path.resolve(
113 process.cwd(),
114 `dist/bin/packages/compiler-cli/preprocessor/ng-analyze/ng_analyze_bin${ext}`,
115 ),
116 ];
117 for (const c of relativeCandidates) {
118 if (fsSync.existsSync(c)) {
119 return c;
120 }
121 }
122 throw new Error(
123 `Could not find ng_analyze_bin in runfiles. Checked runfilesDir=${runfilesDir}, cwd=${process.cwd()}`,
124 );
125}
126
127function resolvePackagePath(pkg: string): string | null {
128 const runfilesDir = process.env['JS_BINARY__RUNFILES'] || process.env['RUNFILES_DIR'];

Callers 3

runPipelineFunction · 0.85
ngp_spec.tsFile · 0.85

Calls 2

joinMethod · 0.65
resolveMethod · 0.65

Tested by

no test coverage detected