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_ci
18ffe3c632Sopenharmony_ciexport BUILD_COMMIT=`git rev-parse HEAD`
19ffe3c632Sopenharmony_ciexport PLAT=x86_64
20ffe3c632Sopenharmony_ciexport UNICODE_WIDTH=32
21ffe3c632Sopenharmony_ciexport MACOSX_DEPLOYMENT_TARGET=10.9
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/linux/config.sh config.sh
30ffe3c632Sopenharmony_ci
31ffe3c632Sopenharmony_cibuild_artifact_version() {
32ffe3c632Sopenharmony_ci  MB_PYTHON_VERSION=$1
33ffe3c632Sopenharmony_ci
34ffe3c632Sopenharmony_ci  # Clean up env
35ffe3c632Sopenharmony_ci  rm -rf venv
36ffe3c632Sopenharmony_ci  sudo rm -rf $REPO_DIR
37ffe3c632Sopenharmony_ci  cp -R $STAGE_DIR $REPO_DIR
38ffe3c632Sopenharmony_ci
39ffe3c632Sopenharmony_ci  source multibuild/common_utils.sh
40ffe3c632Sopenharmony_ci  source multibuild/travis_steps.sh
41ffe3c632Sopenharmony_ci  before_install
42ffe3c632Sopenharmony_ci
43ffe3c632Sopenharmony_ci  clean_code $REPO_DIR $BUILD_COMMIT
44ffe3c632Sopenharmony_ci  sed -i '/Wno-sign-compare/a \ \ \ \ \ \ \ \ extra_compile_args.append("-std=c++11")' $REPO_DIR/python/setup.py
45ffe3c632Sopenharmony_ci  cat $REPO_DIR/python/setup.py
46ffe3c632Sopenharmony_ci
47ffe3c632Sopenharmony_ci  build_wheel $REPO_DIR/python $PLAT
48ffe3c632Sopenharmony_ci
49ffe3c632Sopenharmony_ci  mv wheelhouse/* $ARTIFACT_DIR
50ffe3c632Sopenharmony_ci}
51ffe3c632Sopenharmony_ci
52ffe3c632Sopenharmony_cibuild_artifact_version 2.7
53ffe3c632Sopenharmony_cibuild_artifact_version 3.5
54ffe3c632Sopenharmony_cibuild_artifact_version 3.6
55ffe3c632Sopenharmony_cibuild_artifact_version 3.7
56ffe3c632Sopenharmony_cibuild_artifact_version 3.8
57