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

feat(cli): Add support for Android build --flavor #6437

Merged
merged 4 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions cli/src/android/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export async function buildAndroid(
): Promise<void> {
const releaseType = buildOptions.androidreleasetype ?? 'AAB';
const releaseTypeIsAAB = releaseType === 'AAB';
const arg = releaseTypeIsAAB ? ':app:bundleRelease' : 'assembleRelease';
const flavor = buildOptions.flavor ?? '';
const arg = releaseTypeIsAAB
? `:app:bundle${flavor}Release`
: `assemble${flavor}Release`;
const gradleArgs = [arg];

if (
Expand Down Expand Up @@ -46,7 +49,7 @@ export async function buildAndroid(
'build',
'outputs',
releaseTypeIsAAB ? 'bundle' : 'apk',
'release',
buildOptions.flavor ? `${flavor}Release` : 'release',
);

const unsignedReleaseName = `app${
Expand Down
1 change: 1 addition & 0 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export function runProgram(config: Config): void {
.command('build <platform>')
.description('builds the release version of the selected platform')
.option('--scheme <schemeToBuild>', 'iOS Scheme to build')
.option('--flavor <flavorToBuild>', 'Android Flavor to build')
.option('--keystorepath <keystorePath>', 'Path to the keystore')
.option('--keystorepass <keystorePass>', 'Password to the keystore')
.option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
Expand Down
2 changes: 2 additions & 0 deletions cli/src/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { buildiOS } from '../ios/build';

export interface BuildCommandOptions {
scheme?: string;
flavor?: string;
keystorepath?: string;
keystorepass?: string;
keystorealias?: string;
Expand All @@ -31,6 +32,7 @@ export async function buildCommand(

const buildCommandOptions: BuildCommandOptions = {
scheme: buildOptions.scheme || config.ios.scheme,
flavor: buildOptions.flavor || config.android.flavor,
keystorepath:
buildOptions.keystorepath || config.android.buildOptions.keystorePath,
keystorepass:
Expand Down