From 463e1f38a3c19fa186636529f626cc49ab7f2f07 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sun, 20 Nov 2022 11:08:41 +0100 Subject: [PATCH 1/2] Reduce bin size --- VimR/VimR.xcodeproj/project.pbxproj | 2 ++ bin/build_vimr.sh | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/VimR/VimR.xcodeproj/project.pbxproj b/VimR/VimR.xcodeproj/project.pbxproj index c33e0300..8611ef7d 100644 --- a/VimR/VimR.xcodeproj/project.pbxproj +++ b/VimR/VimR.xcodeproj/project.pbxproj @@ -1129,6 +1129,7 @@ CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 20221115.195322; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1190,6 +1191,7 @@ CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 20221115.195322; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/bin/build_vimr.sh b/bin/build_vimr.sh index c94a1e26..778fb6b4 100755 --- a/bin/build_vimr.sh +++ b/bin/build_vimr.sh @@ -1,6 +1,7 @@ #!/bin/bash set -Eeuo pipefail +readonly strip_symbols=${strip_symbols:-true} readonly notarize=${notarize:?"true or false"} readonly use_carthage_cache=${use_carthage_cache:?"true or false"} readonly clean=${clean:?"true or false"} @@ -52,8 +53,13 @@ main () { local -r build_path="./build" build_vimr "${build_path}" + local -r -x vimr_app_path="${build_path}/Build/Products/Release/VimR.app" + + if [[ "${strip_symbols}" == true ]]; then + strip -rSTx "${vimr_app_path}/Contents/MacOS/VimR" + fi + if [[ "${notarize}" == true ]]; then - local -r -x vimr_app_path="${build_path}/Build/Products/Release/VimR.app" ./bin/sign_vimr.sh ./bin/notarize_vimr.sh fi From eb763ea6d17606c0e9835ea563c9b020c930d099 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sun, 20 Nov 2022 11:26:06 +0100 Subject: [PATCH 2/2] Use the new notarytool --- bin/notarize_vimr.sh | 17 ++++--------- bin/wait_for_notarization.py | 46 ------------------------------------ 2 files changed, 4 insertions(+), 59 deletions(-) delete mode 100755 bin/wait_for_notarization.py diff --git a/bin/notarize_vimr.sh b/bin/notarize_vimr.sh index c9cad01e..5eeae6cd 100755 --- a/bin/notarize_vimr.sh +++ b/bin/notarize_vimr.sh @@ -8,21 +8,12 @@ main() { echo "### Notarizing" ditto -c -k --keepParent VimR.app VimR.app.zip - echo "#### Uploading" - local -x request_uuid - request_uuid=$(xcrun altool --notarize-app --primary-bundle-id "com.qvacua.VimR" --username "hataewon@gmail.com" --password "@keychain:dev-notar" --file VimR.app.zip | grep RequestUUID | sed -E 's/.* = (.*)/\1/') - readonly request_uuid - - echo "#### Uploaded" - echo "Use 'xcrun altool --notarization-history 0 -u hataewon@gmail.com -p @keychain:dev-notar' or" - echo "'xcrun altool --notarization-info ${request_uuid} -u hataewon@gmail.com -p @keychain:dev-notar'" + echo "#### Notarizing" + xcrun notarytool submit VimR.app.zip \ + --keychain-profile "apple-dev-notar" \ + --wait popd >/dev/null - pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null - echo "#### Waiting for notarization ${request_uuid} to finish" - ./bin/wait_for_notarization.py - popd /dev/null xcrun stapler staple VimR.app echo "### Notarization finished" diff --git a/bin/wait_for_notarization.py b/bin/wait_for_notarization.py deleted file mode 100755 index bbd300a7..00000000 --- a/bin/wait_for_notarization.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -from waiting import wait, TimeoutExpired -import os -import subprocess - - -def check_status(request_uuid: str) -> bool: - proc = subprocess.run( - f"xcrun altool --notarization-info {request_uuid} -u hataewon@gmail.com -p @keychain:dev-notar".split(), - capture_output=True - ) - lines = proc.stdout.decode("utf-8").split("\n") - - success = [line for line in lines if "Status: success" in line] - inprog = [line for line in lines if "Status: in progress" in line] - invalid = [line for line in lines if "Status: invalid" in line] - - if invalid: - print("### ERROR: notarization unsuccessful!") - exit(1) - - if success: - print("### Notarization successful") - return True - - if inprog: - print("### Notarization in progress") - return False - - print("### Notarization status unclear, probably in progress") - return False - - -if __name__ == "__main__": - request_uuid = os.environ["request_uuid"] - print(f"### Waiting for request {request_uuid}") - - try: - wait(lambda: check_status(request_uuid), timeout_seconds=60*60, sleep_seconds=30) - except TimeoutExpired: - print("### ERROR: Timeout of 1h!") - exit(1) - except Exception as err: - print(f"### ERROR: err") - exit(1)