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

[xdl] flavorless Android builds for SDK 33+ #343

Merged
merged 1 commit into from
Feb 1, 2019
Merged
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
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