diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ad586a0d..82aaff59 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -28,14 +28,22 @@ jobs: fail-fast: false matrix: include: + #- swift-version: 'swift-6.2-branch' + # build-type: 'docker' + # build-compiler: '1' + # runner: 'self-hosted' + #- swift-version: 'development' + # build-type: 'docker' + # build-compiler: '1' + # runner: 'self-hosted' - swift-version: 'swift-6.2-branch' build-type: 'docker' - build-compiler: '1' - runner: 'self-hosted' + build-compiler: '0' + runner: 'ubuntu-24.04' - swift-version: 'development' build-type: 'docker' - build-compiler: '1' - runner: 'self-hosted' + build-compiler: '0' + runner: 'ubuntu-24.04' - swift-version: 'swift-6.2-branch' build-type: 'docker' build-compiler: '0' diff --git a/swift-ci/sdks/android/Dockerfile b/swift-ci/sdks/android/Dockerfile index 8708586a..deec9fd6 100644 --- a/swift-ci/sdks/android/Dockerfile +++ b/swift-ci/sdks/android/Dockerfile @@ -85,3 +85,4 @@ RUN groupadd -g 998 build-user && \ USER build-user WORKDIR /home/build-user + diff --git a/swift-ci/sdks/android/build-docker b/swift-ci/sdks/android/build-docker index 8d1a8c4c..802adf27 100755 --- a/swift-ci/sdks/android/build-docker +++ b/swift-ci/sdks/android/build-docker @@ -12,6 +12,9 @@ TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7} ANDROID_NDK_VERSION=android-ndk-r27c ANDROID_API=28 +BASEPATH=$(dirname $(realpath $0)) +cd ${BASEPATH} + export BUILD_SCHEME=${1} # note that WORKDIR must not be under the current checkout or the patches will fail to apply WORKDIR=${2} @@ -27,13 +30,13 @@ source ./scripts/toolchain-vars.sh # Check-out and patch the sources if [[ "${BUILD_COMPILER}" != "1" ]]; then -./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG} -else -if [[ "${BUILD_SCHEME}" == "development" ]]; then -./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme main + ./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-tag ${SWIFT_TAG} else -./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme release/6.2 -fi + if [[ "${BUILD_SCHEME}" == "development" ]]; then + ./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme main + else + ./scripts/fetch-source.sh --source-dir ${WORKDIR}/source --swift-scheme release/6.2 + fi fi ./patches/apply-patches.sh ${WORKDIR}/source/swift-project @@ -44,19 +47,6 @@ if [[ "$DOCKER" == "" ]]; then DOCKER=docker fi -case $(arch) in - arm64|aarch64) - OS_ARCH_SUFFIX=-aarch64 - ;; - amd64|x86_64) - OS_ARCH_SUFFIX= - ;; - *) - echo "Unknown architecture $(arch)" - exit 1 - ;; -esac - CONTAINER_NAME="swift-android" # Build the Docker image diff --git a/swift-ci/sdks/android/build-local b/swift-ci/sdks/android/build-local index 31eaf1e3..2888ba6c 100755 --- a/swift-ci/sdks/android/build-local +++ b/swift-ci/sdks/android/build-local @@ -12,6 +12,9 @@ TARGET_ARCHS=${TARGET_ARCHS:-aarch64,x86_64,armv7} ANDROID_NDK_VERSION=android-ndk-r27c ANDROID_API=28 +BASEPATH=$(dirname $(realpath $0)) +cd ${BASEPATH} + export BUILD_SCHEME=${1} # note that WORKDIR must not be under the current checkout or the patches will fail to apply WORKDIR=${2} diff --git a/swift-ci/sdks/android/scripts/build.sh b/swift-ci/sdks/android/scripts/build.sh index b388f025..c28fa68f 100755 --- a/swift-ci/sdks/android/scripts/build.sh +++ b/swift-ci/sdks/android/scripts/build.sh @@ -188,8 +188,10 @@ function versionFromTag { fi } -swift_version=$(describe ${source_dir}/swift-project/swift) -swift_tag_date=$(git -C ${source_dir}/swift-project/swift log -1 --format=%ct 2>/dev/null) +swift_source_dir=${source_dir}/swift-project + +swift_version=$(describe ${swift_source_dir}/swift) +swift_tag_date=$(git -C ${swift_source_dir}/swift log -1 --format=%ct 2>/dev/null) if [[ $swift_version == swift-* ]]; then swift_version=${swift_version#swift-} @@ -199,9 +201,9 @@ if [[ -z "$sdk_name" ]]; then sdk_name=swift-${swift_version}-android-${android_sdk_version} fi -libxml2_version=$(versionFromTag ${source_dir}/libxml2) +libxml2_version=$(versionFromTag ${swift_source_dir}/libxml2) -curl_desc=$(describe ${source_dir}/curl | tr '_' '.') +curl_desc=$(describe ${swift_source_dir}/curl | tr '_' '.') curl_version=${curl_desc#curl-} boringssl_version=$(describe ${source_dir}/boringssl) @@ -217,6 +219,7 @@ header "Swift Android SDK build script" swift_dir=$(realpath $(dirname "$swiftc")/..) HOST=linux-x86_64 +# The Linux NDK only supports x86 #HOST=$(uname -s -m | tr '[:upper:]' '[:lower:]' | tr ' ' '-') # in a Docker container, the pre-installed NDK is read-only, @@ -298,10 +301,10 @@ for arch in $archs; do mkdir -p "$sdk_root" groupstart "Building libxml2 for $arch" - quiet_pushd ${source_dir}/libxml2 + quiet_pushd ${swift_source_dir}/libxml2 run cmake \ -G Ninja \ - -S ${source_dir}/libxml2 \ + -S ${swift_source_dir}/libxml2 \ -B ${build_dir}/$arch/libxml2 \ -DANDROID_ABI=$android_abi \ -DANDROID_PLATFORM=android-$android_api \ @@ -355,10 +358,10 @@ for arch in $archs; do groupend groupstart "Building libcurl for ${compiler_target_host}" - quiet_pushd ${source_dir}/curl + quiet_pushd ${swift_source_dir}/curl run cmake \ -G Ninja \ - -S ${source_dir}/curl \ + -S ${swift_source_dir}/curl \ -B ${build_dir}/$arch/curl \ -DANDROID_ABI=$android_abi \ -DANDROID_PLATFORM=android-$android_api \ @@ -395,7 +398,7 @@ for arch in $archs; do groupend groupstart "Building Android SDK for ${compiler_target_host}" - quiet_pushd ${source_dir}/swift-project + quiet_pushd ${swift_source_dir} build_type_flag="--debug" case $build_type in Debug) build_type_flag="--debug" ;; @@ -522,7 +525,7 @@ for arch in $archs; do quiet_pushd ${sdk_staging}/${arch}/usr rm -r bin rm -r include/* - cp -r ${source_dir}/swift-project/swift/lib/ClangImporter/SwiftBridging/{module.modulemap,swift} include/ + cp -r ${swift_source_dir}/swift/lib/ClangImporter/SwiftBridging/{module.modulemap,swift} include/ arch_triple="$arch-linux-android" if [[ $arch == 'armv7' ]]; then diff --git a/swift-ci/sdks/android/scripts/fetch-source.sh b/swift-ci/sdks/android/scripts/fetch-source.sh index 29f63fce..d07cb68b 100755 --- a/swift-ci/sdks/android/scripts/fetch-source.sh +++ b/swift-ci/sdks/android/scripts/fetch-source.sh @@ -52,7 +52,6 @@ function usage { cat <|--swift-tag |--swift-version ] - [--curl-version ] [--boringssl-version ] [--clone-with-ssh] [--source-dir ] @@ -70,8 +69,6 @@ SDK for Swift. Options are: If starts with "scheme:" or "tag:", it will select a scheme or tag; otherwise it will be treated as a version number. - --libxml2-version - --curl-version --boringssl-version EOF } @@ -80,18 +77,9 @@ EOF if [[ -z "${SWIFT_VERSION}" ]]; then SWIFT_VERSION=scheme:release/6.1 fi -if [[ -z "${LIBXML2_VERSION}" ]]; then - LIBXML2_VERSION=2.14.2 -fi -if [[ -z "${CURL_VERSION}" ]]; then - CURL_VERSION=8.13.0 -fi if [[ -z "${BORINGSSL_VERSION}" ]]; then BORINGSSL_VERSION=fips-20220613 fi -if [[ -z "${YAMS_VERSION}" ]]; then - YAMS_VERSION=5.0.6 -fi clone_with_ssh=false while [ "$#" -gt 0 ]; do @@ -102,10 +90,6 @@ while [ "$#" -gt 0 ]; do SWIFT_VERSION="tag:$2"; shift ;; --swift-version) SWIFT_VERSION="$2"; shift ;; - --libxml2-version) - LIBXML2_VERSION="$2"; shift ;; - --curl-version) - CURL_VERSION="$2"; shift ;; --boringssl-version) BORINGSSL_VERSION="$2"; shift ;; --clone-with-ssh) @@ -158,32 +142,6 @@ fi popd >/dev/null groupend -# Fetch yams (needed for Swift 6.1.x) -groupstart "Fetching yams" -pushd swift-project >/dev/null -[[ -d yams ]] || git clone ${github}jpsim/Yams.git yams -pushd yams >/dev/null 2>&1 -git checkout ${YAMS_VERSION} -popd >/dev/null 2>&1 -popd >/dev/null -groupend - -# Fetch libxml2 -groupstart "Fetching libxml2" -[[ -d libxml2 ]] || git clone ${github}GNOME/libxml2.git -pushd libxml2 >/dev/null 2>&1 -git checkout v${LIBXML2_VERSION} -popd >/dev/null 2>&1 -groupend - -# Fetch curl -groupstart "Fetching curl" -[[ -d curl ]] || git clone ${github}curl/curl.git -pushd curl >/dev/null 2>&1 -git checkout curl-$(echo ${CURL_VERSION} | tr '.' '_') -popd >/dev/null 2>&1 -groupend - # Fetch BoringSSL groupstart "Fetching BoringSSL" [[ -d boringssl ]] || git clone https://boringssl.googlesource.com/boringssl diff --git a/swift-ci/sdks/android/scripts/toolchain-vars.sh b/swift-ci/sdks/android/scripts/toolchain-vars.sh index 4bf5b5ed..d804dfe7 100644 --- a/swift-ci/sdks/android/scripts/toolchain-vars.sh +++ b/swift-ci/sdks/android/scripts/toolchain-vars.sh @@ -37,11 +37,26 @@ case "${BUILD_SCHEME}" in esac SWIFT_BASE=$SWIFT_TAG-$HOST_OS + +case $(arch) in + arm64|aarch64) + export OS_ARCH_SUFFIX=-aarch64 + ;; + amd64|x86_64) + export OS_ARCH_SUFFIX= + ;; + *) + echo "Unknown architecture $(arch)" + exit 1 + ;; +esac + + case $BUILD_COMPILER in 1|true|yes|YES) - export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS.tar.gz" + export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$RELEASE_BRANCH/$OS$OS_ARCH_SUFFIX/$RELEASE_TAG/$RELEASE_TAG-$HOST_OS$OS_ARCH_SUFFIX.tar.gz" ;; *) - export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS/$SWIFT_TAG/$SWIFT_BASE.tar.gz" + export SWIFT_TOOLCHAIN_URL="https://download.swift.org/$SWIFT_BRANCH/$OS$OS_ARCH_SUFFIX/$SWIFT_TAG/$SWIFT_BASE$OS_ARCH_SUFFIX.tar.gz" ;; esac