1import { resolveDeviceAsync } from './resolveDevice'; 2import { GradleProps, resolveGradleProps } from './resolveGradleProps'; 3import { LaunchProps, resolveLaunchPropsAsync } from './resolveLaunchProps'; 4import { AndroidDeviceManager } from '../../start/platforms/android/AndroidDeviceManager'; 5import { BundlerProps, resolveBundlerPropsAsync } from '../resolveBundlerProps'; 6 7export type Options = { 8 variant?: string; 9 device?: boolean | string; 10 port?: number; 11 bundler?: boolean; 12 install?: boolean; 13 buildCache?: boolean; 14}; 15 16export type ResolvedOptions = GradleProps & 17 BundlerProps & 18 LaunchProps & { 19 variant: string; 20 buildCache: boolean; 21 device: AndroidDeviceManager; 22 install: boolean; 23 }; 24 25export async function resolveOptionsAsync( 26 projectRoot: string, 27 options: Options 28): Promise<ResolvedOptions> { 29 return { 30 ...(await resolveBundlerPropsAsync(projectRoot, options)), 31 ...resolveGradleProps(projectRoot, options), 32 ...(await resolveLaunchPropsAsync(projectRoot)), 33 variant: options.variant ?? 'debug', 34 // Resolve the device based on the provided device id or prompt 35 // from a list of devices (connected or simulated) that are filtered by the scheme. 36 device: await resolveDeviceAsync(options.device), 37 buildCache: !!options.buildCache, 38 install: !!options.install, 39 }; 40} 41