1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-12 13:32:30 +03:00
vimr/bin/build_vimr.sh
Tae Won Ha 0c3a15a327
Fix scripts for generating sources
- Include also deprecated API methods, but mark it as deprecated using
  `@available()`.
2023-11-09 17:55:59 +01:00

80 lines
2.1 KiB
Bash
Executable File

#!/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"}
prepare_nvimserver() {
resources_folder="./NvimView/Sources/NvimView/Resources"
rm -rf "${resources_folder}/NvimServer"
rm -rf "${resources_folder}/runtime"
# Build NvimServer and copy
./NvimServer/NvimServer/bin/build_neovim.sh
pushd ./Neovim/build >/dev/null
tar -xf nvim-macos.tar.gz
popd >/dev/null
cp ./Neovim/build/nvim-macos/bin/nvim "${resources_folder}/NvimServer"
# Create and copy runtime folder
cp -r ./Neovim/build/nvim-macos/share/nvim/runtime "${resources_folder}"
# Copy VimR specific vim file to runtime/plugin folder
cp "${resources_folder}/com.qvacua.NvimView.vim" "${resources_folder}/runtime/plugin"
}
build_vimr() {
local -r build_path=$1
# Carthage often crashes => do it at the beginning.
echo "### Updating carthage"
if [[ "${use_carthage_cache}" == true ]]; then
carthage update --cache-builds --platform macos
else
carthage update --platform macos
fi
echo "### Xcodebuilding"
rm -rf "${build_path}"
if [[ "${clean}" == true ]]; then
xcodebuild \
-configuration Release -derivedDataPath "${build_path}" \
-workspace VimR.xcworkspace -scheme VimR \
clean build
else
xcodebuild \
-configuration Release -derivedDataPath "${build_path}" \
-workspace VimR.xcworkspace -scheme VimR \
build
fi
}
main () {
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
echo "### Building VimR"
prepare_nvimserver
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
./bin/sign_vimr.sh
./bin/notarize_vimr.sh
fi
echo "### VimR built in ${build_path}/Build/Products/Release/VimR.app"
popd >/dev/null
}
main