Skip to content

Commit e350942

Browse files
committed
Add --build-compiler option
1 parent 69800e6 commit e350942

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.github/workflows/pull_request.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ jobs:
2323
*.log
2424
2525
android-build:
26-
name: Build Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} SDK
26+
name: Build Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} SDK (build-compiler=${{ matrix.build-compiler }})
2727
strategy:
2828
fail-fast: false
2929
matrix:
3030
#build-type: ['docker']
3131
build-type: ['docker', 'local']
32+
build-compiler: ['0', '1']
3233
# blank arch builds all (aarch64,x86_64,armv7)
3334
#arch: ['']
3435
# builds only x86_64 to speed up the validation
@@ -53,6 +54,8 @@ jobs:
5354
# these variabes are used by build-docker and build-local
5455
# to determine which Swift version to build for
5556
echo "BUILD_SCHEME=${{ matrix.swift-version }}" >> $GITHUB_ENV
57+
# pass the build-compiler matrix through to the build script
58+
echo "BUILD_COMPILER=${{ matrix.build-compiler }}" >> $GITHUB_ENV
5659
echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
5760
echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
5861
- name: Checkout repository
@@ -99,6 +102,9 @@ jobs:
99102
if [[ "${{ matrix.build-type }}" == 'local' ]]; then
100103
ARTIFACT_NAME="${ARTIFACT_NAME}-local"
101104
fi
105+
if [[ "${{ matrix.build-compiler }}" == '1' ]]; then
106+
ARTIFACT_NAME="${ARTIFACT_NAME}-hostbuild"
107+
fi
102108
# artifacts need a unique name so we suffix with the matrix arch(s)
103109
if [[ ! -z "${{ matrix.arch }}" ]]; then
104110
ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"

swift-ci/sdks/android/build-docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ $DOCKER run -i --rm \
6262
--source-dir /source \
6363
--products-dir /products \
6464
--host-toolchain /usr/local/swift \
65+
--build-compiler ${BUILD_COMPILER} \
6566
--android-api ${ANDROID_API} \
6667
--ndk-home /usr/local/ndk/${ANDROID_NDK_VERSION} \
6768
--archs ${TARGET_ARCHS}

swift-ci/sdks/android/build-local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ mkdir -p ${WORKDIR}/products
5858
--source-dir ${WORKDIR}/source \
5959
--products-dir ${WORKDIR}/products \
6060
--build-dir ${WORKDIR}/build \
61+
--build-compiler ${BUILD_COMPILER} \
6162
--host-toolchain ${HOST_TOOLCHAIN} \
6263
--android-api ${ANDROID_API} \
6364
--ndk-home ${ANDROID_NDK_HOME} \

swift-ci/sdks/android/scripts/build.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Options:
6363
--source-dir <path> Specify the path in which the sources can be found.
6464
--ndk-home <path> Specify the path to the Android NDK
6565
--host-toolchain <tc> Specify the path to the host Swift toolchain
66+
--build-compiler <bc> Whether to build and validate the host compiler
6667
--products-dir <path> Specify the path in which the products should be written.
6768
--build-dir <path> Specify the path in which intermediates should be stored.
6869
--android-api <api> Specify the Android API level
@@ -130,6 +131,8 @@ while [ "$#" -gt 0 ]; do
130131
ndk_home="$2"; shift ;;
131132
--host-toolchain)
132133
host_toolchain="$2"; shift ;;
134+
--build-compiler)
135+
build_compiler="$2"; shift ;;
133136
--build-dir)
134137
build_dir="$2"; shift ;;
135138
--android-api)
@@ -378,21 +381,48 @@ for arch in $archs; do
378381
RelWithDebInfo) build_type_flag="--release-debuginfo" ;;
379382
esac
380383

384+
case $build_compiler in
385+
1|true|yes|YES)
386+
build_cmark=""
387+
local_build=""
388+
build_llvm="1"
389+
build_swift_tools="1"
390+
validation_test="1"
391+
native_swift_tools_path=""
392+
native_clang_tools_path=""
393+
;;
394+
*)
395+
build_cmark="--skip-build-cmark"
396+
local_build="--skip-local-build"
397+
build_llvm="0"
398+
build_swift_tools="0"
399+
validation_test="0"
400+
native_swift_tools_path="--native-swift-tools-path=$host_toolchain/bin"
401+
native_clang_tools_path="--native-clang-tools-path=$host_toolchain/bin"
402+
;;
403+
esac
404+
381405
# use an out-of-tree build folder, otherwise subsequent arch builds have conflicts
382406
export SWIFT_BUILD_ROOT=${build_dir}/$arch/swift-project
383407

384408
./swift/utils/build-script \
385409
$build_type_flag \
386410
--reconfigure \
387411
--no-assertions \
388-
--validation-test=1 \
412+
--validation-test=$validation_test \
389413
--android \
390414
--android-ndk=$ndk_home \
391415
--android-arch=$arch \
392416
--android-api-level=$android_api \
393417
--cross-compile-hosts=android-$arch \
394418
--cross-compile-deps-path=$sdk_root \
395419
--install-destdir=$sdk_root \
420+
--build-llvm=$build_llvm \
421+
--build-swift-tools=$build_swift_tools \
422+
${native_swift_tools_path} \
423+
${native_clang_tools_path} \
424+
${build_cmark} \
425+
${local_build} \
396426
--build-swift-static-stdlib \
397427
--install-swift \
398428
--install-libdispatch \

0 commit comments

Comments
 (0)