summaryrefslogtreecommitdiff
path: root/platform/macos/scripts
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-16 11:38:35 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-16 11:38:35 -0800
commit7ef2843e6a62116667be6a2c12de085951fdd5ea (patch)
tree40eca249e044e2706efd1193d617e6eb8e59d708 /platform/macos/scripts
parent76301b252cbc4bc3ae1fc84322bcbcdbd26cae8a (diff)
parent13b97dd0cebffe36b187bdb74923910def6bd87b (diff)
downloadqtlocation-mapboxgl-7ef2843e6a62116667be6a2c12de085951fdd5ea.tar.gz
Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.7
Diffstat (limited to 'platform/macos/scripts')
-rwxr-xr-xplatform/macos/scripts/deploy-packages.sh98
-rwxr-xr-xplatform/macos/scripts/document.sh16
-rwxr-xr-xplatform/macos/scripts/package.sh13
3 files changed, 91 insertions, 36 deletions
diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh
index c137401748..d0c545f8f5 100755
--- a/platform/macos/scripts/deploy-packages.sh
+++ b/platform/macos/scripts/deploy-packages.sh
@@ -4,32 +4,29 @@ set -e
set -o pipefail
set -u
-usage() {
-cat <<EOF
-# Usage: sh $0 version target_directory [argument]
-
-# version: The semver version plus optional alpha beta distinction (i.e. {major.minor.patch}{-alpha.N})
-# target_directory: The directory where build output should be placed
-
-# argument:
-# -g: Upload to github
+# dynamic environment variables:
+# VERSION_TAG={determined automatically}: Version tag in format macos-vX.X.X-pre.X
+# GITHUB_RELEASE=true: Upload to github
+# BINARY_DIRECTORY=build/macos/deploy: Directory in which to save test packages
# environment variables and dependencies:
# - You must run "mbx auth ..." before running
# - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE
# - "wget" is required for downloading the zip files from s3
-# - The "github-release" gem is required to use GITHUB_RELEASE
-EOF
-}
+# - The "github-release" command is required to use GITHUB_RELEASE
+
+function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
+function finish { >&2 echo -en "\033[0m"; }
+trap finish EXIT
buildPackageStyle() {
local package=$1 style=""
if [[ ${#} -eq 2 ]]; then
style="$2"
fi
- echo "make ${package} ${style}"
+ step "Building: make ${package} ${style}"
make ${package}
- echo "publish ${package} with ${style}"
+ step "Publishing ${package} with ${style}"
local file_name=""
if [ -z ${style} ]
then
@@ -37,47 +34,86 @@ buildPackageStyle() {
else
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip
fi
- echo "compress ${file_name}"
+ step "Compressing ${file_name}…"
cd build/macos/pkg
- rm -f ../${file_name}
- zip -r ../${file_name} *
+ rm -f ../deploy/${file_name}
+ zip -r ../deploy/${file_name} *
cd -
if [[ "${GITHUB_RELEASE}" == true ]]; then
- echo "publish ${file_name} to GitHub"
- github-release --verbose upload --tag "macos-v${PUBLISH_VERSION}" --name ${file_name} --file "build/macos/${file_name}"
- fi
+ echo "Uploading ${file_name} to GitHub"
+ github-release upload \
+ --tag "macos-v${PUBLISH_VERSION}" \
+ --name ${file_name} \
+ --file "${BINARY_DIRECTORY}/${file_name}" > /dev/null
+ fi
}
-if [ ${#} -eq 0 -o ${#} -gt 3 ]; then
- usage
- exit 1
-fi
-
export TRAVIS_REPO_SLUG=mapbox-gl-native
-export PUBLISH_VERSION=$1
export GITHUB_USER=mapbox
export GITHUB_REPO=mapbox-gl-native
export BUILDTYPE=Release
-BINARY_DIRECTORY=$2
+VERSION_TAG=${VERSION_TAG:-''}
+PUBLISH_VERSION=
+BINARY_DIRECTORY=${BINARY_DIRECTORY:-build/macos/deploy}
+GITHUB_RELEASE=${GITHUB_RELEASE:-true}
PUBLISH_PRE_FLAG=''
-GITHUB_RELEASE=false
-echo "Deploying version ${PUBLISH_VERSION}..."
+if [[ ${GITHUB_RELEASE} = "true" ]]; then
+ GITHUB_RELEASE=true # Assign bool, not just a string
+
+ if [[ -z `which github-release` ]]; then
+ step "Installing github-release…"
+ brew install github-release
+ if [ -z `which github-release` ]; then
+ echo "Unable to install github-release. See: https://github.com/aktau/github-release"
+ exit 1
+ fi
+ fi
+fi
+
+if [[ -z ${VERSION_TAG} ]]; then
+ step "Determining version number from most recent relevant git tag…"
+ VERSION_TAG=$( git describe --tags --match=macos-v*.*.* --abbrev=0 )
+ echo "Found tag: ${VERSION_TAG}"
+fi
+
+if [[ $( echo ${VERSION_TAG} | grep --invert-match macos-v ) ]]; then
+ echo "Error: ${VERSION_TAG} is not a valid macOS version tag"
+ echo "VERSION_TAG should be in format: macos-vX.X.X-pre.X"
+ exit 1
+fi
+
+if [[ $( wget --spider -O- https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/tags/${VERSION_TAG} 2>&1 | grep -c "404 Not Found" ) == 0 ]]; then
+ echo "Error: ${VERSION_TAG} has already been published on GitHub"
+ echo "See: https://github.com/${GITHUB_USER}/${GITHUB_REPO}/releases/tag/${VERSION_TAG}"
+ exit 1
+fi
+
+PUBLISH_VERSION=$( echo ${VERSION_TAG} | sed 's/^macos-v//' )
+git checkout ${VERSION_TAG}
+
+step "Deploying version ${PUBLISH_VERSION}…"
if [[ ${#} -eq 3 && $3 == "-g" ]]; then
GITHUB_RELEASE=true
fi
make clean && make distclean
+mkdir -p ${BINARY_DIRECTORY}
if [[ "${GITHUB_RELEASE}" == true ]]; then
- echo "Create GitHub release..."
+ step "Create GitHub release…"
if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then
PUBLISH_PRE_FLAG='--pre-release'
fi
- github-release --verbose release --tag "macos-v${PUBLISH_VERSION}" --name "macos-v${PUBLISH_VERSION}" --draft ${PUBLISH_PRE_FLAG}
+ github-release release \
+ --tag "macos-v${PUBLISH_VERSION}" \
+ --name "macos-v${PUBLISH_VERSION}" \
+ --draft ${PUBLISH_PRE_FLAG}
fi
buildPackageStyle "xpackage" "symbols"
buildPackageStyle "xpackage SYMBOLS=NO"
+
+step "Finished deploying ${PUBLISH_VERSION} in $(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds"
diff --git a/platform/macos/scripts/document.sh b/platform/macos/scripts/document.sh
index d03ad91674..69c9aaa871 100755
--- a/platform/macos/scripts/document.sh
+++ b/platform/macos/scripts/document.sh
@@ -22,15 +22,21 @@ RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^macos-v//' -e 's/-.*//' )
rm -rf /tmp/mbgl
mkdir -p /tmp/mbgl/
README=/tmp/mbgl/README.md
-cp platform/macos/docs/doc-README.md "${README}"
+if [[ ${STANDALONE:-} ]]; then
+ cp platform/macos/docs/pod-README.md "${README}"
+ perl -pi -e 's|https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/macos/docs/||' \
+ "${README}"
+else
+ cp platform/macos/docs/doc-README.md "${README}"
+fi
# http://stackoverflow.com/a/4858011/4585461
-echo "## Changes in version ${RELEASE_VERSION}" >> "${README}"
-sed -n -e '/^## /{' -e ':a' -e 'n' -e '/^##/q' -e 'p' -e 'ba' -e '}' platform/macos/CHANGELOG.md >> "${README}"
+echo "## Changes in [version ${RELEASE_VERSION}](https://github.com/mapbox/mapbox-gl-native/releases/tag/${BRANCH})" >> "${README}"
+sed -n -e '/^## /{' -e ':a' -e 'n' -e '/^## /q' -e 'p' -e 'ba' -e '}' platform/macos/CHANGELOG.md >> "${README}"
rm -rf ${OUTPUT}
mkdir -p ${OUTPUT}
-cp platform/macos/screenshot.png "${OUTPUT}"
+cp -r platform/macos/docs/img "${OUTPUT}/img"
jazzy \
--config platform/macos/jazzy.yml \
@@ -38,7 +44,7 @@ jazzy \
--github-file-prefix https://github.com/mapbox/mapbox-gl-native/tree/${BRANCH} \
--module-version ${SHORT_VERSION} \
--readme ${README} \
- --documentation="platform/macos/docs/Info.plist Keys.md" \
+ --documentation="platform/{darwin,macos}/docs/guides/*.md" \
--theme platform/darwin/docs/theme \
--output ${OUTPUT}
# https://github.com/realm/jazzy/issues/411
diff --git a/platform/macos/scripts/package.sh b/platform/macos/scripts/package.sh
index 2f30b0917d..6ae0cc65cc 100755
--- a/platform/macos/scripts/package.sh
+++ b/platform/macos/scripts/package.sh
@@ -68,6 +68,19 @@ if [[ ${BUILDTYPE} == Release ]]; then
"${OUTPUT}/${NAME}.framework/${NAME}"
fi
+function create_podspec {
+ step "Creating local podspec…"
+ [[ $SYMBOLS = YES ]] && POD_SUFFIX="-symbols" || POD_SUFFIX=""
+ POD_SOURCE_PATH=' :path => ".",'
+ POD_FRAMEWORKS=" m.vendored_frameworks = '"${NAME}".framework'"
+ INPUT_PODSPEC=platform/macos/${NAME}-macOS-SDK${POD_SUFFIX}.podspec
+ OUTPUT_PODSPEC=${OUTPUT}/${NAME}-macOS-SDK${POD_SUFFIX}.podspec
+ sed "s/.*:http.*/${POD_SOURCE_PATH}/" ${INPUT_PODSPEC} > ${OUTPUT_PODSPEC}
+ sed -i '' "s/.*vendored_frameworks.*/${POD_FRAMEWORKS}/" ${OUTPUT_PODSPEC}
+}
+
+create_podspec
+
step "Copying library resources…"
cp -pv LICENSE.md "${OUTPUT}"
cp -pv platform/macos/docs/pod-README.md "${OUTPUT}/README.md"