From f964e40e7e9220d08751d8607af61ac5a7c0794c Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sun, 3 Apr 2016 15:16:49 -0700 Subject: [build] Refactor and simplify build system * Main gyp files are now standardized as platform//platform.gyp. * Each platform gyp file defines appropriate loop_lib and headless_lib variables. * Each platform gyp file includes mbgl.gypi, which defines base targets which may be useful to all platforms. * CI targets are consistent across platforms: `make $(PLATFORM) && make test-$(PLATFORM)`. * Renamed the "linux" test app to "glfw". It's now built in OS X CI. * Android build flakiness is fixed. * iOS CI builds the bench and iosapp targets. * Mesa version is now in one place. * CI scripts use bash "strict mode" and correct error handling. * All build output goes to the build directory. * Removed vestigial iOS/OS X/Android Travis scripts. --- platform/android/.gitignore | 1 - platform/android/bitrise.yml | 53 +---- platform/android/mapboxgl-app.gypi | 148 ------------ platform/android/platform.gyp | 151 ++++++++++++ platform/android/scripts/defaults.mk | 11 - platform/android/scripts/install.sh | 13 - platform/android/scripts/run.sh | 56 ----- platform/ios/app/mapboxgl-app.gypi | 81 ------- platform/ios/benchmark/benchmark-ios.gypi | 78 ------ platform/ios/bitrise.yml | 9 +- platform/ios/framework/framework-ios.gypi | 71 ------ platform/ios/platform.gyp | 382 ++++++++++++++++++++++++++++++ platform/ios/scripts/after_failure.sh | 13 - platform/ios/scripts/defaults.mk | 9 - platform/ios/scripts/install.sh | 20 -- platform/ios/scripts/package.sh | 46 ++-- platform/ios/scripts/run.sh | 52 ---- platform/ios/scripts/setup.sh | 5 - platform/ios/scripts/test.sh | 7 - platform/linux/README.md | 7 +- platform/linux/main.cpp | 176 -------------- platform/linux/mapboxgl-app.gypi | 66 ------ platform/linux/platform.gyp | 97 ++++++++ platform/linux/scripts/after_script.sh | 10 +- platform/linux/scripts/coveralls.sh | 23 +- platform/linux/scripts/defaults.mk | 5 - platform/linux/scripts/install.sh | 11 - platform/linux/scripts/run.sh | 31 --- platform/linux/scripts/setup.sh | 28 --- platform/linux/scripts/tidy.sh | 17 -- platform/node/bitrise.yml | 21 +- platform/node/scripts/after_script.sh | 50 +--- platform/node/scripts/install.sh | 24 -- platform/node/scripts/run.sh | 15 -- platform/osx/app/mapboxgl-app.gypi | 77 ------ platform/osx/bitrise.yml | 12 +- platform/osx/platform.gyp | 328 +++++++++++++++++++++++++ platform/osx/scripts/configure.sh | 2 - platform/osx/scripts/defaults.mk | 5 - platform/osx/scripts/install.sh | 7 - platform/osx/scripts/osxsdk.xcscheme | 99 -------- platform/osx/scripts/osxtest.xcscheme | 56 +++++ platform/osx/scripts/package.sh | 56 ----- platform/osx/scripts/run.sh | 21 -- platform/osx/scripts/setup.sh | 8 - platform/osx/scripts/test.sh | 19 -- platform/osx/sdk/framework-osx.gypi | 68 ------ platform/osx/test/osxtest.gypi | 84 ------- 48 files changed, 1088 insertions(+), 1541 deletions(-) delete mode 100644 platform/android/mapboxgl-app.gypi create mode 100644 platform/android/platform.gyp delete mode 100644 platform/android/scripts/defaults.mk delete mode 100755 platform/android/scripts/install.sh delete mode 100755 platform/android/scripts/run.sh delete mode 100644 platform/ios/app/mapboxgl-app.gypi delete mode 100644 platform/ios/benchmark/benchmark-ios.gypi delete mode 100644 platform/ios/framework/framework-ios.gypi create mode 100644 platform/ios/platform.gyp delete mode 100755 platform/ios/scripts/after_failure.sh delete mode 100644 platform/ios/scripts/defaults.mk delete mode 100755 platform/ios/scripts/install.sh delete mode 100755 platform/ios/scripts/run.sh delete mode 100644 platform/ios/scripts/setup.sh delete mode 100755 platform/ios/scripts/test.sh delete mode 100644 platform/linux/main.cpp delete mode 100644 platform/linux/mapboxgl-app.gypi create mode 100644 platform/linux/platform.gyp delete mode 100644 platform/linux/scripts/defaults.mk delete mode 100755 platform/linux/scripts/install.sh delete mode 100755 platform/linux/scripts/run.sh delete mode 100755 platform/linux/scripts/setup.sh delete mode 100755 platform/linux/scripts/tidy.sh delete mode 100755 platform/node/scripts/install.sh delete mode 100755 platform/node/scripts/run.sh delete mode 100644 platform/osx/app/mapboxgl-app.gypi create mode 100644 platform/osx/platform.gyp delete mode 100644 platform/osx/scripts/defaults.mk delete mode 100755 platform/osx/scripts/install.sh delete mode 100644 platform/osx/scripts/osxsdk.xcscheme create mode 100644 platform/osx/scripts/osxtest.xcscheme delete mode 100755 platform/osx/scripts/package.sh delete mode 100755 platform/osx/scripts/run.sh delete mode 100755 platform/osx/scripts/setup.sh delete mode 100755 platform/osx/scripts/test.sh delete mode 100644 platform/osx/sdk/framework-osx.gypi delete mode 100644 platform/osx/test/osxtest.gypi (limited to 'platform') diff --git a/platform/android/.gitignore b/platform/android/.gitignore index 57cd31fea2..53e7540178 100644 --- a/platform/android/.gitignore +++ b/platform/android/.gitignore @@ -12,7 +12,6 @@ build/ # JNI MapboxGLAndroidSDK/src/main/jniLibs/ -MapboxGLAndroidSDK/src/main/obj.target/ # Lib assets MapboxGLAndroidSDK/src/main/assets/ diff --git a/platform/android/bitrise.yml b/platform/android/bitrise.yml index f67edac3d8..c1c4407bde 100644 --- a/platform/android/bitrise.yml +++ b/platform/android/bitrise.yml @@ -24,29 +24,15 @@ workflows: envman add --key SKIPCI --value false fi - script: - title: Install Linux Dependencies + title: Build + run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - + set -eu -o pipefail apt-get install -y pkg-config - - script: - title: Build Android SDK For arm - inputs: - - content: |- - #!/bin/bash - - make android -j4 - - is_debug: 'yes' - - script: - title: Run Unit Tests - inputs: - - content: |- - #!/bin/bash - - cd platform/android - ./gradlew testReleaseUnitTest --continue - - is_debug: 'yes' + make android + make test-android - slack: title: Post to Slack run_if: '{{enveq "SKIPCI" "false"}}' @@ -68,47 +54,24 @@ workflows: scheduled: steps: - script: - title: Install Linux Dependencies + title: Build inputs: - content: |- #!/bin/bash + set -eu -o pipefail apt-get install -y pkg-config python-pip python-dev build-essential pip install awscli - - script: - title: Fetch GPG Secring For SDK Signing - inputs: - - content: |- - #!/bin/bash aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/secring.gpg - opts: - is_expand: true - - script: - title: Inject Signing And Publishing Credentials - inputs: - - content: |- - #!/bin/bash echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD signing.keyId=$SIGNING_KEYID signing.password=$SIGNING_PASSWORD signing.secretKeyRingFile=secring.gpg" >> platform/android/MapboxGLAndroidSDK/gradle.properties - opts: - is_expand: true - - script: - title: Build Mapbox Android SDK For All ABI - inputs: - - content: |- - #!/bin/bash make apackage -j4 - - script: - title: Publish To Maven Central - inputs: - - content: |- - #!/bin/bash cd platform/android - ./gradlew uploadArchives \ No newline at end of file + ./gradlew uploadArchives diff --git a/platform/android/mapboxgl-app.gypi b/platform/android/mapboxgl-app.gypi deleted file mode 100644 index f9644c8d99..0000000000 --- a/platform/android/mapboxgl-app.gypi +++ /dev/null @@ -1,148 +0,0 @@ -{ - 'includes': [ - '../../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'android-lib', - 'product_name': 'mapbox-gl', - 'type': 'shared_library', - 'hard_dependency': 1, - - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - ], - - 'include_dirs': [ - '../src', - ], - - 'sources': [ - './src/native_map_view.cpp', - './src/jni.cpp', - './src/attach_env.cpp', - ], - - 'cflags_cc': [ - '<@(boost_cflags)', - '<@(variant_cflags)', - '<@(jni.hpp_cflags)', - ], - 'libraries': [ - '<@(libpng_static_libs)', - '<@(libjpeg-turbo_static_libs)', - '<@(sqlite_static_libs)', - '<@(nunicode_static_libs)', - '<@(libzip_static_libs)', - ], - 'variables': { - 'ldflags': [ - '-llog', - '-landroid', - '-lEGL', - '-lGLESv2', - '-lstdc++', - '-latomic', - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_ldflags)', - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - '<@(libzip_ldflags)', - ], - }, - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'libraries': [ '<@(ldflags)' ], - }] - ], - }, - - { 'target_name': 'example-custom-layer-lib', - 'product_name': 'example-custom-layer', - 'type': 'shared_library', - 'hard_dependency': 1, - - 'sources': [ - './src/example_custom_layer.cpp', - ], - - 'include_dirs': [ - '../../include', - ], - - 'variables': { - 'ldflags': [ - '-llog', - '-landroid', - '-lEGL', - '-lGLESv2', - '-lstdc++', - '-latomic', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'libraries': [ '<@(ldflags)' ], - }] - ], - }, - - { 'target_name': 'androidapp', - 'type': 'none', - 'hard_dependency': 1, - - 'dependencies': [ - 'android-lib', - 'example-custom-layer-lib', - ], - - 'variables': { - 'pwd': ' ./platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt - -mapbox_time "compile_library" \ -make android-lib HOST_VERSION=${ANDROID_ABI} -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "build_apk" \ -make android HOST_VERSION=${ANDROID_ABI} -j${JOBS} BUILDTYPE=${BUILDTYPE} - -################################################################################ -# Deploy -################################################################################ - -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - # Install and add awscli to PATH for uploading the results - mapbox_time "install_awscli" \ - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - - mapbox_time_start "deploy_results" - echo "Deploying results..." - - S3_PREFIX=s3://mapbox/mapbox-gl-native/android/build/${TRAVIS_JOB_NUMBER} - APK_OUTPUTS=./platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk - JNILIB=`mason env JNIDIR` - - # ARM64 does not build APK for now - if [ ${JNIDIR} != "arm64-v8a" ] ; then - # Upload either the debug or the release build - if [ ${BUILDTYPE} == "Debug" ] ; then - aws s3 cp \ - ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-${JNILIB}-debug.apk \ - ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-debug.apk - elif [ ${BUILDTYPE} == "Release" ] ; then - aws s3 cp \ - ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-${JNILIB}-release-unsigned.apk \ - ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-release-unsigned.apk - fi - fi - - mapbox_time_finish -fi diff --git a/platform/ios/app/mapboxgl-app.gypi b/platform/ios/app/mapboxgl-app.gypi deleted file mode 100644 index 864755829f..0000000000 --- a/platform/ios/app/mapboxgl-app.gypi +++ /dev/null @@ -1,81 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'iosapp', - 'product_name': 'Mapbox GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - ' /dev/null - -echo http://mapbox.s3.amazonaws.com/$REPO_NAME/ios/tests/$TRAVIS_JOB_NUMBER/index.html diff --git a/platform/ios/scripts/defaults.mk b/platform/ios/scripts/defaults.mk deleted file mode 100644 index 9debff4ce0..0000000000 --- a/platform/ios/scripts/defaults.mk +++ /dev/null @@ -1,9 +0,0 @@ -HEADLESS = eagl -PLATFORM ?= ios -ASSET ?= fs -HTTP ?= nsurl -LOOP ?= darwin - -HOST_VERSION = all - -PROVISIONING_PROFILE ?= 19324a54-7455-4f0b-8e1c-e6957c718ebc diff --git a/platform/ios/scripts/install.sh b/platform/ios/scripts/install.sh deleted file mode 100755 index 437193b1f2..0000000000 --- a/platform/ios/scripts/install.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -git fetch --tags - -mapbox_time "checkout_mason" \ -git submodule update --init .mason - -mapbox_time "install_recent_git" \ -brew install git - -mapbox_time "install_awscli" \ -brew install awscli - -mapbox_time "install_jazzy" \ -gem install jazzy - -mkdir -p ${KIF_SCREENSHOTS} diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index b0f63478df..02a454aaf7 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -72,12 +72,6 @@ echo ${HASH} echo ${HASH} >> ${VERSION} -step "Creating build files…" -export MASON_PLATFORM=ios -export BUILDTYPE=${BUILDTYPE:-Release} -export HOST=ios -make Xcode/ios - PROJ_VERSION=$(git rev-list --count HEAD) if [[ "${BUILD_FOR_DEVICE}" == true ]]; then @@ -91,13 +85,9 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then DEPLOYMENT_POSTPROCESSING=YES \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_IDENTITY= \ - -project ./build/ios-all/gyp/mbgl.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ - -target core \ - -target platform-ios \ - -target http-nsurl \ - -target asset-fs \ - -target headless-eagl \ + -target platform-lib \ -jobs ${JOBS} fi @@ -112,7 +102,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_IDENTITY= \ - -project ./build/ios-all/gyp/ios.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ -target iossdk \ -jobs ${JOBS} @@ -125,13 +115,9 @@ if [[ ${BUILD_STATIC} == true ]]; then ARCHS="x86_64 i386" \ ONLY_ACTIVE_ARCH=NO \ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - -project ./build/ios-all/gyp/mbgl.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ - -target core \ - -target platform-ios \ - -target http-nsurl \ - -target asset-fs \ - -target headless-eagl \ + -target platform-lib \ -jobs ${JOBS} fi @@ -143,13 +129,13 @@ if [[ ${BUILD_DYNAMIC} == true ]]; then GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ ENABLE_BITCODE=${ENABLE_BITCODE} \ CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ - -project ./build/ios-all/gyp/ios.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ -target iossdk \ -jobs ${JOBS} fi -LIBS=(core.a platform-ios.a asset-fs.a http-nsurl.a) +LIBS=(core.a platform-ios.a) # https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c if [[ "${BUILD_FOR_DEVICE}" == true ]]; then @@ -159,22 +145,22 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphoneos/libmbgl-} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphoneos/libmbgl-} \ + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphonesimulator/libmbgl-} fi if [[ ${BUILD_DYNAMIC} == true ]]; then step "Copying dynamic framework into place for iOS devices" cp -r \ - gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework \ + build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework \ ${OUTPUT}/dynamic/ - cp -r gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ + cp -r build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ ${OUTPUT}/dynamic/ step "Merging simulator dynamic library into device dynamic library…" lipo \ - gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ - gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ + build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ + build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ -create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo fi else @@ -184,15 +170,15 @@ else libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphonesimulator/libmbgl-} fi if [[ ${BUILD_DYNAMIC} == true ]]; then step "Copying dynamic framework into place for iOS Simulator…" cp -r \ - gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ + build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ ${OUTPUT}/dynamic/${NAME}.framework - cp -r gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ + cp -r build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ ${OUTPUT}/dynamic/ fi fi diff --git a/platform/ios/scripts/run.sh b/platform/ios/scripts/run.sh deleted file mode 100755 index 44c21e7562..0000000000 --- a/platform/ios/scripts/run.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -source ./platform/ios/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -PUBLISH_TAG=($(git show -s --format=%B | sed -n 's/.*\[publish \([a-z]\{1,\}\)-v\([0-9a-z.\-]\{1,\}\)\].*/\1 \2/p')) -PUBLISH_PLATFORM=${PUBLISH_TAG[0],-} -PUBLISH_VERSION=${PUBLISH_TAG[1],-} - - -################################################################################ -# Build -################################################################################ - -if [[ ${PUBLISH_PLATFORM} = 'ios' ]]; then - # default, with debug symbols - mapbox_time "package_ios_symbols" \ - make ipackage - - mapbox_time "deploy_ios_symbols" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" symbols - - # no debug symbols, for smaller distribution - mapbox_time "package_ios_stripped" \ - make ipackage-strip - - mapbox_time "deploy_ios_stripped" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" - - # dynamic, with debug symbols - mapbox_time "package_ios_dynamic" \ - make iframework - - mapbox_time "deploy_ios_dynamic" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" symbols-dynamic - - # dynamic, without debug symbols - mapbox_time "package_ios_dynamic_stripped" \ - make iframework SYMBOLS=NO - - mapbox_time "deploy_ios_dynamic_stripped" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" dynamic -else - # build & test iOS - mapbox_time "run_ios_tests" \ - make itest -fi diff --git a/platform/ios/scripts/setup.sh b/platform/ios/scripts/setup.sh deleted file mode 100644 index d115cf9020..0000000000 --- a/platform/ios/scripts/setup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" diff --git a/platform/ios/scripts/test.sh b/platform/ios/scripts/test.sh deleted file mode 100755 index a2515e6fea..0000000000 --- a/platform/ios/scripts/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -# No tests for now. KIF tests are too unreliable. diff --git a/platform/linux/README.md b/platform/linux/README.md index 55f3e71dba..910edcb9a6 100644 --- a/platform/linux/README.md +++ b/platform/linux/README.md @@ -33,14 +33,13 @@ Set the environment variable `MAPBOX_ACCESS_TOKEN` to your [Mapbox access token] export MAPBOX_ACCESS_TOKEN=MYTOKEN -Then, you can then proceed to build the library: +Then, you can then proceed to build the test application: - git submodule update --init - make linux + make glfw-app Set an access token as described below, and then run: - make run-linux + make run-glfw-app ### Test diff --git a/platform/linux/main.cpp b/platform/linux/main.cpp deleted file mode 100644 index 98fb32075e..0000000000 --- a/platform/linux/main.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace { - -std::unique_ptr view; - -} - -void quit_handler(int) { - if (view) { - mbgl::Log::Info(mbgl::Event::Setup, "waiting for quit..."); - view->setShouldClose(); - } else { - exit(0); - } -} - -int main(int argc, char *argv[]) { - bool fullscreen = false; - bool benchmark = false; - std::string style; - double latitude = 0, longitude = 0; - double bearing = 0, zoom = 1, pitch = 0; - bool skipConfig = false; - - const struct option long_options[] = { - {"fullscreen", no_argument, 0, 'f'}, - {"benchmark", no_argument, 0, 'b'}, - {"style", required_argument, 0, 's'}, - {"lon", required_argument, 0, 'x'}, - {"lat", required_argument, 0, 'y'}, - {"zoom", required_argument, 0, 'z'}, - {"bearing", required_argument, 0, 'r'}, - {"pitch", required_argument, 0, 'p'}, - {0, 0, 0, 0} - }; - - while (true) { - int option_index = 0; - int opt = getopt_long(argc, argv, "fbs:", long_options, &option_index); - if (opt == -1) break; - switch (opt) - { - case 0: - if (long_options[option_index].flag != 0) - break; - case 'f': - fullscreen = true; - break; - case 'b': - benchmark = true; - break; - case 's': - style = std::string("asset://") + std::string(optarg); - break; - case 'x': - longitude = atof(optarg); - skipConfig = true; - break; - case 'y': - latitude = atof(optarg); - skipConfig = true; - break; - case 'z': - zoom = atof(optarg); - skipConfig = true; - break; - case 'r': - bearing = atof(optarg); - skipConfig = true; - break; - case 'p': - pitch = atof(optarg); - skipConfig = true; - break; - default: - break; - } - - } - - // sigint handling - struct sigaction sigIntHandler; - sigIntHandler.sa_handler = quit_handler; - sigemptyset(&sigIntHandler.sa_mask); - sigIntHandler.sa_flags = 0; - sigaction(SIGINT, &sigIntHandler, NULL); - - if (benchmark) { - mbgl::Log::Info(mbgl::Event::General, "BENCHMARK MODE: Some optimizations are disabled."); - } - - view = std::make_unique(fullscreen, benchmark); - - mbgl::DefaultFileSource fileSource("/tmp/mbgl-cache.db", "."); - - // Set access token if present - const char *token = getenv("MAPBOX_ACCESS_TOKEN"); - if (token == nullptr) { - mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); - } else { - fileSource.setAccessToken(std::string(token)); - } - - mbgl::Map map(*view, fileSource); - - // Load settings - mbgl::Settings_JSON settings; - - if (skipConfig) { - map.setLatLngZoom(mbgl::LatLng(latitude, longitude), zoom); - map.setBearing(bearing); - map.setPitch(pitch); - mbgl::Log::Info(mbgl::Event::General, "Location: %f/%f (z%.2f, %.2f deg)", latitude, longitude, zoom, bearing); - } else { - map.setLatLngZoom(mbgl::LatLng(settings.latitude, settings.longitude), settings.zoom); - map.setBearing(settings.bearing); - map.setPitch(settings.pitch); - map.setDebug(mbgl::MapDebugOptions(settings.debug)); - } - - view->setChangeStyleCallback([&map] () { - static uint8_t currentStyleIndex; - - if (++currentStyleIndex == mbgl::util::default_styles::numOrderedStyles) { - currentStyleIndex = 0; - } - - mbgl::util::default_styles::DefaultStyle newStyle = mbgl::util::default_styles::orderedStyles[currentStyleIndex]; - map.setStyleURL(newStyle.url); - view->setWindowTitle(newStyle.name); - - mbgl::Log::Info(mbgl::Event::Setup, "Changed style to: %s", newStyle.name); - }); - - // Load style - if (style.empty()) { - mbgl::util::default_styles::DefaultStyle newStyle = mbgl::util::default_styles::orderedStyles[0]; - style = newStyle.url; - view->setWindowTitle(newStyle.name); - } - - map.setStyleURL(style); - - view->run(); - - // Save settings - mbgl::LatLng latLng = map.getLatLng(); - settings.latitude = latLng.latitude; - settings.longitude = latLng.longitude; - settings.zoom = map.getZoom(); - settings.bearing = map.getBearing(); - settings.pitch = map.getPitch(); - settings.debug = mbgl::EnumType(map.getDebug()); - if (!skipConfig) { - settings.save(); - } - mbgl::Log::Info(mbgl::Event::General, - "Exit location: --lat=\"%f\" --lon=\"%f\" --zoom=\"%f\" --bearing \"%f\"", - settings.latitude, settings.longitude, settings.zoom, settings.bearing); - - return 0; -} diff --git a/platform/linux/mapboxgl-app.gypi b/platform/linux/mapboxgl-app.gypi deleted file mode 100644 index 533f0b85d2..0000000000 --- a/platform/linux/mapboxgl-app.gypi +++ /dev/null @@ -1,66 +0,0 @@ -{ - 'includes': [ - '../../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'linuxapp', - 'product_name': 'mapbox-gl', - 'type': 'executable', - - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - 'mbgl.gyp:copy_certificate_bundle', - ], - - 'sources': [ - 'main.cpp', - '../default/settings_json.cpp', - '../default/glfw_view.hpp', - '../default/glfw_view.cpp', - '../default/log_stderr.cpp', - ], - - 'variables' : { - 'cflags_cc': [ - '<@(opengl_cflags)', - '<@(boost_cflags)', - '<@(glfw_cflags)', - '<@(variant_cflags)', - ], - 'ldflags': [ - '<@(glfw_ldflags)', - ], - 'libraries': [ - '<@(glfw_static_libs)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS':'macosx', - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'MACOSX_DEPLOYMENT_TARGET': '10.10', - }, - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }] - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - }, - ], -} diff --git a/platform/linux/platform.gyp b/platform/linux/platform.gyp new file mode 100644 index 0000000000..0adbd2a2e6 --- /dev/null +++ b/platform/linux/platform.gyp @@ -0,0 +1,97 @@ +{ + 'variables': { + 'loop_lib': 'uv', + 'headless_lib': 'glx', + }, + 'conditions': [ + ['OS == "mac"', { + 'variables': { + 'headless_lib': 'cgl', + } + }], + ], + 'includes': [ + '../../mbgl.gypi', + '../../test/test.gypi', + '../../bin/glfw.gypi', + '../../bin/render.gypi', + '../../bin/offline.gypi', + ], + 'targets': [ + { + 'target_name': 'platform-lib', + 'product_name': 'mbgl-platform-linux', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + 'dependencies': [ + 'core', + ], + + 'include_dirs': [ + '../default', + '../../include', + '../../src', # TODO: eliminate + ], + + 'sources': [ + '../default/log_stderr.cpp', + '../default/string_stdlib.cpp', + '../default/thread.cpp', + '../default/image.cpp', + '../default/webp_reader.cpp', + '../default/png_reader.cpp', + '../default/jpeg_reader.cpp', + '../default/asset_file_source.cpp', + '../default/http_request_curl.cpp', + '../default/default_file_source.cpp', + '../default/online_file_source.cpp', + '../default/mbgl/storage/offline.hpp', + '../default/mbgl/storage/offline.cpp', + '../default/mbgl/storage/offline_database.hpp', + '../default/mbgl/storage/offline_database.cpp', + '../default/mbgl/storage/offline_download.hpp', + '../default/mbgl/storage/offline_download.cpp', + '../default/sqlite3.hpp', + '../default/sqlite3.cpp', + ], + + 'cflags_cc': [ + '<@(boost_cflags)', + '<@(nunicode_cflags)', + '<@(sqlite_cflags)', + '<@(rapidjson_cflags)', + '<@(variant_cflags)', + '<@(libcurl_cflags)', + '<@(libpng_cflags)', + '<@(libjpeg-turbo_cflags)', + '<@(webp_cflags)', + ], + + 'link_settings': { + 'libraries': [ + '<@(nunicode_ldflags)', + '<@(nunicode_static_libs)', + '<@(sqlite_ldflags)', + '<@(sqlite_static_libs)', + '<@(zlib_ldflags)', + '<@(zlib_static_libs)', + '<@(libcurl_ldflags)', + '<@(libcurl_static_libs)', + '<@(libpng_ldflags)', + '<@(libpng_static_libs)', + '<@(libjpeg-turbo_ldflags)', + '<@(libjpeg-turbo_static_libs)', + '<@(webp_ldflags)', + '<@(webp_static_libs)', + ], + }, + + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + }, + }, + ], +} diff --git a/platform/linux/scripts/after_script.sh b/platform/linux/scripts/after_script.sh index b5397f1df2..4989f0c444 100755 --- a/platform/linux/scripts/after_script.sh +++ b/platform/linux/scripts/after_script.sh @@ -3,13 +3,9 @@ set -e set -o pipefail -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - # Install and add awscli to PATH for uploading the results - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - - REPO_NAME=$(basename $TRAVIS_REPO_SLUG) +JOB=$1 +if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then aws s3 cp --recursive --acl public-read --exclude "*" --include "*/actual.png" test/fixtures \ - s3://mapbox/$REPO_NAME/render-tests/$TRAVIS_JOB_NUMBER + s3://mapbox/mapbox-gl-native/render-tests/$JOB fi diff --git a/platform/linux/scripts/coveralls.sh b/platform/linux/scripts/coveralls.sh index 468fa4774b..1d8d9f060a 100755 --- a/platform/linux/scripts/coveralls.sh +++ b/platform/linux/scripts/coveralls.sh @@ -3,11 +3,22 @@ set -e set -o pipefail -source ./platform/linux/scripts/setup.sh +mapbox_time "install_lcov" \ +mason install lcov 1.12 -################################################################################ -# Coveralls -################################################################################ +# Collect coverage data and save it into coverage.info +mapbox_time "lcov_capture" \ +`mason prefix lcov 1.12`/usr/bin/lcov \ + --quiet \ + --capture \ + --no-external \ + --gcov-tool "gcov-4.9" \ + --directory "src/mbgl" \ + --directory "platform" \ + --directory "include/mbgl" \ + --directory "build/linux-x86_64/${BUILDTYPE}" \ + --base-directory "build/linux-x86_64/${BUILDTYPE}" \ + --output-file "build/linux-x86_64/${BUILDTYPE}/coverage.info" -mapbox_time "make_coveralls" \ -make coveralls -j${JOBS} +mapbox_time "coveralls_upload" \ +coveralls-lcov "build/linux-x86_64/${BUILDTYPE}/coverage.info" diff --git a/platform/linux/scripts/defaults.mk b/platform/linux/scripts/defaults.mk deleted file mode 100644 index 80f1346533..0000000000 --- a/platform/linux/scripts/defaults.mk +++ /dev/null @@ -1,5 +0,0 @@ -HEADLESS ?= glx -PLATFORM ?= linux -ASSET ?= fs -HTTP ?= curl -LOOP ?= uv diff --git a/platform/linux/scripts/install.sh b/platform/linux/scripts/install.sh deleted file mode 100755 index a254d312ec..0000000000 --- a/platform/linux/scripts/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mapbox_time "checkout_mason" \ -git submodule update --init .mason - -PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" \ -mapbox_time "install_mesa" \ -mason install mesa 10.4.3 diff --git a/platform/linux/scripts/run.sh b/platform/linux/scripts/run.sh deleted file mode 100755 index 1c0c13968a..0000000000 --- a/platform/linux/scripts/run.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/linux/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -################################################################################ -# Build -################################################################################ - -mapbox_time "compile_program" \ -make linux -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_render_binary" \ -make render -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_offline_binary" \ -make offline -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_tests" \ -make test -j${JOBS} BUILDTYPE=${BUILDTYPE} - -################################################################################ -# Test -################################################################################ - -mapbox_time "run_tests" \ -make test-* BUILDTYPE=${BUILDTYPE} diff --git a/platform/linux/scripts/setup.sh b/platform/linux/scripts/setup.sh deleted file mode 100755 index af0eafb5cf..0000000000 --- a/platform/linux/scripts/setup.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -# Set the core file limit to unlimited so a core file is generated upon crash -ulimit -c unlimited -S - -################################################################################ -# X Server setup -################################################################################ - -# Start the mock X server -if [ -f /etc/init.d/xvfb ] ; then - mapbox_time "start_xvfb" \ - sh -e /etc/init.d/xvfb start - sleep 2 # sometimes, xvfb takes some time to start up -fi - -# Make sure we're connecting to xvfb -export DISPLAY=:99.0 - -# Make sure we're loading the 10.4.3 libs we installed manually -export LD_LIBRARY_PATH="`mason prefix mesa 10.4.3`/lib:${LD_LIBRARY_PATH:-}" - -mapbox_time "glxinfo" \ -glxinfo diff --git a/platform/linux/scripts/tidy.sh b/platform/linux/scripts/tidy.sh deleted file mode 100755 index 424c82c3cd..0000000000 --- a/platform/linux/scripts/tidy.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -BUILDTYPE=${BUILDTYPE:-Release} - -export CLANG_TIDY=clang-tidy-3.8 - -mapbox_time "config" \ -make config - -mapbox_time "tidy" \ -make tidy diff --git a/platform/node/bitrise.yml b/platform/node/bitrise.yml index 9b9b4ca064..0b09192ee3 100644 --- a/platform/node/bitrise.yml +++ b/platform/node/bitrise.yml @@ -22,25 +22,20 @@ workflows: else envman add --key SKIPCI --value false fi - - select-xcode-version: - title: Select Xcode version - run_if: '{{enveq "SKIPCI" "false"}}' - script: title: Run build script run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - export TRAVIS_OS_NAME=osx - export TRAVIS_TAG=$BITRISE_GIT_TAG - export TRAVIS_JOB_NUMBER=$BITRISE_BUILD_NUMBER - export NODE_VERSION=4 - export CXX=clang++ - export CC=clang - source ./scripts/set_compiler.sh - ./platform/node/scripts/install.sh - ./platform/node/scripts/run.sh - ./platform/node/scripts/after_script.sh + set -eu -o pipefail + brew unlink node + brew install awscli homebrew/versions/node4-lts + brew link homebrew/versions/node4-lts + make node + make test-node || result=$? + ./platform/node/scripts/after_script.sh ${BITRISE_BUILD_NUMBER} ${BITRISE_GIT_TAG:-} + exit ${result:-0} - slack: title: Post to Slack run_if: '{{enveq "SKIPCI" "false"}}' diff --git a/platform/node/scripts/after_script.sh b/platform/node/scripts/after_script.sh index ae8480e02a..905055ad11 100755 --- a/platform/node/scripts/after_script.sh +++ b/platform/node/scripts/after_script.sh @@ -3,50 +3,20 @@ set -e set -o pipefail -# Inspect binary. -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - ldd ./lib/mapbox-gl-native.node -else - otool -L ./lib/mapbox-gl-native.node -fi +JOB=$1 +TAG=$2 -PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") +if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then + gzip --stdout node_modules/mapbox-gl-test-suite/render-tests/index.html | \ + aws s3 cp --acl public-read --content-encoding gzip --content-type text/html \ + - s3://mapbox/mapbox-gl-native/render-tests/$JOB/index.html -if [[ ${TRAVIS_TAG} == node-v${PACKAGE_JSON_VERSION} ]]; then - source ~/.nvm/nvm.sh - nvm use $NODE_VERSION + echo http://mapbox.s3.amazonaws.com/mapbox-gl-native/render-tests/$JOB/index.html +fi - npm install aws-sdk +PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") +if [[ $TAG == node-v${PACKAGE_JSON_VERSION} ]]; then ./node_modules/.bin/node-pre-gyp package - - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - ./node_modules/.bin/node-pre-gyp testpackage - fi - ./node_modules/.bin/node-pre-gyp publish info - - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - source ./platform/linux/scripts/setup.sh - - rm -rf build - rm -rf lib - npm install --fallback-to-build=false - npm test - fi -fi - -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - else - brew install awscli - fi - - gzip --stdout node_modules/mapbox-gl-test-suite/render-tests/index.html | \ - aws s3 cp --acl public-read --content-encoding gzip --content-type text/html \ - - s3://mapbox/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER/index.html - - echo http://mapbox.s3.amazonaws.com/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER/index.html fi diff --git a/platform/node/scripts/install.sh b/platform/node/scripts/install.sh deleted file mode 100755 index b550933cd9..0000000000 --- a/platform/node/scripts/install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -git submodule update --init .mason - -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -if [ ${TRAVIS_OS_NAME} == "linux" ]; then - mason install mesa 10.4.3 -fi - -if [ ! -d ~/.nvm ]; then - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash -fi - -source ~/.nvm/nvm.sh - -nvm install $NODE_VERSION -nvm alias default $NODE_VERSION - -node --version -npm --version diff --git a/platform/node/scripts/run.sh b/platform/node/scripts/run.sh deleted file mode 100755 index 73578b110a..0000000000 --- a/platform/node/scripts/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/${TRAVIS_OS_NAME}/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -source ~/.nvm/nvm.sh -nvm use $NODE_VERSION -npm install --build-from-source - -npm test -npm run test-suite diff --git a/platform/osx/app/mapboxgl-app.gypi b/platform/osx/app/mapboxgl-app.gypi deleted file mode 100644 index 8b8cc17276..0000000000 --- a/platform/osx/app/mapboxgl-app.gypi +++ /dev/null @@ -1,77 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'osxapp', - 'product_name': 'Mapbox GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - 'Credits.rtf', - 'Icon.icns', - 'MainMenu.xib', - 'MapDocument.xib', - ], - - 'dependencies': [ - 'osxsdk', - ], - - 'sources': [ - './AppDelegate.h', - './AppDelegate.m', - './DroppedPinAnnotation.h', - './DroppedPinAnnotation.m', - './LocationCoordinate2DTransformer.h', - './LocationCoordinate2DTransformer.m', - './MapDocument.h', - './MapDocument.m', - './OfflinePackNameValueTransformer.h', - './OfflinePackNameValueTransformer.m', - './TimeIntervalTransformer.h', - './TimeIntervalTransformer.m', - './NSValue+Additions.h', - './NSValue+Additions.m', - './main.m', - ], - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'INFOPLIST_FILE': '../platform/osx/app/Info.plist', - 'LD_RUNPATH_SEARCH_PATHS': [ - '\${inherited}', - '@executable_path/../Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS': 'macosx', - }, - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'YES', - }, - }, - }, - - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/${FRAMEWORKS_FOLDER_PATH}', - 'files': [ - '<(PRODUCT_DIR)/Mapbox.framework', - ], - 'xcode_code_sign': 1, - } - ], - }, - ] -} diff --git a/platform/osx/bitrise.yml b/platform/osx/bitrise.yml index 70fe9041bf..7170fa3f66 100644 --- a/platform/osx/bitrise.yml +++ b/platform/osx/bitrise.yml @@ -1,11 +1,6 @@ format_version: 1.1.0 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git -app: - envs: - - BITRISE_APP_TITLE: "Mapbox GL – OS X" - - BITRISE_DEV_BRANCH: "master" - trigger_map: - pattern: "*" is_pull_request_allowed: true @@ -28,12 +23,15 @@ workflows: envman add --key SKIPCI --value false fi - script: - title: Run SDK unit tests + title: Run build script run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - make xctest BUILDTYPE=Debug + set -eu -o pipefail + export BUILDTYPE=Debug + make osx + make test-osx - is_debug: 'yes' - slack: title: Post to Slack diff --git a/platform/osx/platform.gyp b/platform/osx/platform.gyp new file mode 100644 index 0000000000..120e5c592d --- /dev/null +++ b/platform/osx/platform.gyp @@ -0,0 +1,328 @@ +{ + 'variables': { + 'loop_lib': 'darwin', + 'headless_lib': 'cgl', + }, + 'xcode_settings': { + # Force all build output to the build directory. Must + # be an absolute path or xcodebuild will ignore it. + 'SYMROOT': ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform/osx/scripts/osxtest.xcscheme b/platform/osx/scripts/osxtest.xcscheme new file mode 100644 index 0000000000..dbc0577df8 --- /dev/null +++ b/platform/osx/scripts/osxtest.xcscheme @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/osx/scripts/package.sh b/platform/osx/scripts/package.sh deleted file mode 100755 index f4b2d0c899..0000000000 --- a/platform/osx/scripts/package.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -NAME=Mapbox -OUTPUT=build/osx/pkg -OSX_SDK_VERSION=`xcrun --sdk macosx --show-sdk-version` - -if [[ ${#} -eq 0 ]]; then # e.g. "make xpackage" - BUILDTYPE="Release" - GCC_GENERATE_DEBUGGING_SYMBOLS="YES" -else # e.g. "make xpackage-strip" - BUILDTYPE="Release" - GCC_GENERATE_DEBUGGING_SYMBOLS="NO" -fi - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -step "Creating build files..." -export MASON_PLATFORM=osx -export BUILDTYPE=${BUILDTYPE:-Release} -export HOST=osx -make Xcode/osx - -VERSION=${TRAVIS_JOB_NUMBER:-${BITRISE_BUILD_NUMBER:-0}} - -step "Building OS X framework (build ${VERSION})..." -xcodebuild -sdk macosx${OSX_SDK_VERSION} \ - ARCHS="x86_64" \ - ONLY_ACTIVE_ARCH=NO \ - GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - CURRENT_PROJECT_VERSION=${VERSION} \ - -project ./build/osx-x86_64/gyp/osx.xcodeproj \ - -configuration ${BUILDTYPE} \ - -target osxsdk \ - -jobs ${JOBS} - -TARGET_BUILD_DIR=gyp/build/${BUILDTYPE} -INFOPLIST_PATH=Mapbox.framework/Versions/Current/Resources/Info.plist - -# Uncomment when we're ready to release an official version. -#VERSION=$( git tag | grep ^osx | sed 's/^osx-//' | sort -r | grep -v '\-rc.' | grep -v '\-pre.' | sed -n '1p' | sed 's/^v//' ) -#if [ "$VERSION" ]; then -# plutil \ -# -replace CFBundleShortVersionString -string ${VERSION} \ -# $TARGET_BUILD_DIR/$INFOPLIST_PATH -# plutil \ -# -replace CFBundleVersion -string ${VERSION} \ -# $TARGET_BUILD_DIR/$INFOPLIST_PATH -#fi - -echo $TARGET_BUILD_DIR/Mapbox.framework diff --git a/platform/osx/scripts/run.sh b/platform/osx/scripts/run.sh deleted file mode 100755 index 6d00d1b977..0000000000 --- a/platform/osx/scripts/run.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/osx/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -################################################################################ -# Build -################################################################################ - -mapbox_time "compile_render_binary" \ -make render -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_offline_binary" \ -make offline -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_tests" \ -make xtest -j${JOBS} BUILDTYPE=${BUILDTYPE} diff --git a/platform/osx/scripts/setup.sh b/platform/osx/scripts/setup.sh deleted file mode 100755 index 502d61d44d..0000000000 --- a/platform/osx/scripts/setup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -# Set the core file limit to unlimited so a core file is generated upon crash -ulimit -c unlimited -S diff --git a/platform/osx/scripts/test.sh b/platform/osx/scripts/test.sh deleted file mode 100755 index f72895d850..0000000000 --- a/platform/osx/scripts/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -OSX_SDK_VERSION=`xcrun --sdk macosx --show-sdk-version` -OSX_PROJ_PATH=./build/osx-x86_64/gyp/osx.xcodeproj - -export BUILDTYPE=${BUILDTYPE:-Release} - -mkdir -p "${OSX_PROJ_PATH}/xcshareddata/xcschemes" -cp platform/osx/scripts/osxsdk.xcscheme "${OSX_PROJ_PATH}/xcshareddata/xcschemes/osxsdk.xcscheme" - -xcodebuild -verbose \ - -sdk macosx${OSX_SDK_VERSION} \ - -project "${OSX_PROJ_PATH}" \ - -scheme osxsdk \ - test diff --git a/platform/osx/sdk/framework-osx.gypi b/platform/osx/sdk/framework-osx.gypi deleted file mode 100644 index 259066f702..0000000000 --- a/platform/osx/sdk/framework-osx.gypi +++ /dev/null @@ -1,68 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'osxsdk', - 'product_name': 'Mapbox', - 'type': 'shared_library', - 'mac_bundle': 1, - - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - ], - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CURRENT_PROJECT_VERSION': '0', - 'DEFINES_MODULE': 'YES', - 'DYLIB_INSTALL_NAME_BASE': '@rpath', - 'INFOPLIST_FILE': '../platform/osx/sdk/Info.plist', - 'LD_RUNPATH_SEARCH_PATHS': [ - '${inherited}', - '@executable_path/../Frameworks', - '@loader_path/Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', - 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], - 'SDKROOT': 'macosx', - 'SKIP_INSTALL': 'YES', - 'SUPPORTED_PLATFORMS':'macosx', - 'VERSIONING_SYSTEM': 'apple-generic', - }, - - 'mac_framework_headers': [ - './Mapbox.h', - '