Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): restrict android run command to configured flavour #5256

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandor-biro You still need the word Debug, the correct argument is actually assembleFlavorDebug where Flavor is the value from the config

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug word is at the end of the template string, so if there is a flavor it will be assembleFlavorNameDebug and if not assembleDebug

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