diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index e8ab193c2d51b0..31a61e9989185b 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -1,5 +1,24 @@ #!/usr/bin/env bash +# This is a simple script primarily used for CI to install necessary dependencies +# +# For CI typical usage is +# +# ./install-native-dependencies.sh azDO +# +# For developer use it is not recommended to include the azDO final argument as that +# makes installation and configuration setting only required for azDO +# +# So simple developer usage would currently be +# +# ./install-native-dependencies.sh + +if [ "$1" = "OSX" ] && [ "$2" = "arm64" ] && [ "$3" = "azDO" ]; then + # On AzDO macOS-10.15 build agents the Xcode currently defaults to Xcode 11.7 + # Cross compilation for osx-arm64 requires xcode 12.2 or greater + sudo xcode-select -s /Applications/Xcode_12.2.app/Contents/Developer +fi + if [ "$1" = "Linux" ]; then sudo apt update if [ "$?" != "0" ]; then diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index 868ba2f4ad51b3..502af4fe0a735f 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -41,7 +41,7 @@ jobs: # Do not rename as it clashes with MSBuild property in libraries/build-native.proj - name: _crossBuildPropertyArg - value: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }} + value: /p:CrossBuild=${{ or(ne(parameters.crossrootfsDir, ''), and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }} - name: _cxx11Parameter ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.archType, 'arm64')) }}: @@ -65,7 +65,7 @@ jobs: - template: /eng/pipelines/common/restore-internal-tools.yml - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies - script: | diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 44d52cbadf9b34..a4ed15af97e22a 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -445,6 +445,27 @@ jobs: helixQueueGroup: ${{ parameters.helixQueueGroup }} ${{ insert }}: ${{ parameters.jobParameters }} +# macOS arm64 + +- ${{ if or(containsValue(parameters.platforms, 'OSX_arm64'), eq(parameters.platformGroup, 'all')) }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: OSX + archType: arm64 + targetRid: osx-arm64 + platform: OSX_arm64 + jobParameters: + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + ${{ insert }}: ${{ parameters.jobParameters }} + # macOS x64 - ${{ if or(containsValue(parameters.platforms, 'OSX_x64'), eq(parameters.platformGroup, 'all')) }}: diff --git a/eng/pipelines/common/templates/runtimes/build-test-job.yml b/eng/pipelines/common/templates/runtimes/build-test-job.yml index 144cc135063958..a658bba42fa982 100644 --- a/eng/pipelines/common/templates/runtimes/build-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/build-test-job.yml @@ -87,7 +87,7 @@ jobs: # Install test build dependencies - ${{ if eq(parameters.osGroup, 'OSX') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install correct cmake version diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 0a3d6cd6b753d7..a5720c22a0303c 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -116,7 +116,7 @@ jobs: # OSX Build Pool (we don't have on-prem OSX BuildPool ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - vmImage: 'macOS-10.14' + vmImage: 'macOS-10.15' ${{ if eq(parameters.osGroup, 'Browser') }}: vmImage: 'ubuntu-latest' diff --git a/eng/pipelines/coreclr/ci.yml b/eng/pipelines/coreclr/ci.yml index e7ef3ab1a4d4d9..9059f11855b421 100644 --- a/eng/pipelines/coreclr/ci.yml +++ b/eng/pipelines/coreclr/ci.yml @@ -44,6 +44,7 @@ jobs: - Linux_musl_arm64 - Linux_musl_x64 - Linux_x64 + - OSX_arm64 - OSX_x64 - Windows_NT_arm - Windows_NT_arm64 @@ -72,6 +73,7 @@ jobs: - Linux_arm - Linux_musl_arm64 - Linux_x64 + - OSX_arm64 - OSX_x64 - Windows_NT_x86 jobParameters: diff --git a/eng/pipelines/coreclr/templates/build-jit-job.yml b/eng/pipelines/coreclr/templates/build-jit-job.yml index f46a57a4475601..34efd80fe13ef4 100644 --- a/eng/pipelines/coreclr/templates/build-jit-job.yml +++ b/eng/pipelines/coreclr/templates/build-jit-job.yml @@ -80,7 +80,7 @@ jobs: # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - ${{ if eq(parameters.osGroup, 'OSX') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index 526b43afcc7f48..30e89d4afe3c69 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -125,7 +125,7 @@ jobs: # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - ${{ if eq(parameters.osGroup, 'OSX') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python diff --git a/eng/pipelines/coreclr/templates/xplat-job.yml b/eng/pipelines/coreclr/templates/xplat-job.yml index 7f03b78d162f71..485326bfd7600f 100644 --- a/eng/pipelines/coreclr/templates/xplat-job.yml +++ b/eng/pipelines/coreclr/templates/xplat-job.yml @@ -91,12 +91,14 @@ jobs: - name: _HelixSource value: ci/dotnet/runtime/$(Build.SourceBranch) + - name: crossArg + value: '' - ${{ if ne(parameters.crossrootfsDir, '') }}: - name: crossArg value: '-cross' - - ${{ if eq(parameters.crossrootfsDir, '') }}: + - ${{ if and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64')) }}: - name: crossArg - value: '' + value: '-cross' - ${{ each variable in parameters.variables }}: - ${{insert}}: ${{ variable }} diff --git a/eng/pipelines/installer/jobs/base-job.yml b/eng/pipelines/installer/jobs/base-job.yml index d5dde2ef08a1d5..fd93da9d94a7f5 100644 --- a/eng/pipelines/installer/jobs/base-job.yml +++ b/eng/pipelines/installer/jobs/base-job.yml @@ -67,7 +67,8 @@ jobs: not(in(parameters.archType, 'x64', 'x86')), eq(parameters.runtimeFlavor, 'mono'), eq(parameters.isOfficialBuild, true), - ne(parameters.crossrootfsDir, '')) }} + ne(parameters.crossrootfsDir, ''), + and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }} - name: BuildAction value: -test @@ -130,6 +131,8 @@ jobs: /p:PortableBuild=true /p:SkipTests=$(SkipTests) /p:RuntimeFlavor=${{ parameters.runtimeFlavor }} + /p:TargetArchitecture=${{ parameters.archType }} + /p:CrossBuild=${{ eq(parameters.archType, 'arm64') }} $(llvmParameter) - name: BaseJobBuildCommand @@ -137,6 +140,7 @@ jobs: $(Build.SourcesDirectory)/build.sh -ci $(BuildAction) -configuration $(_BuildConfig) + -arch ${{ parameters.archType }} $(LiveOverridePathArgs) $(CommonMSBuildArgs) $(OfficialBuildArg) @@ -462,7 +466,7 @@ jobs: cleanUnpackFolder: false - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies - script: | diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml index 3da0d03360919d..dd4864bd96b92f 100644 --- a/eng/pipelines/libraries/base-job.yml +++ b/eng/pipelines/libraries/base-job.yml @@ -57,7 +57,11 @@ jobs: - _testScopeArg: -testscope ${{ parameters.testScope }} - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}: - - _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }} + - _crossBuildPropertyArg: /p:CrossBuild=${{ or(ne(parameters.crossrootfsDir, ''), and(eq(parameters.osGroup, 'OSX'), eq(parameters.archType, 'arm64'))) }} + + - ${{ if eq(parameters.osGroup, 'OSX') }}: + # OSX is currently building on x64, anything else is a cross build + - _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.archType, 'x64') }} - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}: - _runtimeOSArg: /p:RuntimeOS=linux-musl diff --git a/eng/pipelines/libraries/build-job.yml b/eng/pipelines/libraries/build-job.yml index 820247b1cc2136..02e1d87bca17bc 100644 --- a/eng/pipelines/libraries/build-job.yml +++ b/eng/pipelines/libraries/build-job.yml @@ -77,7 +77,7 @@ jobs: - template: /eng/pipelines/common/restore-internal-tools.yml - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies - script: | diff --git a/eng/pipelines/libraries/outerloop.yml b/eng/pipelines/libraries/outerloop.yml index d88481ea37dd4b..5e7615103e22b0 100644 --- a/eng/pipelines/libraries/outerloop.yml +++ b/eng/pipelines/libraries/outerloop.yml @@ -33,6 +33,7 @@ jobs: - Linux_arm64 - Linux_musl_arm64 - ${{ if eq(variables['includeOsxOuterloop'], true) }}: + - OSX_arm64 - OSX_x64 jobParameters: testGroup: innerloop @@ -56,6 +57,7 @@ jobs: - Linux_musl_x64 - Linux_musl_arm64 - ${{ if and(eq(variables['includeOsxOuterloop'], true), eq(variables['isFullMatrix'], true)) }}: + - OSX_arm64 - OSX_x64 helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml jobParameters: @@ -77,6 +79,7 @@ jobs: - Linux_x64 - Linux_musl_x64 - ${{ if eq(variables['includeOsxOuterloop'], true) }}: + - OSX_arm64 - OSX_x64 helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml jobParameters: @@ -101,4 +104,4 @@ jobs: isFullMatrix: ${{ variables['isFullMatrix'] }} framework: net48 runTests: true - testScope: outerloop \ No newline at end of file + testScope: outerloop diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index e46ca5ee005f23..02bcd0c61e578b 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -87,7 +87,7 @@ jobs: # 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', 'tvOS') }}: - - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index 3deef33444c41f..80141273f93c05 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -49,6 +49,7 @@ stages: jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml buildConfig: release platforms: + - OSX_arm64 - OSX_x64 - Linux_x64 - Linux_arm @@ -172,6 +173,7 @@ stages: jobTemplate: /eng/pipelines/libraries/build-job.yml buildConfig: Release platforms: + - OSX_arm64 - OSX_x64 - Linux_x64 - Linux_arm @@ -214,6 +216,7 @@ stages: useOfficialAllConfigurations: true buildFullPlatformManifest: true platforms: + - OSX_arm64 - OSX_x64 - Linux_x64 - Linux_arm diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index e953d209a6ee3b..3fc54c129d4d44 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -143,6 +143,7 @@ jobs: - Linux_musl_arm - Linux_musl_arm64 - Linux_musl_x64 + - OSX_arm64 - Windows_NT_x86 - Windows_NT_x64 - Windows_NT_arm @@ -201,6 +202,7 @@ jobs: jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml buildConfig: release platforms: + - OSX_arm64 - OSX_x64 - Linux_x64 - Linux_arm @@ -619,6 +621,7 @@ jobs: - Linux_arm64 - Linux_musl_x64 - Linux_x64 + - OSX_arm64 - OSX_x64 - Windows_NT_x64 - FreeBSD_x64 @@ -705,6 +708,7 @@ jobs: parameters: buildConfig: Release platforms: + - OSX_arm64 - OSX_x64 - Linux_x64 - Linux_arm64