amis-rpc-design/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js.map

1 line
16 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["runAndroid","_argv","config","args","link","setPlatform","reactNativeVersion","setVersion","binaryPath","tasks","CLIError","path","isAbsolute","join","root","fs","existsSync","androidProject","getAndroidProject","runPackager","buildAndRun","defaultPort","getAvailableDevicePort","port","adbPath","getAdbPath","devices","adb","getDevices","some","d","includes","toString","process","chdir","sourceDir","cmd","platform","startsWith","selectedTask","interactive","task","promptForTaskSelection","listDevices","deviceId","logger","warn","device","listAndroidDevices","users","checkUsers","length","user","promptForUser","id","connected","runOnSpecificDevice","emulator","info","result","tryLaunchEmulator","readableName","success","chalk","dim","error","runOnAllDevices","buildTask","replace","indexOf","gradleArgs","getTaskNames","appName","mode","variant","push","extraParams","activeArchOnly","architecture","getCPU","build","installAndLaunchOnDevice","selectedDevice","tryRunAdbReverse","tryInstallAppOnDevice","tryLaunchAppOnDevice","packageName","name","description","func","options","default","parse","Number"],"sources":["../../../src/commands/runAndroid/index.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport fs from 'fs';\nimport {Config} from '@react-native-community/cli-types';\nimport adb from './adb';\nimport runOnAllDevices from './runOnAllDevices';\nimport tryRunAdbReverse from './tryRunAdbReverse';\nimport tryLaunchAppOnDevice from './tryLaunchAppOnDevice';\nimport tryInstallAppOnDevice from './tryInstallAppOnDevice';\nimport getAdbPath from './getAdbPath';\nimport {logger, CLIError, link} from '@react-native-community/cli-tools';\nimport {getAndroidProject} from '../../config/getAndroidProject';\nimport listAndroidDevices from './listAndroidDevices';\nimport tryLaunchEmulator from './tryLaunchEmulator';\nimport chalk from 'chalk';\nimport path from 'path';\nimport {build, runPackager, BuildFlags, options} from '../buildAndroid';\nimport {promptForTaskSelection} from './listAndroidTasks';\nimport {getTaskNames} from './getTaskNames';\nimport {checkUsers, promptForUser} from './listAndroidUsers';\n\nexport interface Flags extends BuildFlags {\n appId: string;\n appIdSuffix: string;\n mainActivity: string;\n deviceId?: string;\n listDevices?: boolean;\n binaryPath?: string;\n user?: number | string;\n}\n\nexport type AndroidProject = NonNullable<Config['project']['android']>;\n\n/**\n * Starts the app on a connected Android emulator or device.\n */\nasync function runAndroid(_argv: Array<string>, config: Config, args: Flags) {\n link.setPlatform('android');\n\n if (config.reactNativeVersion !== 'unknown') {\n link.setVersion(config.reactNativeVersion);\n }\n\n if (args.binaryPath) {\n if (args.tasks) {\n throw new CLIError(\n 'binary-path and tasks were specified, but they are not compatible. Specify only one',\n );\n }\n\n args.binaryPath = path.isAbsolute(args.binaryPath)\n ? args.binaryPath\n : path.join(config.root, args.binaryPath);\n\n if (args.binaryPath && !fs.existsSync(args.binaryPath)) {\n throw new CLIError(\n 'binary-path was specified, but the file was not found.',\n );\n }\n }\n\n const androidProject = getAndroidProject(config);\n\n await runPackager(args, config);\n return buildAndRun(args, androidProject);\n}\n\nconst defaultPort = 5552;\nasync function getAvailableDevicePort(\n port: number = defaultPort,\n): Promise<number> {\n /**\n * The default value is 5554 for the first virtual device instance running on your machine. A virtual device normally occupies a pair of adjacent ports: a console port and an adb port. The console of the first virtual device running on a particular machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two. For example, 5556/5557, 5558/5559, and so on. Th