1ffe3c632Sopenharmony_ci#!/bin/bash
2ffe3c632Sopenharmony_ci
3ffe3c632Sopenharmony_ciset -ex
4ffe3c632Sopenharmony_ci
5ffe3c632Sopenharmony_ci# change to repo root
6ffe3c632Sopenharmony_cipushd $(dirname $0)/../../../..
7ffe3c632Sopenharmony_ci
8ffe3c632Sopenharmony_ci# Create stage dir
9ffe3c632Sopenharmony_ciORIGINAL_DIR=`pwd`
10ffe3c632Sopenharmony_cipushd ..
11ffe3c632Sopenharmony_cicp -R $ORIGINAL_DIR stage
12ffe3c632Sopenharmony_ciexport STAGE_DIR="`pwd`/stage"
13ffe3c632Sopenharmony_cipopd
14ffe3c632Sopenharmony_ci
15ffe3c632Sopenharmony_ciexport REPO_DIR=protobuf
16ffe3c632Sopenharmony_ciexport BUILD_VERSION=`grep -i "version" python/google/protobuf/__init__.py | grep -o "'.*'" | tr -d "'"`
17ffe3c632Sopenharmony_ciexport BUILD_COMMIT=`git rev-parse HEAD`
18ffe3c632Sopenharmony_ciexport PLAT=x86_64
19ffe3c632Sopenharmony_ciexport UNICODE_WIDTH=32
20ffe3c632Sopenharmony_ciexport MACOSX_DEPLOYMENT_TARGET=10.9
21ffe3c632Sopenharmony_ciexport TRAVIS_OS_NAME="osx"
22ffe3c632Sopenharmony_ci
23ffe3c632Sopenharmony_cirm -rf artifacts/
24ffe3c632Sopenharmony_cirm -rf multibuild/
25ffe3c632Sopenharmony_cimkdir artifacts
26ffe3c632Sopenharmony_ciexport ARTIFACT_DIR=$(pwd)/artifacts
27ffe3c632Sopenharmony_ci
28ffe3c632Sopenharmony_cigit clone https://github.com/matthew-brett/multibuild.git
29ffe3c632Sopenharmony_cicp kokoro/release/python/macos/config.sh config.sh
30ffe3c632Sopenharmony_ci
31ffe3c632Sopenharmony_ciOLD_PATH=$PATH
32ffe3c632Sopenharmony_ci
33ffe3c632Sopenharmony_cibuild_artifact_version() {
34ffe3c632Sopenharmony_ci  MB_PYTHON_VERSION=$1
35ffe3c632Sopenharmony_ci
36ffe3c632Sopenharmony_ci  # Clean up env
37ffe3c632Sopenharmony_ci  rm -rf venv
38ffe3c632Sopenharmony_ci  sudo rm -rf $REPO_DIR
39ffe3c632Sopenharmony_ci  cp -R $STAGE_DIR $REPO_DIR
40ffe3c632Sopenharmony_ci  export PATH=$OLD_PATH
41ffe3c632Sopenharmony_ci
42ffe3c632Sopenharmony_ci  source multibuild/common_utils.sh
43ffe3c632Sopenharmony_ci  source multibuild/travis_steps.sh
44ffe3c632Sopenharmony_ci  before_install
45ffe3c632Sopenharmony_ci
46ffe3c632Sopenharmony_ci  clean_code $REPO_DIR $BUILD_COMMIT
47ffe3c632Sopenharmony_ci
48ffe3c632Sopenharmony_ci  build_wheel $REPO_DIR/python $PLAT
49ffe3c632Sopenharmony_ci
50ffe3c632Sopenharmony_ci  mv wheelhouse/* $ARTIFACT_DIR
51ffe3c632Sopenharmony_ci}
52ffe3c632Sopenharmony_ci
53ffe3c632Sopenharmony_ciexport MB_PYTHON_OSX_VER=10.9
54ffe3c632Sopenharmony_cibuild_artifact_version 2.7
55ffe3c632Sopenharmony_cibuild_artifact_version 3.6
56ffe3c632Sopenharmony_cibuild_artifact_version 3.7
57ffe3c632Sopenharmony_cibuild_artifact_version 3.8
58ffe3c632Sopenharmony_ci
59ffe3c632Sopenharmony_ci# python OSX10.9 does not have python 3.5
60ffe3c632Sopenharmony_ciexport MB_PYTHON_OSX_VER=10.6
61ffe3c632Sopenharmony_cibuild_artifact_version 3.5
62ffe3c632Sopenharmony_ci
63