Skip to content

Commit

Permalink
fix(cli): correctly build and sign Android apps using Flavors (#7082)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Anderson <[email protected]>
Co-authored-by: jcesarmobile <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2024
1 parent 4a02e7a commit 7d3a99d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cli/src/android/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,25 @@ export async function buildAndroid(
}
}

const releaseDir = releaseTypeIsAAB
? flavor !== ''
? `${flavor}Release`
: 'Release'
: flavor !== ''
? join(flavor, 'release')
: 'release';

const releasePath = join(
config.android.appDirAbs,
'build',
'outputs',
releaseTypeIsAAB ? 'bundle' : 'apk',
buildOptions.flavor ? `${flavor}Release` : 'release',
releaseDir,
);

const unsignedReleaseName = `app${
config.android.flavor ? `-${config.android.flavor}` : ''
}-release${releaseTypeIsAAB ? '' : '-unsigned'}.${releaseType.toLowerCase()}`;
const unsignedReleaseName = `app${flavor !== '' ? `-${flavor}` : ''}-release${
releaseTypeIsAAB ? '' : '-unsigned'
}.${releaseType.toLowerCase()}`;

const signedReleaseName = unsignedReleaseName.replace(
`-release${
Expand Down
2 changes: 2 additions & 0 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export function runProgram(config: Config): void {
platform,
{
scheme,
flavor,
keystorepath,
keystorepass,
keystorealias,
Expand All @@ -185,6 +186,7 @@ export function runProgram(config: Config): void {
const { buildCommand } = await import('./tasks/build');
await buildCommand(config, platform, {
scheme,
flavor,
keystorepath,
keystorepass,
keystorealias,
Expand Down

0 comments on commit 7d3a99d

Please sign in to comment.