diff --git a/Makefile b/Makefile index b1ceeb74b..4f568114b 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,10 @@ macos-test: $(MACOS_PROJ_PATH) xpackage: $(MACOS_PROJ_PATH) SYMBOLS=$(SYMBOLS) ./platform/macos/scripts/package.sh +.PHONY: xdeploy +xdeploy: + caffeinate -i ./platform/macos/scripts/deploy-packages.sh + .PHONY: xdocument xdocument: OUTPUT=$(OUTPUT) ./platform/macos/scripts/document.sh diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh index 8ad5e7abb..2265afdba 100755 --- a/platform/ios/scripts/deploy-packages.sh +++ b/platform/ios/scripts/deploy-packages.sh @@ -44,7 +44,7 @@ buildPackageStyle() { --tag "ios-v${PUBLISH_VERSION}" \ --name ${file_name} \ --file "${BINARY_DIRECTORY}/${file_name}" > /dev/null - fi + fi } export TRAVIS_REPO_SLUG=mapbox-gl-native diff --git a/platform/macos/INSTALL.md b/platform/macos/INSTALL.md index a4b944611..f8b4c675d 100644 --- a/platform/macos/INSTALL.md +++ b/platform/macos/INSTALL.md @@ -11,6 +11,13 @@ The Mapbox macOS SDK requires the macOS 10.10.0 SDK (or above) and Xcode 7.3 (or Grab a [prebuilt release](https://github.com/mapbox/mapbox-gl-native/releases/) – look for the releases that begin with “macos-” – or build the SDK from source: 1. [Install core dependencies](../../INSTALL.md). + +1. Install [jazzy](https://github.com/realm/jazzy) for generating API documentation: + + ``` + [sudo] gem install jazzy + ``` + 1. Run `make xpackage`, which produces a `Mapbox.framework` in the `build/macos/pkg/` folder. ### Installation @@ -64,4 +71,4 @@ script AppDelegate end script ``` -Run `make xdocument` to generate complete API documentation. The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/api/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. +For further instructions, consult the [macOS SDK documentation](https://mapbox.github.io/mapbox-gl-native/macos/) or run `make xdocument` to generate the documentation. The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. diff --git a/platform/macos/Mapbox-macOS-SDK-symbols.podspec b/platform/macos/Mapbox-macOS-SDK-symbols.podspec new file mode 100644 index 000000000..7083f7096 --- /dev/null +++ b/platform/macos/Mapbox-macOS-SDK-symbols.podspec @@ -0,0 +1,28 @@ +Pod::Spec.new do |m| + + m.name = 'Mapbox-macOS-SDK' + m.version = '0.3.0-rc.1-symbols' + + m.summary = 'Open-source, interactive, fully customizable vector maps.' + m.description = 'Interactive, fully customizable vector maps with tight platform integration and high-performance OpenGL rendering.' + m.homepage = 'https://mapbox.github.io/mapbox-gl-native/macos/' + m.license = { :type => 'BSD', :file => 'LICENSE.md' } + m.author = { 'Mapbox' => 'mobile@mapbox.com' } + m.screenshot = "https://raw.githubusercontent.com/mapbox/mapbox-gl-native/macos-#{m.version.to_s}/platform/macos/docs/img/screenshot.jpg" + m.social_media_url = 'https://twitter.com/mapbox' + m.documentation_url = 'https://mapbox.github.io/mapbox-gl-native/macos/' + + m.source = { + :http => "https://github.com/mapbox/mapbox-gl-native/releases/download/macos-v#{m.version.to_s}/mapbox-macos-sdk-#{m.version.to_s}.zip", + :flatten => true + } + + m.platform = :macos + m.macos.deployment_target = '10.10' + + m.requires_arc = true + + m.vendored_frameworks = 'Mapbox.framework' + m.module_name = 'Mapbox' + +end diff --git a/platform/macos/Mapbox-macOS-SDK.podspec b/platform/macos/Mapbox-macOS-SDK.podspec new file mode 100644 index 000000000..9a3b98b7a --- /dev/null +++ b/platform/macos/Mapbox-macOS-SDK.podspec @@ -0,0 +1,28 @@ +Pod::Spec.new do |m| + + m.name = 'Mapbox-macOS-SDK' + m.version = '0.3.0-rc.1' + + m.summary = 'Open-source, interactive, fully customizable vector maps.' + m.description = 'Interactive, fully customizable vector maps with tight platform integration and high-performance OpenGL rendering.' + m.homepage = 'https://mapbox.github.io/mapbox-gl-native/macos/' + m.license = { :type => 'BSD', :file => 'LICENSE.md' } + m.author = { 'Mapbox' => 'mobile@mapbox.com' } + m.screenshot = "https://raw.githubusercontent.com/mapbox/mapbox-gl-native/macos-#{m.version.to_s}/platform/macos/docs/img/screenshot.jpg" + m.social_media_url = 'https://twitter.com/mapbox' + m.documentation_url = 'https://mapbox.github.io/mapbox-gl-native/macos/' + + m.source = { + :http => "https://github.com/mapbox/mapbox-gl-native/releases/download/macos-v#{m.version.to_s}/mapbox-macos-sdk-#{m.version.to_s}.zip", + :flatten => true + } + + m.platform = :macos + m.macos.deployment_target = '10.10' + + m.requires_arc = true + + m.vendored_frameworks = 'Mapbox.framework' + m.module_name = 'Mapbox' + +end diff --git a/platform/macos/README.md b/platform/macos/README.md index 211b238d5..13cb04eb5 100644 --- a/platform/macos/README.md +++ b/platform/macos/README.md @@ -2,11 +2,23 @@ [![Bitrise](https://www.bitrise.io/app/155ef7da24b38dcd.svg?token=4KSOw_gd6WxTnvGE2rMttg&branch=master)](https://www.bitrise.io/app/155ef7da24b38dcd) -A library based on [Mapbox GL Native](../../README.md) for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.10.0 and above using Objective-C, Swift, or Interface Builder. +Put interactive, scalable world maps into your native Cocoa application with the Mapbox macOS SDK. -This SDK is analogous to the Mapbox iOS SDK, and much of the iOS SDK documentation applies here. Mapbox does not officially support the macOS SDK to the same extent as the iOS SDK; however, bug reports and pull requests are certainly welcome. +* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started. +* Customize every aspect of the map’s appearance in code or visually using [Mapbox Studio](https://www.mapbox.com/mapbox-studio/). +* High-performance OpenGL rendering and multitouch gestures keep your users happy. +* A well-designed, fully documented API helps you stay productive. +* Develop across [multiple platforms](../../README.md), including [iOS](../ios/README.md), using the same styles and similar APIs. -* [Integrating the Mapbox macOS SDK into your application](INSTALL.md) -* [Contributing to the Mapbox macOS SDK](DEVELOPING.md) +The Mapbox macOS SDK is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js/). - +* [Integrate the Mapbox macOS SDK into your application](INSTALL.md) +* [Contribute to the Mapbox macOS SDK](DEVELOPING.md) +* [Mapbox macOS SDK reference documentation](https://mapbox.github.io/mapbox-gl-native/macos/api/) +* [See example styles designed in Mapbox Studio](https://www.mapbox.com/gallery/) +* [Hand-authoring a macOS SDK–compatible style](https://www.mapbox.com/mapbox-gl-style-spec/) +* [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/) + +![](docs/img/screenshot.jpg) + +Mapbox does not officially support the Mapbox macOS SDK to the same extent as the Mapbox iOS SDK; however, bug reports and pull requests are certainly welcome. diff --git a/platform/macos/docs/doc-README.md b/platform/macos/docs/doc-README.md index 4aba26afd..391b3dfca 100644 --- a/platform/macos/docs/doc-README.md +++ b/platform/macos/docs/doc-README.md @@ -1,9 +1,9 @@ # [Mapbox macOS SDK](https://github.com/mapbox/mapbox-gl-native/tree/master/platform/macos/) -The Mapbox macOS SDK is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.10.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. +The Mapbox macOS SDK is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.10.0 and above using Objective-C, Swift, Interface Builder, or AppleScript. The Mapbox macOS SDK takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. -Mapbox macOS SDK screenshot +![](img/screenshot.jpg) -For setup information, consult the README.md that comes with this documentation. The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/api/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. A [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/macos/CHANGELOG.md) is also available. +For setup information, consult the README.md that comes with this documentation. For further instructions, consult the [macOS SDK documentation](https://mapbox.github.io/mapbox-gl-native/macos/). The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/api/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. A [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/macos/CHANGELOG.md) is also available. Mapbox does not officially support the macOS SDK to the same extent as the iOS SDK; however, [bug reports and pull requests](https://github.com/mapbox/mapbox-gl-native/issues/) are certainly welcome. diff --git a/platform/macos/docs/img/screenshot.jpg b/platform/macos/docs/img/screenshot.jpg new file mode 100644 index 000000000..5341a3d6f Binary files /dev/null and b/platform/macos/docs/img/screenshot.jpg differ diff --git a/platform/macos/docs/pod-README.md b/platform/macos/docs/pod-README.md index 8af262cc8..f82a41e6d 100644 --- a/platform/macos/docs/pod-README.md +++ b/platform/macos/docs/pod-README.md @@ -1,8 +1,18 @@ # [Mapbox macOS SDK](https://github.com/mapbox/mapbox-gl-native/tree/master/platform/macos/) -The Mapbox macOS SDK is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.10.0 and above using Objective-C, Swift, Interface Builder, or AppleScript. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. +Put interactive, scalable world maps into your native Cocoa application with the open-source Mapbox macOS SDK. - +* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started. +* Customize every aspect of the map’s appearance in code or visually using [Mapbox Studio](https://www.mapbox.com/mapbox-studio/). +* High-performance OpenGL rendering and multitouch gestures keep your users happy. +* A well-designed, fully documented API helps you stay productive. +* Develop across [multiple platforms](https://www.mapbox.com/maps/), including [iOS](https://www.mapbox.com/ios-sdk/), using the same styles and similar APIs. + +The Mapbox macOS SDK is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/). + +![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/macos/docs/img/screenshot.jpg) + +Mapbox macOS SDK releases are [available on GitHub](https://github.com/mapbox/mapbox-gl-native/releases/) – look for the releases that begin with “macos-”. You can also integrate the Mapbox macOS SDK into your application using CocoaPods. ## Installation @@ -46,6 +56,6 @@ script AppDelegate end script ``` -Full API documentation is included in this package, within the `documentation` folder. The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/api/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. +Full API documentation is included in this package, within the `documentation` folder, and [online](https://mapbox.github.io/mapbox-gl-native/macos/). The [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/api/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox macOS SDK with few differences, mostly around unimplemented features like user location tracking. Mapbox does not officially support the macOS SDK to the same extent as the iOS SDK; however, [bug reports and pull requests](https://github.com/mapbox/mapbox-gl-native/issues/) are certainly welcome. diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml index 516d11b83..56f725563 100644 --- a/platform/macos/jazzy.yml +++ b/platform/macos/jazzy.yml @@ -2,6 +2,7 @@ module: Mapbox author: Mapbox author_url: https://www.mapbox.com/ github_url: https://github.com/mapbox/mapbox-gl-native +dash_url: https://mapbox.github.io/mapbox-gl-native/macos/docsets/Mapbox.xml copyright: '© 2014–2017 [Mapbox](https://www.mapbox.com/). See [license](https://github.com/mapbox/mapbox-gl-native/blob/master/LICENSE.md) for more details.' head: | diff --git a/platform/macos/screenshot.png b/platform/macos/screenshot.png deleted file mode 100644 index 3bf0c46ab..000000000 Binary files a/platform/macos/screenshot.png and /dev/null differ diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh index c13740174..d0c545f8f 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 <&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 1ca65540e..69c9aaa87 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}" +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 \ diff --git a/platform/macos/scripts/package.sh b/platform/macos/scripts/package.sh index 9cb38c6c7..f8c24a17f 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"