Skip to content

Commit

Permalink
fix(android): restrict android run command to configured flavour (#5256)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandor-biro committed Nov 22, 2021
1 parent e67ca99 commit ba84443
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/src/android/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export async function runAndroid(
selectedTarget,
);

const gradleArgs = ['assembleDebug'];
const arg = `assemble${config.android?.flavor || ''}Debug`;
const gradleArgs = [arg];

debug('Invoking ./gradlew with args: %O', gradleArgs);

Expand Down
2 changes: 2 additions & 0 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ async function loadAndroidConfig(
const resDir = `${srcMainDir}/res`;
let apkPath = `${appDir}/build/outputs/apk/`;
let flavorPrefix = '';
const flavor = extConfig.android?.flavor || '';
if (extConfig.android?.flavor) {
apkPath = `${apkPath}/${extConfig.android?.flavor}`;
flavorPrefix = `-${extConfig.android?.flavor}`;
Expand Down Expand Up @@ -259,6 +260,7 @@ async function loadAndroidConfig(
apkName,
buildOutputDir,
buildOutputDirAbs: resolve(platformDirAbs, buildOutputDir),
flavor,
};
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface AndroidConfig extends PlatformConfig {
readonly buildOutputDir: string;
readonly buildOutputDirAbs: string;
readonly apkName: string;
readonly flavor: string;
}

export interface IOSConfig extends PlatformConfig {
Expand Down

0 comments on commit ba84443

Please sign in to comment.