Browse Source

Fix conditions for creating apks

tags/86.0.4240.111-1
wchen342 7 months ago
parent
commit
5805c7701e
Signed by: wchen342 GPG Key ID: 9C19365D69B04CEC
3 changed files with 24 additions and 26 deletions
  1. +2
    -0
      .gitea/issue_template.md
  2. +16
    -20
      build.sh
  3. +6
    -6
      bundle_generate_apk.sh

+ 2
- 0
.gitea/issue_template.md View File

@ -1,3 +1,5 @@
Note: if you are on a mobile device, go [here](https://github.com/ungoogled-software/ungoogled-chromium-android/issues) instead. Text input doesn't work correctly in mobile browsers.
Please choose between bug report/feature request accroding to your need.
---


+ 16
- 20
build.sh View File

@ -78,7 +78,7 @@ if [[ "$ARCH" != "arm64" ]] && [[ "$ARCH" != "arm" ]] && [[ "$ARCH" != "x86" ]];
exit 4
fi
if [[ "$TARGET" != "$chrome_modern_target" ]] && [[ "$TARGET" != "$trichrome_chrome_bundle_target" ]] && [[ "$TARGET" != "$webview_target" ]] && [[ "$TARGET" != - ]]; then
if [[ "$TARGET" != "$chrome_modern_target" ]] && [[ "$TARGET" != "$trichrome_chrome_bundle_target" ]] && [[ "$TARGET" != "$webview_target" ]] && [[ "$TARGET" != "all" ]]; then
echo "Wrong target"
exit 5
fi
@ -292,27 +292,23 @@ export CXX=${CXX:=clang++}
apk_out_folder="apk_out"
mkdir "${apk_out_folder}"
pushd src
if [[ "$TARGET" != - ]]; then
ninja -C "${output_folder}" $TARGET
if [[ "$TARGET" == "$trichrome_chrome_bundle_target" ]]; then
ninja -C "${output_folder}" "$trichrome_chrome_apk_target"
if [[ "$TARGET" != "all" ]]; then
ninja -C "${output_folder}" "$TARGET"
if [[ "$TARGET" == "$trichrome_chrome_bundle_target" ]] || [[ "$TARGET" == "$chrome_modern_target" ]]; then
../bundle_generate_apk.sh -o "${output_folder}" -t "$TARGET"
fi
../bundle_generate_apk.sh -o "${output_folder}" -t $TARGET
find . -iname "*.apk" -exec cp {} ../"${apk_out_folder}" \;
find . -iname "*.apk" -exec cp -f {} ../"${apk_out_folder}" \;
else
ninja -C out/Default $chrome_modern_target
../bundle_generate_apk.sh -o "${output_folder}" -t $chrome_modern_target
ninja -C out/Default $webview_target
# arm64 needs to clean before build trichrome otherwise will fail
if [[ "$ARCH" == "arm64" ]]; then
find . -iname "*.apk" -exec cp {} ../"${apk_out_folder}" \;
ninja -C "${output_folder}" -t clean
ninja -C out/Default "$chrome_modern_target"
../bundle_generate_apk.sh -o "${output_folder}" -t "$chrome_modern_target"
ninja -C out/Default "$webview_target"
find . -iname "*.apk" -exec cp -f {} ../"${apk_out_folder}" \;
# arm64+TriChrome needs to be run separately, otherwise it will fail
if [[ "$ARCH" != "arm64" ]]; then
ninja -C "${output_folder}" "$trichrome_chrome_bundle_target"
../bundle_generate_apk.sh -o "${output_folder}" -t "$trichrome_chrome_bundle_target"
find . -iname "*.apk" -exec cp -f {} ../"${apk_out_folder}" \;
fi
ninja -C "${output_folder}" "$trichrome_chrome_bundle_target"
ninja -C "${output_folder}" "$trichrome_chrome_apk_target"
find . -iname "*.apk" -exec cp {} ../"${apk_out_folder}" \;
fi
popd

+ 6
- 6
bundle_generate_apk.sh View File

@ -3,17 +3,17 @@
set -o errexit -o nounset -o pipefail
chrome_modern_target=chrome_modern_public_bundle
trichrome_chrome_bundle_target=trichrome_chrome_bundle
trichrome_chrome_apk_target=trichrome_library_apk
webview_target=system_webview_apk
KEYSTORE=$PWD/../../uc_keystore/uc-release-key.keystore
KEYSTORE_PASS=$PWD/../../uc_keystore/keystore_pass
APKSIGNER=$PWD/third_party/android_sdk/public/build-tools/30.0.1/apksigner
BUNDLETOOL=$PWD/build/android/gyp/bundletool.py
AAPT2=$PWD/third_party/android_build_tools/aapt2/aapt2
chrome_modern_target=chrome_modern_public_bundle
trichrome_chrome_bundle_target=trichrome_chrome_bundle
trichrome_chrome_apk_target=trichrome_library_apk
webview_target=system_webview_apk
# Argument parser from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash/29754866#29754866
# -allow a command to fail with !’s side effect on errexit
# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
@ -101,7 +101,7 @@ mv universal.apk "$FILENAME".apk
if [[ "$TARGET" == "$trichrome_chrome_bundle_target" ]]; then
for app in TrichromeLibrary TrichromeWebView; do
if [ -f ../${app}.apk ]; then
$APKSIGNER sign --ks $KEYSTORE --ks-pass file:$KEYSTORE_PASS --ks-key-alias uc_release --in ../${app}.apk --out $app.apk
$APKSIGNER sign --ks $KEYSTORE --ks-pass file:$KEYSTORE_PASS --ks-key-alias uc --in ../${app}.apk --out ${app}.apk
fi
done
fi

Loading…
Cancel
Save