Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
[xdl] flavorless Android builds for SDK >= 33 (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
esamelson committed Feb 1, 2019
1 parent 2936c7e commit c34182d
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions packages/xdl/src/detach/AndroidShellApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,9 @@ async function buildShellAppAsync(context: StandaloneContext, sdkVersion: string
await fs.remove(`shell.apk`);
} catch (e) {}
let gradleBuildCommand;
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 33) {
gradleBuildCommand = 'assembleRelease';
} else if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
gradleBuildCommand = 'assembleProdKernelRelease';
} else {
gradleBuildCommand = 'assembleProdMinSdkProdKernelRelease';
Expand All @@ -1050,8 +1052,19 @@ async function buildShellAppAsync(context: StandaloneContext, sdkVersion: string
},
});
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
await fs.copy(
path.join(
let apkPath;
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 33) {
apkPath = path.join(
shellPath,
'app',
'build',
'outputs',
'apk',
'release',
'app-release.apk'
);
} else {
apkPath = path.join(
shellPath,
'app',
'build',
Expand All @@ -1060,9 +1073,9 @@ async function buildShellAppAsync(context: StandaloneContext, sdkVersion: string
'prodKernel',
'release',
'app-prodKernel-release.apk'
),
'shell.apk'
);
);
}
await fs.copy(apkPath, 'shell.apk');
// -c means "only verify"
await spawnAsync(`zipalign`, ['-c', '-v', '4', 'shell.apk'], {
pipeToLogger: true,
Expand Down Expand Up @@ -1133,7 +1146,9 @@ async function buildShellAppAsync(context: StandaloneContext, sdkVersion: string
await fs.remove('shell-debug.apk');
} catch (e) {}
let gradleBuildCommand;
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 33) {
gradleBuildCommand = 'assembleDebug';
} else if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
gradleBuildCommand = 'assembleDevKernelDebug';
} else {
gradleBuildCommand = 'assembleDevMinSdkDevKernelDebug';
Expand All @@ -1144,7 +1159,9 @@ async function buildShellAppAsync(context: StandaloneContext, sdkVersion: string
cwd: shellPath,
});
let apkPath;
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 33) {
apkPath = path.join(shellPath, 'app', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk');
} else if (ExponentTools.parseSdkMajorVersion(sdkVersion) >= 32) {
apkPath = path.join(
shellPath,
'app',
Expand Down

0 comments on commit c34182d

Please sign in to comment.