File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 run : |
3636 curl -u ${{ secrets.BASIC_AUTH }} -o android/app/app.key ${{ secrets.URL_PREFIX }}app.key
3737 curl -u ${{ secrets.BASIC_AUTH }} -o android/key.properties ${{ secrets.URL_PREFIX }}key.properties
38+ - name : Patch JNI build-id
39+ run : |
40+ flutter pub get
41+ scripts/release/patch-jni-build-id.sh
3842 - name : Build
3943 run : dart run fl_build -p android
4044 - name : Verify F-Droid native libraries
Original file line number Diff line number Diff line change 3232 run : |
3333 curl --fail --show-error --location -u ${{ secrets.BASIC_AUTH }} -o android/app/app.key ${{ secrets.URL_PREFIX }}app.key
3434 curl --fail --show-error --location -u ${{ secrets.BASIC_AUTH }} -o android/key.properties ${{ secrets.URL_PREFIX }}key.properties
35+ - name : Patch JNI build-id
36+ run : |
37+ flutter pub get
38+ scripts/release/patch-jni-build-id.sh
3539 - name : Build
3640 run : dart run fl_build -p android
3741 - name : Verify F-Droid native libraries
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ require_cmd () {
5+ local name=" $1 "
6+ if ! command -v " $name " > /dev/null 2>&1 ; then
7+ echo " command not found: $name " >&2
8+ exit 1
9+ fi
10+ }
11+
12+ pub_cache_path () {
13+ if [[ -n " ${PUB_CACHE:- } " ]]; then
14+ printf ' %s\n' " $PUB_CACHE "
15+ return
16+ fi
17+
18+ if command -v dart > /dev/null 2>&1 ; then
19+ dart pub cache path 2> /dev/null && return
20+ fi
21+
22+ printf ' %s\n' " $HOME /.pub-cache"
23+ }
24+
25+ patch_file () {
26+ local cmake_file=" $1 "
27+ local tmp_file
28+
29+ if grep -q -- ' --build-id=none' " $cmake_file " ; then
30+ echo " jni build-id patch already present: $cmake_file "
31+ return
32+ fi
33+
34+ if ! grep -q ' target_link_options(jni PRIVATE' " $cmake_file " ; then
35+ echo " jni linker options not found: $cmake_file " >&2
36+ return 1
37+ fi
38+
39+ tmp_file=" $( mktemp) "
40+ sed ' s/target_link_options(jni PRIVATE "/target_link_options(jni PRIVATE "-Wl,--build-id=none" "/' " $cmake_file " > " $tmp_file "
41+ mv " $tmp_file " " $cmake_file "
42+ echo " patched jni build-id linker flag: $cmake_file "
43+ }
44+
45+ require_cmd find
46+ require_cmd grep
47+ require_cmd mktemp
48+ require_cmd sed
49+
50+ pub_cache=" $( pub_cache_path) "
51+ if [[ ! -d " $pub_cache " ]]; then
52+ echo " pub cache not found: $pub_cache " >&2
53+ exit 1
54+ fi
55+
56+ patched=0
57+ while IFS= read -r cmake_file; do
58+ patch_file " $cmake_file "
59+ patched=$(( patched + 1 ))
60+ done < <( find " $pub_cache " -path ' */jni-*/src/CMakeLists.txt' -type f | sort)
61+
62+ if [[ $patched -eq 0 ]]; then
63+ echo " jni CMakeLists.txt not found under pub cache: $pub_cache " >&2
64+ exit 1
65+ fi
66+
67+ echo " jni build-id patch checked ${patched} file(s)."
You can’t perform that action at this time.
0 commit comments