Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
060ffd3
NativeAOT Android test working locally
jtschuster Jul 21, 2025
a3d30c1
Undo extra changes, add reference in tests.proj
jtschuster Jul 24, 2025
ae6a9ce
Remove emtpy 'if' case
jtschuster Jul 24, 2025
5797ccc
Merge branch 'main' of https://github.com/dotnet/runtime into Android…
jtschuster Jul 24, 2025
68b972a
Remove extra android->linux translations
jtschuster Jul 24, 2025
044b176
Remove redundant IsNativeAOT check
jtschuster Jul 25, 2025
d74d3ec
Fix build to work in CI
jtschuster Jul 28, 2025
ce32f11
Merge branch 'main' of https://github.com/dotnet/runtime into Android…
jtschuster Jul 28, 2025
87a4cca
Fix apkbuilder.cs errors after merge
jtschuster Jul 28, 2025
8de0a57
Undo deleted line in ILC.targets, build libs.tests in pipeline
jtschuster Jul 28, 2025
36dfe61
Add missing args to build command
jtschuster Jul 28, 2025
152ec03
Set CppCompilerAndLinker to NDK clang when targeting android
jtschuster Jul 28, 2025
0facf06
Ensure Android build runs after CopyNativeBinary
jtschuster Jul 28, 2025
407b4db
Merge branch 'main' into AndroidAppBuilderNaot
jtschuster Jul 28, 2025
5e7feaa
Test CI in Debug config
jtschuster Jul 30, 2025
56553a7
Merge branch 'main' into AndroidAppBuilderNaot
jtschuster Jul 30, 2025
3c86a91
Move leg to runtime-extra-platforms
jtschuster Jul 30, 2025
28600f9
Merge branch 'AndroidAppBuilderNaot' of https://github.com/jtschuster…
jtschuster Jul 30, 2025
05deb8f
Remove jobs from runtime
jtschuster Jul 30, 2025
248dddd
Exclude nativeaot test on non-nativeaot builds
jtschuster Jul 30, 2025
54b995d
Add thread.inl to interoplibinterface_java.cpp to fix loadLibrary fai…
jtschuster Jul 31, 2025
b7e58a1
Remove android rids from targetpack rids
jtschuster Jul 31, 2025
7e98286
Run release build in CI
jtschuster Jul 31, 2025
972719a
Use AppBundle as AndroidBundleDir as Helix expects
jtschuster Jul 31, 2025
d8ac52a
Merge branch 'main' into AndroidAppBuilderNaot
jtschuster Jul 31, 2025
0e306b2
Tighten OutputType condition in singlefile test targets
jtschuster Jul 31, 2025
2b93e83
Add job to runtime-extra-platforms-androidemulator.yml
jtschuster Aug 4, 2025
7137d36
Update CrossCompileAbi condition
jtschuster Aug 4, 2025
fcbbd79
Merge branch 'AndroidAppBuilderNaot' of https://github.com/jtschuster…
jtschuster Aug 4, 2025
b84c294
Update src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Nativ…
jtschuster Aug 4, 2025
904d59d
Use UseNativeAOTRuntime property to test if using nativeaot instead o…
jtschuster Aug 4, 2025
6a7b918
DirectPInvoke and DirectPInvokeList is not plural in naot
jtschuster Aug 4, 2025
1b05d92
Merge branch 'AndroidAppBuilderNaot' of https://github.com/jtschuster…
jtschuster Aug 4, 2025
5a0413b
Add null checks in JNI code
jtschuster Aug 5, 2025
222b805
Condition CoreCLR tests on the build not being for NativeAOT
jtschuster Aug 5, 2025
b61f83c
Run android tests unconditionally in extra-platforms builds
jtschuster Aug 5, 2025
ef83aa7
Copy Java files to publish dir, don't search for them in build dir
jtschuster Aug 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,45 @@ jobs:
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)

#
# Android arm64 devices and x64 emulators
# Build the whole product using CoreCLR and run functional tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: nativeaot
platforms:
- android_x64
- android_arm64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: coreclrContainsChange
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
jobParameters:
testGroup: innerloop
nameSuffix: NativeAOT
buildArgs: -s clr.aot+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:UseNativeAOTRuntime=true /p:RuntimeFlavor=nativeaot /p:TestNativeAOT=true
timeoutInMinutes: 120
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(variables['isRollingBuild'], true))
# extra steps, run tests
postBuildSteps:
- template: /eng/pipelines/libraries/helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['coreclrContainsChange'], true),
eq(variables['isRollingBuild'], true))
1 change: 0 additions & 1 deletion eng/testing/tests.android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == ''">AndroidTestRunner.dll</MainLibraryFileName>

<AndroidBuildDir>$(PublishDir)</AndroidBuildDir>
<AndroidBundleDir>$(BundleDir)</AndroidBundleDir>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions eng/testing/tests.singlefile.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType Condition="'$(TargetOS)' != 'android'">Exe</OutputType>

<BundleDir>$([MSBuild]::NormalizeDirectory('$(OutDir)', 'publish'))</BundleDir>
<RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath>
Expand Down Expand Up @@ -49,7 +49,8 @@

<ItemGroup>
<Compile Include="$(CommonTestPath)SingleFileTestRunner\SingleFileTestRunner.cs"
Link="Common\SingleFileTestRunner\SingleFileTestRunner.cs" />
Link="Common\SingleFileTestRunner\SingleFileTestRunner.cs"
Condition="'$(IsFunctionalTest)' != 'true'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<_targetOS>$(_originalTargetOS)</_targetOS>
<_linuxToken>linux-</_linuxToken>
<_linuxLibcFlavor Condition="$(_targetOS.StartsWith($(_linuxToken)))">$(_targetOS.SubString($(_linuxToken.Length)))</_linuxLibcFlavor>
<_linuxLibcFlavor Condition="'$(_targetOS)' == 'android'">bionic</_linuxLibcFlavor>
<_targetOS Condition="$(_targetOS.StartsWith($(_linuxToken)))">linux</_targetOS>

<!-- linux-bionic on ARM uses armel (softfp) ABI -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm'))">armv7</CrossCompileArch>

<CrossCompileAbi>gnu</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-bionic-'))">android21</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-bionic-')) or $(CrossCompileRid.StartsWith('android'))">android21</CrossCompileAbi>
<CrossCompileAbi Condition="$(CrossCompileRid.StartsWith('linux-musl-')) or $(CrossCompileRid.StartsWith('alpine-'))">musl</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-arm'">gnueabihf</CrossCompileAbi>
<CrossCompileAbi Condition="'$(CrossCompileRid)' == 'linux-bionic-arm'">androideabi21</CrossCompileAbi>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "threadstore.h"
#include "threadstore.inl"
#include "event.h"
#include "thread.inl"

#include "interoplibinterface.h"

Expand Down
9 changes: 8 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@
<ProjectReference Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Globalization.Tests\System.Globalization.Tests.csproj" Condition="'$(OS)' != 'Windows_NT'" />
</ItemGroup>

<ItemGroup Condition="'$(TestNativeAot)' == 'true'">
<ItemGroup Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'android'">
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Collections\tests\System.Collections.Tests.csproj" />
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.IO.Compression\tests\System.IO.Compression.Tests.csproj" />
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Linq.Expressions\tests\System.Linq.Expressions.Tests.csproj" />
Expand Down Expand Up @@ -606,6 +606,13 @@
<SmokeTestProject Include="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\JIT\*.Test.csproj"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'android' and '$(RuntimeFlavor)' == 'NativeAOT'">
<SmokeTestProject Include="$(RepoRoot)src\tests\FunctionalTests\Android\Device_Emulator\NativeAOT\*.Test.csproj"/>
</ItemGroup>
<ItemGroup>
<ProjectExclusions Include="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\NativeAOT\*.Test.csproj" />
</ItemGroup>

<ItemGroup Condition="('$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvossimulator') and '$(RuntimeFlavor)' == 'CoreCLR'">
<SmokeTestProject Remove="@(SmokeTestProject)" />
<SmokeTestProject Include="$(RepoRoot)\src\tests\FunctionalTests\iOS\Simulator\CoreCLR.Interpreter\*.Test.csproj"/>
Expand Down
14 changes: 13 additions & 1 deletion src/mono/msbuild/android/build/AndroidBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())</RuntimeIdentifier>
<!-- TODO: Revisit this.
We need to check for RuntimeFlavor setting as for runtime tests we always import CoreCLR props which force UseMonoRuntime=false (see: https://github.com/dotnet/runtime/issues/111919) -->
<UseMonoRuntime Condition="'$(RuntimeFlavor)' == 'coreclr'">false</UseMonoRuntime>
<UseMonoRuntime Condition="'$(RuntimeFlavor)' == 'coreclr' or '$(RuntimeFlavor)' == 'nativeaot'">false</UseMonoRuntime>
<UseMonoRuntime Condition="'$(UseMonoRuntime)' == '' or '$(RuntimeFlavor)' == 'mono'">true</UseMonoRuntime>
<UseMonoJustInterp Condition="'$(UseMonoRuntime)' == 'true' and '$(RunAOTCompilation)' == 'true' and '$(MonoForceInterpreter)' == 'true'">true</UseMonoJustInterp>

Expand All @@ -14,8 +14,15 @@
<_IsLibraryMode Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true</_IsLibraryMode>
<_ReadRuntimeComponentsManifestTargetName Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest</_ReadRuntimeComponentsManifestTargetName>

<StaticLinkedRuntime Condition="'$(RuntimeFlavor)' == 'nativeaot'">false</StaticLinkedRuntime>
<StaticLinkedRuntime Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(StaticLinkedRuntime)' == ''">false</StaticLinkedRuntime>

<!-- Android NDK uses x86_64 as the architecture for naming, even on MacOS arm64 -->
<NdkToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-x86_64</NdkToolchainPrebuiltOS>
<NdkToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64</NdkToolchainPrebuiltOS>
<NdkToolchainPrebuiltOS Condition="'$(HostOS)' == 'windows'">windows-x86_64</NdkToolchainPrebuiltOS>
<CppCompilerAndLinker>$(ANDROID_NDK_ROOT)\toolchains\llvm\prebuilt\$(NdkToolchainPrebuiltOS)\bin\clang</CppCompilerAndLinker>

<AndroidBuildAfterThisTarget Condition="'$(AndroidBuildAfterThisTarget)' == ''">Publish</AndroidBuildAfterThisTarget>
<AndroidBuildDependsOn Condition="'$(UseMonoRuntime)' == 'true'">
$(_ReadRuntimeComponentsManifestTargetName);
Expand All @@ -35,6 +42,11 @@
_AndroidGenerateAppBundle;
_AfterAndroidBuild
</AndroidBuildDependsOn>
<AndroidBuildDependsOn Condition="'$(UseNativeAOTRuntime)' == 'true'">
$(AndroidBuildDependsOn);
CopyNativeBinary;
_CopyAotSymbols
</AndroidBuildDependsOn>

<!-- When building on Helix $(_CommonTargetsDir) will be properly set, otherwise we have to set it to a in-tree location -->
<_CommonTargetsDir Condition="'$(_CommonTargetsDir)' == ''">$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', '..', 'common'))</_CommonTargetsDir>
Expand Down
4 changes: 3 additions & 1 deletion src/mono/msbuild/android/build/AndroidBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<PropertyGroup>
<AndroidBuildDir Condition="'$(AndroidBuildDir)' == ''">$([MSBuild]::NormalizeDirectory($(PublishDir)))</AndroidBuildDir>
<AndroidBundleDir Condition="'$(AndroidBundleDir)' == ''">$([MSBuild]::NormalizeDirectory('$(OutDir)', 'Bundle'))</AndroidBundleDir>
<AndroidBundleDir Condition="'$(AndroidBundleDir)' == ''">$([MSBuild]::NormalizeDirectory('$(OutDir)', 'AppBundle'))</AndroidBundleDir>

<BundleDir>$(AndroidBundleDir)</BundleDir>
</PropertyGroup>
Expand Down Expand Up @@ -239,6 +239,7 @@
We are using a private property to determine the target runtime, we should instead unify the resolution with Apple targets instead, (see: https://github.com/dotnet/runtime/issues/111923) -->
<_RuntimeFlavor>Mono</_RuntimeFlavor>
<_RuntimeFlavor Condition="'$(UseMonoRuntime)' == 'false' and '$(UseNativeAOTRuntime)' != 'true'">CoreCLR</_RuntimeFlavor>
<_RuntimeFlavor Condition="'$(UseNativeAOTRuntime)' == 'true'">nativeaot</_RuntimeFlavor>
</PropertyGroup>

<AndroidAppBuilderTask
Expand Down Expand Up @@ -290,4 +291,5 @@
RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)">
</RuntimeConfigParserTask>
</Target>

</Project>
Loading
Loading