Skip to content

Commit f6d68bf

Browse files
committed
fix(build.gradle.kts): bootstrap build/download logic for targets
1 parent 567360d commit f6d68bf

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

app/build.gradle.kts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ fun setupBootstrap(arch: String) {
300300
}
301301

302302
tasks {
303+
val archMap = mapOf(
304+
"x86" to "i686",
305+
"x86_64" to "x86_64",
306+
"armeabi-v7a" to "arm",
307+
"arm64-v8a" to "aarch64"
308+
)
309+
303310
val setupBootstraps by registering {
304311
if (gradle.startParameter.taskNames.any { it.contains("assembleRelease") }) {
305312
dependsOn("buildBootstraps")
@@ -308,8 +315,11 @@ tasks {
308315
}
309316

310317
doFirst {
311-
val map = listOf("aarch64", "i686", "arm", "x86_64")
312-
map.forEach { arch -> setupBootstrap(arch) }
318+
if (targetABI.isNullOrEmpty()) {
319+
archMap.values.forEach { arch -> setupBootstrap(arch) }
320+
} else {
321+
setupBootstrap(archMap[targetABI]!!)
322+
}
313323
}
314324
}
315325

@@ -319,7 +329,8 @@ tasks {
319329
errorOutput = System.err
320330

321331
doFirst { delete("srcLib/tmp") }
322-
commandLine("bash", "build.sh")
332+
if (targetABI.isNullOrEmpty()) commandLine("bash", "build.sh")
333+
else commandLine("bash", "build.sh", "-a", archMap[targetABI])
323334
}
324335

325336
val downloadBootstraps by registering {
@@ -331,7 +342,12 @@ tasks {
331342
"x86_64" to "d1f28ff6a08c128974a6d777af06c4603a07c129d877d608072c4596bef6cee8"
332343
)
333344

334-
map.forEach { (arch, checksum) -> downloadBootstrap(arch, checksum) }
345+
if (targetABI.isNullOrEmpty()) {
346+
map.forEach { (arch, checksum) -> downloadBootstrap(arch, checksum) }
347+
} else {
348+
val arch = archMap[targetABI]
349+
downloadBootstrap(arch!!, map[arch]!!)
350+
}
335351
}
336352
}
337353
}

app/srcLib/build.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,33 @@ if [[ -z "$ANDROID_HOME" || -z "$NDK" ]]; then
1515
./scripts/setup-android-sdk.sh
1616
fi
1717

18-
# Build bootstraps for each architecture
19-
./scripts/build-bootstraps.sh --android10 &> $HOME/tmp/build.log
18+
# Evaluate arguments
19+
TARGET=""
2020

21-
# Store bootstraps
21+
while getopts ":a:" opt; do
22+
case $opt in
23+
a)
24+
TARGET="$OPTARG"
25+
;;
26+
\?)
27+
echo "Invalid option: -$OPTARG" >&2
28+
exit 1
29+
;;
30+
:)
31+
echo "Option -$OPTARG requires an argument." >&2
32+
exit 1
33+
;;
34+
esac
35+
done
36+
37+
# Build bootstrap(s)
38+
if [ -n "$TARGET" ]; then
39+
./scripts/build-bootstraps.sh --android10 --architectures "$TARGET" &> $HOME/tmp/build.log
40+
else
41+
./scripts/build-bootstraps.sh --android10 &> $HOME/tmp/build.log
42+
fi
43+
44+
# Store bootstrap(s)
2245
cd "$dir"
2346
mkdir -p ../../bootstraps
2447
mv /home/builder/*.zip ../../bootstraps

0 commit comments

Comments
 (0)