@react-native-community/cli-platform-android
Advanced tools
Comparing version 11.3.9 to 11.3.10
@@ -68,3 +68,3 @@ "use strict"; | ||
} | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, tasks, 'bundle', androidProject.sourceDir); | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, tasks, 'bundle'); | ||
if (args.extraParams) { | ||
@@ -71,0 +71,0 @@ gradleArgs.push(...args.extraParams); |
import type { BuildFlags } from '../buildAndroid'; | ||
export declare function getTaskNames(appName: string, mode: string | undefined, tasks: BuildFlags['tasks'], taskPrefix: 'assemble' | 'install' | 'bundle', sourceDir: string): Array<string>; | ||
export declare function getTaskNames(appName: string, mode: string | undefined, tasks: BuildFlags['tasks'], taskPrefix: 'assemble' | 'install' | 'bundle'): Array<string>; | ||
//# sourceMappingURL=getTaskNames.d.ts.map |
@@ -8,25 +8,4 @@ "use strict"; | ||
var _toPascalCase = require("./toPascalCase"); | ||
var _listAndroidTasks = require("./listAndroidTasks"); | ||
function _cliTools() { | ||
const data = require("@react-native-community/cli-tools"); | ||
_cliTools = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function getTaskNames(appName, mode = 'debug', tasks, taskPrefix, sourceDir) { | ||
let appTasks = tasks && tasks.length ? tasks : [taskPrefix + (0, _toPascalCase.toPascalCase)(mode)]; | ||
// Check against build flavors for "install" task ("assemble" don't care about it so much and will build all) | ||
if (!(tasks === null || tasks === void 0 ? void 0 : tasks.length) && taskPrefix === 'install') { | ||
const actionableInstallTasks = (0, _listAndroidTasks.getGradleTasks)('install', sourceDir); | ||
if (!actionableInstallTasks.find(t => t.task.includes(appTasks[0]))) { | ||
const installTasksForMode = actionableInstallTasks.filter(t => t.task.toLowerCase().includes(mode)); | ||
if (!installTasksForMode.length) { | ||
throw new (_cliTools().CLIError)(`Couldn't find "${appTasks.map(taskName => taskName.replace(taskPrefix, '')).join(', ')}" build variant. Available variants are: ${actionableInstallTasks.map(t => `"${t.task.replace(taskPrefix, '')}"`).join(', ')}.`); | ||
} | ||
_cliTools().logger.warn(`Found multiple tasks for "install" command: ${installTasksForMode.map(t => t.task).join(', ')}.\nSelecting first available: ${installTasksForMode[0].task}.`); | ||
appTasks = [installTasksForMode[0].task]; | ||
} | ||
} | ||
function getTaskNames(appName, mode = 'debug', tasks, taskPrefix) { | ||
const appTasks = tasks && tasks.length ? tasks : [taskPrefix + (0, _toPascalCase.toPascalCase)(mode)]; | ||
return appName ? appTasks.map(command => `${appName}:${command}`) : appTasks; | ||
@@ -33,0 +12,0 @@ } |
@@ -184,3 +184,3 @@ "use strict"; | ||
if (devices.indexOf(deviceId) !== -1) { | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, args.tasks ?? buildTask, 'install', androidProject.sourceDir); | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, args.tasks ?? buildTask, 'install'); | ||
@@ -187,0 +187,0 @@ // using '-x lint' in order to ignore linting errors while building the apk |
@@ -52,7 +52,15 @@ "use strict"; | ||
const getGradleTasks = (taskType, sourceDir) => { | ||
const loader = (0, _cliTools().getLoader)(); | ||
loader.start('Searching for available Gradle tasks...'); | ||
const cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew'; | ||
const out = _execa().default.sync(cmd, ['tasks', '--group', taskType], { | ||
cwd: sourceDir | ||
}).stdout; | ||
return parseTasksFromGradleFile(taskType, out); | ||
try { | ||
const out = _execa().default.sync(cmd, ['tasks', '--group', taskType], { | ||
cwd: sourceDir | ||
}).stdout; | ||
loader.succeed(); | ||
return parseTasksFromGradleFile(taskType, out); | ||
} catch { | ||
loader.fail(); | ||
return []; | ||
} | ||
}; | ||
@@ -59,0 +67,0 @@ exports.getGradleTasks = getGradleTasks; |
@@ -61,3 +61,3 @@ "use strict"; | ||
if (!args.binaryPath) { | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, args.tasks, 'install', androidProject.sourceDir); | ||
let gradleArgs = (0, _getTaskNames.getTaskNames)(androidProject.appName, args.mode || args.variant, args.tasks, 'install'); | ||
if (args.extraParams) { | ||
@@ -64,0 +64,0 @@ gradleArgs.push(...args.extraParams); |
{ | ||
"name": "@react-native-community/cli-platform-android", | ||
"version": "11.3.9", | ||
"version": "11.3.10", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@react-native-community/cli-tools": "11.3.9", | ||
"@react-native-community/cli-tools": "11.3.10", | ||
"chalk": "^4.1.2", | ||
@@ -24,4 +24,4 @@ "execa": "^5.0.0", | ||
"devDependencies": { | ||
"@react-native-community/cli-plugin-metro": "11.3.9", | ||
"@react-native-community/cli-types": "11.3.9", | ||
"@react-native-community/cli-plugin-metro": "11.3.10", | ||
"@react-native-community/cli-types": "11.3.10", | ||
"@types/fs-extra": "^8.1.0", | ||
@@ -36,3 +36,3 @@ "@types/glob": "^7.1.1" | ||
}, | ||
"gitHead": "9d486c833d5af7f2e6fbf7bec046e54283ba140f" | ||
"gitHead": "59e4dac7e56fb05f33508ff804c0eac7448c16a8" | ||
} |
@@ -98,2 +98,10 @@ # @react-native-community/cli-platform-android | ||
#### `--interactive` | ||
Manually select a task and device/simulator you want to run your app on. | ||
> [!WARNING] | ||
> This flag is running `./gradlew tasks` under the hood, which might take some time for more complex apps. If that affects your project, consider using `--mode` and `--deviceId` flags instead. | ||
### `build-android` | ||
@@ -100,0 +108,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149
230034
2407
+ Added@react-native-community/cli-tools@11.3.10(transitive)
- Removed@react-native-community/cli-tools@11.3.9(transitive)