From f39c7f7aacf2e134ee612ea31c5a5d1e3f2fa1b4 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 09:38:23 -0400 Subject: [PATCH 01/18] Initial Mono Android CI --- eng/pipelines/common/platform-matrix.yml | 66 ++++++++++++++++++++++ eng/pipelines/mono/templates/build-job.yml | 10 ++++ eng/pipelines/runtime.yml | 12 ++++ 3 files changed, 88 insertions(+) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 0e312712ff182..e9b7600dce529 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -198,6 +198,72 @@ jobs: # asArray: [] # ${{ insert }}: ${{ parameters.jobParameters }} +# Android x64 + +- ${{ if containsValue(parameters.platforms, 'Android_x64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + osGroup: Android + archType: x64 + platform: Android_x64 + container: + image: ubuntu-16.04-bfcd90a-20200121150106 + registry: mcr + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + +# Android arm + +- ${{ if containsValue(parameters.platforms, 'Android_arm') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + osGroup: Android + archType: arm + platform: Android_x64 + container: + image: ubuntu-16.04-bfcd90a-20200121150106 + registry: mcr + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + +# Android arm64 + +- ${{ if containsValue(parameters.platforms, 'Android_arm64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + osGroup: Android + archType: arm64 + platform: Android_x64 + container: + image: ubuntu-16.04-bfcd90a-20200121150106 + registry: mcr + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + # iOS x64 - ${{ if containsValue(parameters.platforms, 'iOS_x64') }}: diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 878f34e937419..2ce154446b5b7 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -68,6 +68,9 @@ jobs: - ${{ if eq(parameters.osGroup, 'iOS') }}: - name: osOverride value: -os iOS + - ${{ if eq(parameters.osGroup, 'Android') }}: + - name: osOverride + value: -os Android - ${{ parameters.variables }} steps: @@ -79,6 +82,13 @@ jobs: - ${{ if in(parameters.osGroup, 'OSX', 'iOS') }}: - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies + - ${{ if in(parameters.osGroup, 'Android') }}: + - script: | + wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip + mkdir -p ~/Android/Sdk + unzip android-ndk-r21-linux-x86_64.zip -d ~/Android/Sdk + mv ~/Android/Sdk/*ndk* ~/Android/Sdk/ndk + displayName: Install Android NDK - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 8f909825a4311..fcceba8624af8 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -231,6 +231,9 @@ jobs: runtimeFlavor: mono buildConfig: debug platforms: + - Android_x64 + - Android_arm + - Android_arm64 - iOS_x64 - iOS_arm - iOS_arm64 @@ -261,6 +264,9 @@ jobs: runtimeFlavor: mono buildConfig: release platforms: + - Android_x64 + - Android_arm + - Android_arm64 - iOS_x64 - iOS_arm - iOS_arm64 @@ -378,6 +384,9 @@ jobs: buildConfig: Release runtimeFlavor: mono platforms: + - Android_arm + - Android_arm64 + - Android_x64 - iOS_arm - iOS_arm64 - iOS_x64 @@ -390,6 +399,9 @@ jobs: buildConfig: Debug runtimeFlavor: mono platforms: + - Android_arm + - Android_arm64 + - Android_x64 - iOS_arm - iOS_arm64 - iOS_x64 From e9df16901653e1c8afe7e1393e9fb20e13ae10f6 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 10:04:59 -0400 Subject: [PATCH 02/18] Force an ANDROID_NDK_HOME value --- eng/pipelines/common/xplat-setup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 65777987497a0..de7462c67eef6 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -55,6 +55,11 @@ jobs: - name: ROOTFS_DIR value: ${{ parameters.jobParameters.crossrootfsDir }} + - ${{ if eq(parameters.osGroup, 'Android') }}: + - name: ANDROID_NDK_HOME + # default here is value used by Android Studio + value: ~/Android/Sdk/ndk + - name: runtimeFlavorName ${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}: value: Mono From 83da088035cfec87e471924808eff910d1829b9e Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 10:24:22 -0400 Subject: [PATCH 03/18] Switch to the same CentOS7 image as Linux x86 (for now) --- eng/pipelines/common/platform-matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index e9b7600dce529..26e1a6be08830 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -209,7 +209,7 @@ jobs: archType: x64 platform: Android_x64 container: - image: ubuntu-16.04-bfcd90a-20200121150106 + image: centos-7-359e48e-20200313130914 registry: mcr jobParameters: runtimeFlavor: mono @@ -231,7 +231,7 @@ jobs: archType: arm platform: Android_x64 container: - image: ubuntu-16.04-bfcd90a-20200121150106 + image: centos-7-359e48e-20200313130914 registry: mcr jobParameters: runtimeFlavor: mono @@ -253,7 +253,7 @@ jobs: archType: arm64 platform: Android_x64 container: - image: ubuntu-16.04-bfcd90a-20200121150106 + image: centos-7-359e48e-20200313130914 registry: mcr jobParameters: runtimeFlavor: mono From 9324f6c52f2c5af40e1fe3edd37e4c2bd87d66de Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 10:43:51 -0400 Subject: [PATCH 04/18] Use AzDO to unpack NDK, since there's no `unzip` in our CentOS images --- eng/pipelines/mono/templates/build-job.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 2ce154446b5b7..7b00b43974580 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -86,7 +86,13 @@ jobs: - script: | wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip mkdir -p ~/Android/Sdk - unzip android-ndk-r21-linux-x86_64.zip -d ~/Android/Sdk + displayName: Download Android NDK + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: android-ndk-r21-linux-x86_64.zip + destinationFolder: ~/Android/Sdk + displayName: Unpack Android NDK + - script: | mv ~/Android/Sdk/*ndk* ~/Android/Sdk/ndk displayName: Install Android NDK - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: From f608e360e76bc70702618b2bdd15e354f6fcb15a Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 11:12:34 -0400 Subject: [PATCH 05/18] Revert "Use AzDO to unpack NDK, since there's no `unzip` in our CentOS images" This reverts commit 9324f6c52f2c5af40e1fe3edd37e4c2bd87d66de. --- eng/pipelines/mono/templates/build-job.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 7b00b43974580..2ce154446b5b7 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -86,13 +86,7 @@ jobs: - script: | wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip mkdir -p ~/Android/Sdk - displayName: Download Android NDK - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: android-ndk-r21-linux-x86_64.zip - destinationFolder: ~/Android/Sdk - displayName: Unpack Android NDK - - script: | + unzip android-ndk-r21-linux-x86_64.zip -d ~/Android/Sdk mv ~/Android/Sdk/*ndk* ~/Android/Sdk/ndk displayName: Install Android NDK - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: From a0ea3179756293f1f9d3d178ba50431a1fe8993f Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Thu, 26 Mar 2020 11:13:00 -0400 Subject: [PATCH 06/18] Install unzip command --- eng/pipelines/mono/templates/build-job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 2ce154446b5b7..e9ec771dab1fa 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -86,6 +86,7 @@ jobs: - script: | wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip mkdir -p ~/Android/Sdk + yum -y install unzip unzip android-ndk-r21-linux-x86_64.zip -d ~/Android/Sdk mv ~/Android/Sdk/*ndk* ~/Android/Sdk/ndk displayName: Install Android NDK From a1d51127c3d34886b7d833f539e7b5a1855c09fb Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Mon, 30 Mar 2020 12:47:22 -0400 Subject: [PATCH 07/18] Use our new Android builder image --- eng/pipelines/common/platform-matrix.yml | 10 +++++----- eng/pipelines/common/xplat-setup.yml | 3 +-- eng/pipelines/mono/templates/build-job.yml | 8 -------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 26e1a6be08830..516edbced97bf 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -209,7 +209,7 @@ jobs: archType: x64 platform: Android_x64 container: - image: centos-7-359e48e-20200313130914 + image: ubuntu-18.04-android-8505948-20200327151156 registry: mcr jobParameters: runtimeFlavor: mono @@ -229,9 +229,9 @@ jobs: helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} osGroup: Android archType: arm - platform: Android_x64 + platform: Android_arm container: - image: centos-7-359e48e-20200313130914 + image: ubuntu-18.04-android-8505948-20200327151156 registry: mcr jobParameters: runtimeFlavor: mono @@ -251,9 +251,9 @@ jobs: helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} osGroup: Android archType: arm64 - platform: Android_x64 + platform: Android_arm64 container: - image: centos-7-359e48e-20200313130914 + image: ubuntu-18.04-android-8505948-20200327151156 registry: mcr jobParameters: runtimeFlavor: mono diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index de7462c67eef6..d11b7c8256c2d 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -57,8 +57,7 @@ jobs: - ${{ if eq(parameters.osGroup, 'Android') }}: - name: ANDROID_NDK_HOME - # default here is value used by Android Studio - value: ~/Android/Sdk/ndk + value: /usr/local/ndk - name: runtimeFlavorName ${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}: diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index e9ec771dab1fa..014c6cf4c6d45 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -82,14 +82,6 @@ jobs: - ${{ if in(parameters.osGroup, 'OSX', 'iOS') }}: - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - - ${{ if in(parameters.osGroup, 'Android') }}: - - script: | - wget https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip - mkdir -p ~/Android/Sdk - yum -y install unzip - unzip android-ndk-r21-linux-x86_64.zip -d ~/Android/Sdk - mv ~/Android/Sdk/*ndk* ~/Android/Sdk/ndk - displayName: Install Android NDK - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force From e7e9b063c62635bd35c28374138a568dfe21d077 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Mon, 30 Mar 2020 13:20:19 -0400 Subject: [PATCH 08/18] Install some extra dependencies post-hoc --- eng/install-native-dependencies.sh | 9 +++++++++ eng/pipelines/mono/templates/build-job.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index e837b017c7cba..01ce311a36107 100644 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -9,6 +9,15 @@ if [ "$1" = "Linux" ]; then if [ "$?" != "0" ]; then exit 1; fi +elif [ "$1" = "Android" ]; then + sudo apt update + if [ "$?" != "0" ]; then + exit 1; + fi + sudo apt install cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev libkrb5-dev libnuma-dev autoconf automake libtool build-essential + if [ "$?" != "0" ]; then + exit 1; + fi elif [ "$1" = "OSX" ]; then brew update brew upgrade diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 014c6cf4c6d45..8caa0230d1723 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -79,7 +79,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if in(parameters.osGroup, 'OSX', 'iOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'Android') }}: - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: From a0eda1f3dce6f970def07099baf2db2bb730a7f6 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Mon, 30 Mar 2020 13:44:15 -0400 Subject: [PATCH 09/18] Revert "Install some extra dependencies post-hoc" This reverts commit e7e9b063c62635bd35c28374138a568dfe21d077. --- eng/install-native-dependencies.sh | 9 --------- eng/pipelines/mono/templates/build-job.yml | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 01ce311a36107..e837b017c7cba 100644 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -9,15 +9,6 @@ if [ "$1" = "Linux" ]; then if [ "$?" != "0" ]; then exit 1; fi -elif [ "$1" = "Android" ]; then - sudo apt update - if [ "$?" != "0" ]; then - exit 1; - fi - sudo apt install cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev libkrb5-dev libnuma-dev autoconf automake libtool build-essential - if [ "$?" != "0" ]; then - exit 1; - fi elif [ "$1" = "OSX" ]; then brew update brew upgrade diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index 768e26d2dae70..cae511090c792 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -79,7 +79,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'Android') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS') }}: - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: From e50fdbbb21c18dcd894f61ab8a4cd24c1cc69b43 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Tue, 31 Mar 2020 10:54:31 -0400 Subject: [PATCH 10/18] Bump Android image --- eng/pipelines/common/platform-matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 616113472e3a5..36f701855e079 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -209,7 +209,7 @@ jobs: archType: x64 platform: Android_x64 container: - image: ubuntu-18.04-android-8505948-20200327151156 + image: ubuntu-18.04-android-20200331133105-d620eac registry: mcr jobParameters: runtimeFlavor: mono @@ -231,7 +231,7 @@ jobs: archType: arm platform: Android_arm container: - image: ubuntu-18.04-android-8505948-20200327151156 + image: ubuntu-18.04-android-20200331133105-d620eac registry: mcr jobParameters: runtimeFlavor: mono @@ -253,7 +253,7 @@ jobs: archType: arm64 platform: Android_arm64 container: - image: ubuntu-18.04-android-8505948-20200327151156 + image: ubuntu-18.04-android-20200331133105-d620eac registry: mcr jobParameters: runtimeFlavor: mono From 2a5cb04f1c145cea6223db87794821ebb06e8bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 1 Apr 2020 12:49:24 +0200 Subject: [PATCH 11/18] Bump Android image --- eng/pipelines/common/platform-matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 36f701855e079..9c39026ca1748 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -209,7 +209,7 @@ jobs: archType: x64 platform: Android_x64 container: - image: ubuntu-18.04-android-20200331133105-d620eac + image: ubuntu-18.04-android-20200401093035-1517ea2 registry: mcr jobParameters: runtimeFlavor: mono @@ -231,7 +231,7 @@ jobs: archType: arm platform: Android_arm container: - image: ubuntu-18.04-android-20200331133105-d620eac + image: ubuntu-18.04-android-20200401093035-1517ea2 registry: mcr jobParameters: runtimeFlavor: mono @@ -253,7 +253,7 @@ jobs: archType: arm64 platform: Android_arm64 container: - image: ubuntu-18.04-android-20200331133105-d620eac + image: ubuntu-18.04-android-20200401093035-1517ea2 registry: mcr jobParameters: runtimeFlavor: mono From 211a5d0152a1f1bf64d825b2c5281a9494dce388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 1 Apr 2020 14:26:02 +0200 Subject: [PATCH 12/18] Update build-native.sh --- src/libraries/Native/build-native.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/Native/build-native.sh b/src/libraries/Native/build-native.sh index ec5fea05f0731..68914ffd72477 100755 --- a/src/libraries/Native/build-native.sh +++ b/src/libraries/Native/build-native.sh @@ -81,6 +81,10 @@ elif [[ "$__TargetOS" == Android && -z "$ROOTFS_DIR" ]]; then # keep ANDROID_NATIVE_API_LEVEL in sync with src/mono/Directory.Build.props __CMakeArgs="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_STL=none -DANDROID_NATIVE_API_LEVEL=21 $__CMakeArgs" + # workaround init-compiler.sh trying to detect clang, it's handled in android.toolchain.cmake already + CLR_CC=$(which false) + CLR_CXX=$(which false) + if [[ "$__BuildArch" == x64 ]]; then __CMakeArgs="-DANDROID_ABI=x86_64 $__CMakeArgs" elif [[ "$__BuildArch" == x86 ]]; then From c4bacb70c6ad43e4545786a5a3737c26a6b08869 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 08:53:05 -0400 Subject: [PATCH 13/18] Force `-os Android` for Android, else it tries to do Linux --- eng/pipelines/libraries/base-job.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml index c39cdd4042737..70e9fc1b20cef 100644 --- a/eng/pipelines/libraries/base-job.yml +++ b/eng/pipelines/libraries/base-job.yml @@ -74,6 +74,10 @@ jobs: - ${{ if eq(parameters.osGroup, 'iOS') }}: - _runtimeOSArg: -os ${{ parameters.osGroup }} + # force a value for OS when cross-building Android on Linux + - ${{ if eq(parameters.osGroup, 'Android') }}: + - _runtimeOSArg: -os ${{ parameters.osGroup }} + - ${{ if ne(parameters.framework, '') }}: - _finalFrameworkArg: -framework ${{ parameters.framework }} - _extraHelixArguments: /p:BuildTargetFramework=${{ parameters.framework }} From 8b0895c355ad3dbc29e09c11e0ae71f6937c63f9 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 09:40:13 -0400 Subject: [PATCH 14/18] Try forcing export, to ensure these variables are passed --- src/libraries/Native/build-native.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Native/build-native.sh b/src/libraries/Native/build-native.sh index 68914ffd72477..1cf9339629960 100755 --- a/src/libraries/Native/build-native.sh +++ b/src/libraries/Native/build-native.sh @@ -82,8 +82,8 @@ elif [[ "$__TargetOS" == Android && -z "$ROOTFS_DIR" ]]; then __CMakeArgs="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_STL=none -DANDROID_NATIVE_API_LEVEL=21 $__CMakeArgs" # workaround init-compiler.sh trying to detect clang, it's handled in android.toolchain.cmake already - CLR_CC=$(which false) - CLR_CXX=$(which false) + export CLR_CC=$(which false) + export CLR_CXX=$(which false) if [[ "$__BuildArch" == x64 ]]; then __CMakeArgs="-DANDROID_ABI=x86_64 $__CMakeArgs" From 7817f511b1305c360383cf52cf9ac81d6e754771 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 10:16:23 -0400 Subject: [PATCH 15/18] Add Android x86, which is a thing apparently --- eng/pipelines/common/platform-matrix.yml | 22 ++++++++++++++++++++++ eng/pipelines/runtime.yml | 8 ++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 9c39026ca1748..525461b4b2080 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -220,6 +220,28 @@ jobs: helixQueueGroup: ${{ parameters.helixQueueGroup }} ${{ insert }}: ${{ parameters.jobParameters }} +# Android x86 + +- ${{ if containsValue(parameters.platforms, 'Android_x64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + osGroup: Android + archType: x86 + platform: Android_x86 + container: + image: ubuntu-18.04-android-20200401093035-1517ea2 + registry: mcr + jobParameters: + runtimeFlavor: mono + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + # Android arm - ${{ if containsValue(parameters.platforms, 'Android_arm') }}: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index fcceba8624af8..9a6db846433ec 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -232,6 +232,7 @@ jobs: buildConfig: debug platforms: - Android_x64 + - Android_x86 - Android_arm - Android_arm64 - iOS_x64 @@ -265,6 +266,7 @@ jobs: buildConfig: release platforms: - Android_x64 + - Android_x86 - Android_arm - Android_arm64 - iOS_x64 @@ -384,9 +386,10 @@ jobs: buildConfig: Release runtimeFlavor: mono platforms: + - Android_x64 + - Android_x86 - Android_arm - Android_arm64 - - Android_x64 - iOS_arm - iOS_arm64 - iOS_x64 @@ -399,9 +402,10 @@ jobs: buildConfig: Debug runtimeFlavor: mono platforms: + - Android_x64 + - Android_x86 - Android_arm - Android_arm64 - - Android_x64 - iOS_arm - iOS_arm64 - iOS_x64 From d911bf84c27b61657ebb1dfa64a6f0276a6b1f22 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 11:21:19 -0400 Subject: [PATCH 16/18] Add Android to official builds --- eng/pipelines/runtime-official.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index a49a4b1bbda73..1674541a94a75 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -69,6 +69,10 @@ stages: runtimeFlavor: mono buildConfig: release platforms: + - Android_x64 + - Android_x86 + - Android_arm + - Android_arm64 - iOS_x64 - iOS_arm - iOS_arm64 @@ -116,6 +120,10 @@ stages: buildConfig: Release runtimeFlavor: mono platforms: + - Android_x64 + - Android_x86 + - Android_arm + - Android_arm64 - iOS_x64 - iOS_arm - iOS_arm64 From 44e0c2dedf2ca07f772da850fba655c9e42ccec2 Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 17:49:12 -0400 Subject: [PATCH 17/18] Remove "not on android" condition from --build-id flag --- src/mono/mono.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index bfc84a87093d6..610bc1eef30ac 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -413,7 +413,7 @@ - + <_MonoCFLAGS Include="-Wl,--build-id" /> <_MonoCXXFLAGS Include="-Wl,--build-id" /> From 43e3e4c6582976945468803c3d73e2d36cced77f Mon Sep 17 00:00:00 2001 From: Joseph Shields Date: Wed, 1 Apr 2020 17:57:59 -0400 Subject: [PATCH 18/18] Fix typo --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 525461b4b2080..79881b6e13433 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -222,7 +222,7 @@ jobs: # Android x86 -- ${{ if containsValue(parameters.platforms, 'Android_x64') }}: +- ${{ if containsValue(parameters.platforms, 'Android_x86') }}: - template: xplat-setup.yml parameters: jobTemplate: ${{ parameters.jobTemplate }}