@@ -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