MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getOutputFilePath

Function getOutputFilePath

npm_modules/cli/src/utils/applicationUtils.ts:193–224  ·  view source on GitHub ↗
(
  bazel: BazelClient,
  expectedExtension: string,
  target: string,
  bazelArgs: string = '',
)

Source from the content-addressed store, hash-verified

191
192// Reads and selects the output path for the build & install
193export async function getOutputFilePath(
194 bazel: BazelClient,
195 expectedExtension: string,
196 target: string,
197 bazelArgs: string = '',
198): Promise<string> {
199 const workspaceRootResult = await bazel.getWorkspaceRoot();
200 const buildOutputsResult = await bazel.queryBuildOutputs([target], bazelArgs);
201
202 // TODO(yhuang6): Have a way to prompt for selection and memorize it and/or
203 // add an option to specify name of apk.
204 let appChoices = buildOutputsResult;
205 if (expectedExtension.length > 0) {
206 appChoices = buildOutputsResult.filter(
207 output => output.endsWith(expectedExtension) && !output.includes('_unsigned'),
208 );
209 }
210
211 let outputPath;
212 if (appChoices.length === 0) {
213 throw new CliError('No outputs are found...');
214 } else if (appChoices.length === 1) {
215 outputPath = appChoices[0];
216 } else {
217 outputPath = await getUserChoice(
218 appChoices.map((output, index) => ({ name: `${index + 1}. ${output}`, value: output })),
219 'Please select the app to install:',
220 );
221 }
222
223 return outputPath === undefined ? '' : path.join(workspaceRootResult, outputPath);
224}
225
226function androidBuildFlagsForArchitecture(architecture: Architecture): readonly string[] {
227 switch (architecture) {

Callers 4

valdiInstallFunction · 0.90
valdiExportFunction · 0.90
valdiPackageFunction · 0.90
valdiBuildFunction · 0.90

Calls 6

getUserChoiceFunction · 0.90
getWorkspaceRootMethod · 0.80
queryBuildOutputsMethod · 0.80
filterMethod · 0.80
mapMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected