diff --git a/build-tools/automation/azure-pipelines-public.yaml b/build-tools/automation/azure-pipelines-public.yaml index 436dc31d184..ef6e0a58408 100644 --- a/build-tools/automation/azure-pipelines-public.yaml +++ b/build-tools/automation/azure-pipelines-public.yaml @@ -45,8 +45,6 @@ variables: - name: DefaultJavaSdkMajorVersion value: 21 # Override pool images for public Microsoft-hosted agents -- name: HostedMacImage - value: macOS-15 - name: LinuxPoolImage value: ubuntu-22.04 - name: NetCorePublicPoolName diff --git a/build-tools/automation/yaml-templates/stage-java-interop-tests.yaml b/build-tools/automation/yaml-templates/stage-java-interop-tests.yaml index 3739f6a9662..92aff51cf19 100644 --- a/build-tools/automation/yaml-templates/stage-java-interop-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-java-interop-tests.yaml @@ -104,6 +104,18 @@ stages: fi displayName: Ensure cmake is installed + # The hosted macOS pool architecture can change between Intel (osx-x64) and + # Apple Silicon (osx-arm64), so detect it at runtime and publish/run the + # NativeAOT sample for the matching RID. Otherwise the produced .dylib fails + # to dlopen with an "incompatible architecture" error. + - bash: | + if [ "$(Agent.OSArchitecture)" = "ARM64" ]; then + echo "##vso[task.setvariable variable=NativeAOTRid]osx-arm64" + else + echo "##vso[task.setvariable variable=NativeAOTRid]osx-x64" + fi + displayName: Determine NativeAOT RID + - template: /external/Java.Interop/build-tools/automation/templates/install-dependencies.yaml@self - template: /external/Java.Interop/build-tools/automation/templates/core-build.yaml@self @@ -111,7 +123,7 @@ stages: - template: /external/Java.Interop/build-tools/automation/templates/core-tests.yaml@self parameters: runNativeTests: true - nativeAotRid: osx-arm64 + nativeAotRid: $(NativeAOTRid) platformName: .NET - MacOS - template: /external/Java.Interop/build-tools/automation/templates/fail-on-dirty-tree.yaml@self diff --git a/build-tools/automation/yaml-templates/variables.yaml b/build-tools/automation/yaml-templates/variables.yaml index 629ec32e7a1..cc638e08919 100644 --- a/build-tools/automation/yaml-templates/variables.yaml +++ b/build-tools/automation/yaml-templates/variables.yaml @@ -30,7 +30,7 @@ variables: - name: GitHub.Token value: $(github--pat--vs-mobiletools-engineering-service2) - name: HostedMacImage - value: macOS-15-arm64 + value: macOS-15 - name: HostedMacImageWithEmulator value: macOS-15 - name: SharedMacPool