( bazel: BazelClient, expectedExtension: string, target: string, bazelArgs: string = '', )
| 191 | |
| 192 | // Reads and selects the output path for the build & install |
| 193 | export 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 | |
| 226 | function androidBuildFlagsForArchitecture(architecture: Architecture): readonly string[] { |
| 227 | switch (architecture) { |
no test coverage detected