From f45553d4dde4f5deef5d5e978d7c7675e5c8fa69 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sun, 15 Nov 2020 22:11:01 +0100 Subject: [PATCH] Refactor slightly --- bin/build_deps.sh | 9 +++++++-- bin/build_nvimserver_for_local_dev.sh | 2 +- bin/build_vimr_dev.sh | 2 +- bin/download_nvimserver.sh | 6 ++++-- bin/notarize_vimr.sh | 10 +++++----- bin/sign_vimr.sh | 5 ++++- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/bin/build_deps.sh b/bin/build_deps.sh index a6154007..24972eeb 100755 --- a/bin/build_deps.sh +++ b/bin/build_deps.sh @@ -3,8 +3,13 @@ set -Eeuo pipefail main () { pushd "$(dirname "${BASH_SOURCE[0]}")/.." > /dev/null - local -r x86_64_deployment_target=$(cat ./resources/x86_64_deployment_target.txt) - local -r arm64_deployment_target=$(cat ./resources/arm64_deployment_target.txt) + local x86_64_deployment_target + x86_64_deployment_target=$(cat ./resources/x86_64_deployment_target.txt) + readonly x86_64_deployment_target + + local arm64_deployment_target + arm64_deployment_target=$(cat ./resources/arm64_deployment_target.txt) + readonly arm64_deployment_target local -r pcre_version="8.43" local -r xz_version="5.2.4" diff --git a/bin/build_nvimserver_for_local_dev.sh b/bin/build_nvimserver_for_local_dev.sh index cf369b84..3bd42b95 100755 --- a/bin/build_nvimserver_for_local_dev.sh +++ b/bin/build_nvimserver_for_local_dev.sh @@ -14,7 +14,7 @@ build_for_local_dev() { local -r nvimserver_path="./NvimServer" pushd ${nvimserver_path} >/dev/null - if [[ ${clean} == true ]]; then + if [[ "${clean}" == true ]]; then local -r -x clean_deps=false ./NvimServer/bin/clean_all.sh fi diff --git a/bin/build_vimr_dev.sh b/bin/build_vimr_dev.sh index a44a3b8d..18506c3d 100755 --- a/bin/build_vimr_dev.sh +++ b/bin/build_vimr_dev.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail readonly clean=${clean:?"true or false: when true, xcodebuild clean will be performed"} main() { - if "${clean}" ; then + if [[ "${clean}" == true ]]; then local -r cmd="clean build" else local -r cmd="build" diff --git a/bin/download_nvimserver.sh b/bin/download_nvimserver.sh index 14143c39..55edc703 100755 --- a/bin/download_nvimserver.sh +++ b/bin/download_nvimserver.sh @@ -6,7 +6,9 @@ readonly nvimserver_dir_path="${target_dir_path}/NvimServer" download_nvimserver() { echo "### Downloading NvimServer" - local -r version=$(cat ./resources/nvimserver_version.txt) + local version + version=$(cat ./resources/nvimserver_version.txt) + readonly version echo "#### Downloading ${version}" @@ -29,7 +31,7 @@ download_nvimserver() { main() { pushd "$(dirname "${BASH_SOURCE[0]}")/.." > /dev/null - download_nvimserver + download_nvimserver popd >/dev/null } diff --git a/bin/notarize_vimr.sh b/bin/notarize_vimr.sh index 12985b01..f07e723d 100755 --- a/bin/notarize_vimr.sh +++ b/bin/notarize_vimr.sh @@ -8,25 +8,25 @@ main() { echo "### Notarizing" ditto -c -k --keepParent VimR.app VimR.app.zip - echo "### Uploading" - declare -x request_uuid + 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 "#### 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'" pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null - echo "### Waiting for notarization ${request_uuid} to finish" + echo "#### Waiting for notarization ${request_uuid} to finish" ./bin/wait_for_notarization.py - echo "### Notarization finished" popd >/dev/null xcrun stapler staple VimR.app + echo "### Notarization finished" popd >/dev/null } diff --git a/bin/sign_vimr.sh b/bin/sign_vimr.sh index a14c7a6f..fd9e8c7c 100755 --- a/bin/sign_vimr.sh +++ b/bin/sign_vimr.sh @@ -7,7 +7,9 @@ readonly identity="Developer ID Application: Tae Won Ha (H96Q2NKTQH)" main () { pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null echo "### Signing VimR" - local -r entitlements_path=$(realpath ./Carthage/Build/Mac/NvimServer/NvimServer.entitlements) + local entitlements_path + entitlements_path=$(realpath ./Carthage/Build/Mac/NvimServer/NvimServer.entitlements) + readonly entitlements_path codesign --verbose --force -s "${identity}" --deep --timestamp --options=runtime \ "${vimr_app_path}/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app" @@ -20,6 +22,7 @@ main () { codesign --verbose --force -s "${identity}" --deep --timestamp --options=runtime \ "${vimr_app_path}" + echo "### Signed VimR" echo "### Use 'spctl -a -vvvv ${vimr_app_path}' to verify the signing." popd >/dev/null