From fab6604bb58e6cbd26611d18b3c31b64c6d52217 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Thu, 10 Feb 2022 22:58:48 +0800 Subject: [PATCH] log scripts --- go/mobile/bind-android.sh | 1 - go/mobile/bind-ios.sh | 1 - ios/Podfile.lock | 2 +- scripts/README.md | 1 + {go/mobile => scripts}/bind-android-debug.sh | 0 .../bind-ios-arm64.sh | 0 scripts/bind-ios.sh | 1 + scripts/build-apk-arm.sh | 6 +++++ scripts/build-apk-arm64.sh | 6 +++++ scripts/build-ipa.sh | 13 ++++++++++ scripts/thin-payload.sh | 24 +++++++++++++++++++ 11 files changed, 52 insertions(+), 3 deletions(-) delete mode 100644 go/mobile/bind-android.sh delete mode 100644 go/mobile/bind-ios.sh create mode 100644 scripts/README.md rename {go/mobile => scripts}/bind-android-debug.sh (100%) rename go/mobile/bind-ios-debug.sh => scripts/bind-ios-arm64.sh (100%) create mode 100644 scripts/bind-ios.sh create mode 100644 scripts/build-apk-arm.sh create mode 100644 scripts/build-apk-arm64.sh create mode 100644 scripts/build-ipa.sh create mode 100644 scripts/thin-payload.sh diff --git a/go/mobile/bind-android.sh b/go/mobile/bind-android.sh deleted file mode 100644 index fe40122..0000000 --- a/go/mobile/bind-android.sh +++ /dev/null @@ -1 +0,0 @@ -gomobile bind -target=android/arm -o lib/Mobile.aar ./ diff --git a/go/mobile/bind-ios.sh b/go/mobile/bind-ios.sh deleted file mode 100644 index f4e00bd..0000000 --- a/go/mobile/bind-ios.sh +++ /dev/null @@ -1 +0,0 @@ -gomobile bind -target=ios/arm64 -o lib/Mobile.xcframework ./ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c7156b4..153c752 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -21,7 +21,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 - url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af + url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..93f04b1 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1 @@ +用于记录作者构建时使用的脚本 diff --git a/go/mobile/bind-android-debug.sh b/scripts/bind-android-debug.sh similarity index 100% rename from go/mobile/bind-android-debug.sh rename to scripts/bind-android-debug.sh diff --git a/go/mobile/bind-ios-debug.sh b/scripts/bind-ios-arm64.sh similarity index 100% rename from go/mobile/bind-ios-debug.sh rename to scripts/bind-ios-arm64.sh diff --git a/scripts/bind-ios.sh b/scripts/bind-ios.sh new file mode 100644 index 0000000..d6c1c5c --- /dev/null +++ b/scripts/bind-ios.sh @@ -0,0 +1 @@ +gomobile bind -target=ios -o lib/Mobile.xcframework ./ diff --git a/scripts/build-apk-arm.sh b/scripts/build-apk-arm.sh new file mode 100644 index 0000000..7eb32c5 --- /dev/null +++ b/scripts/build-apk-arm.sh @@ -0,0 +1,6 @@ +# 仅构建arm的APK + +cd go/mobile +cd ../.. +gomobile bind -target=android/arm -o lib/Mobile.aar ./ +flutter build apk --target-platform android-arm diff --git a/scripts/build-apk-arm64.sh b/scripts/build-apk-arm64.sh new file mode 100644 index 0000000..883cf9d --- /dev/null +++ b/scripts/build-apk-arm64.sh @@ -0,0 +1,6 @@ +# 仅构建arm64的APK + +cd go/mobile +gomobile bind -target=android/arm64 -o lib/Mobile.aar ./ +cd ../.. +flutter build apk --target-platform android-arm64 diff --git a/scripts/build-ipa.sh b/scripts/build-ipa.sh new file mode 100644 index 0000000..92ae21b --- /dev/null +++ b/scripts/build-ipa.sh @@ -0,0 +1,13 @@ +# 构建未签名的IPA + +cd go/mobile +gomobile bind -target=ios -o lib/Mobile.xcframework ./ +cd ../.. +flutter build ios --release --no-codesign + +cd build +mkdir -p Payload +mv ios/iphoneos/Runner.app Payload + +sh ../scripts/thin_payload.sh +zip -9 nosign.ipa -r Payload diff --git a/scripts/thin-payload.sh b/scripts/thin-payload.sh new file mode 100644 index 0000000..1b431ba --- /dev/null +++ b/scripts/thin-payload.sh @@ -0,0 +1,24 @@ +# 精简Payload文件夹 (上传到AppStore会自动区分平台, 此代码仅用于构建非签名ipa) + +foreachThin(){ + for file in $1/* + do + if test -f $file + then + mime=$(file --mime-type -b $file) + if [ "$mime" == 'application/x-mach-binary' ] || [ "${file##*.}"x = "dylib"x ] + then + echo thin $file + xcrun -sdk iphoneos lipo "$file" -thin arm64 -output "$file" + xcrun -sdk iphoneos bitcode_strip "$file" -r -o "$file" + strip -S -x "$file" -o "$file" + fi + fi + if test -d $file + then + foreachThin $file + fi + done +} + +foreachThin ./Payload