Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLR hosting #9572

Draft
wants to merge 119 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
4c6b83d
Enable static linking with libc++
grendello Nov 26, 2024
e2f89a4
Remove C++ ABI compatibility sources
grendello Nov 26, 2024
e2ad767
Update apkdesc files
grendello Nov 26, 2024
33500bb
Playing around with some ideas
grendello Oct 31, 2024
95ecd76
More consistent use of std::string_view + remove unused code
grendello Nov 4, 2024
539b080
Making EmbeddedAssemblies a static type
grendello Nov 7, 2024
2aa6e2b
More cleanup
grendello Nov 13, 2024
07246e5
More move to static, more cleanup
grendello Nov 13, 2024
6649f01
MonodroidRuntime is static now
grendello Nov 13, 2024
51e007a
Buglets fixed
grendello Nov 14, 2024
497e094
Trying to find out why AppContext.GetData doesn't appear to work
grendello Nov 21, 2024
00d300f
Cleanup
grendello Nov 21, 2024
69a35ad
Lengths and offsets...
grendello Nov 25, 2024
01c77c0
Cleanup
grendello Nov 26, 2024
e0b1e57
Start using std::format and std::string_view string literals
grendello Nov 26, 2024
15ace79
A bit less of reinterpret_cast<>
grendello Nov 26, 2024
28c6439
Conversion to std::format continues
grendello Nov 27, 2024
98a4054
More std::format
grendello Nov 27, 2024
ac5c3ed
Friendlier, no need to use `std::format` directly in log_* anymore
grendello Nov 28, 2024
886ef40
Cleanup
grendello Nov 29, 2024
15d864f
Cleanup
grendello Nov 29, 2024
00f55b5
Update apkdesc files
grendello Nov 29, 2024
d383a44
std::format doesn't like null pointers when printing strings
grendello Nov 29, 2024
5a4d188
Address feedback
grendello Dec 3, 2024
18fd987
Enable static linking with libc++
grendello Nov 26, 2024
3f2b078
Remove C++ ABI compatibility sources
grendello Nov 26, 2024
541c402
Update apkdesc files
grendello Nov 26, 2024
cadc2b5
Playing around with some ideas
grendello Oct 31, 2024
0d4b21b
More consistent use of std::string_view + remove unused code
grendello Nov 4, 2024
7db3b37
Making EmbeddedAssemblies a static type
grendello Nov 7, 2024
a449f89
More cleanup
grendello Nov 13, 2024
b95077d
More move to static, more cleanup
grendello Nov 13, 2024
1d45842
MonodroidRuntime is static now
grendello Nov 13, 2024
7fb04ad
Buglets fixed
grendello Nov 14, 2024
430aea3
Trying to find out why AppContext.GetData doesn't appear to work
grendello Nov 21, 2024
5c728e7
Cleanup
grendello Nov 21, 2024
6e3b5e3
Lengths and offsets...
grendello Nov 25, 2024
6d88346
Cleanup
grendello Nov 26, 2024
ad67d54
Start using std::format and std::string_view string literals
grendello Nov 26, 2024
3bc283a
A bit less of reinterpret_cast<>
grendello Nov 26, 2024
bbbbb79
Conversion to std::format continues
grendello Nov 27, 2024
4e3fa71
More std::format
grendello Nov 27, 2024
96679f0
Friendlier, no need to use `std::format` directly in log_* anymore
grendello Nov 28, 2024
df0e22a
Cleanup
grendello Nov 29, 2024
4cb2c57
Cleanup
grendello Nov 29, 2024
41a3acf
Update apkdesc files
grendello Nov 29, 2024
c57ba46
std::format doesn't like null pointers when printing strings
grendello Nov 29, 2024
36a5945
Beginnings of CLR hosting
grendello Dec 2, 2024
8d3c5ba
Address feedback
grendello Dec 3, 2024
20fc6e7
First packaging steps + Java startup code changes
grendello Dec 3, 2024
d0faeb8
Build deps + application config for CLR
grendello Dec 3, 2024
555cd9c
Moving on: logging + timing
grendello Dec 4, 2024
77aa40a
Beginnings of initialization code
grendello Dec 4, 2024
6a5ce4c
Merge branch 'main' into dev/grendel/use-libc++
grendello Dec 5, 2024
5d96662
More environment work
grendello Dec 5, 2024
d8abae9
Merge branch 'main' into dev/grendel/clr-host
grendello Dec 5, 2024
bc699a5
Merge branch 'dev/grendel/use-libc++' into dev/grendel/clr-host
grendello Dec 5, 2024
f0c4ef3
Merge branch 'main' into dev/grendel/use-libc++
grendello Jan 7, 2025
75c296e
Merge branch 'dev/grendel/use-libc++' into dev/grendel/clr-host
grendello Jan 7, 2025
94f245f
Merge branch 'main' into dev/grendel/use-libc++
grendello Jan 9, 2025
e3c3a16
Merge branch 'dev/grendel/use-libc++' into dev/grendel/clr-host
grendello Jan 9, 2025
0db5414
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 10, 2025
14b675d
Add the CoreCLR runtime falvor
grendello Jan 10, 2025
7d6ec58
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 10, 2025
90e4840
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 13, 2025
67bcec9
New src/native layout
grendello Jan 13, 2025
c2e17d9
Reorg continued
grendello Jan 13, 2025
f36668c
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 14, 2025
b5fa47a
Build appears to be working
grendello Jan 14, 2025
0c2654c
Properly resolve library stubs from runtime packs
grendello Jan 14, 2025
8fa07fa
Fix java runtime jar inclusion
grendello Jan 14, 2025
b91865d
Recreate @(ResolvedRuntimePack) item group
grendello Jan 14, 2025
160c059
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 15, 2025
9f71a63
Double-check if a nuget package is indeed our runtime pack
grendello Jan 15, 2025
8b3977b
Don't package runtime stubs
grendello Jan 15, 2025
41d075e
Not needed
grendello Jan 15, 2025
0438495
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 16, 2025
b857673
Update to match `main`
grendello Jan 16, 2025
394a016
Remove unnecessary sources
grendello Jan 16, 2025
9ca6c05
Import changes from https://github.com/dotnet/android/pull/9686/
grendello Jan 16, 2025
425301c
Mono -> MonoVM
grendello Jan 16, 2025
2d4691f
Fixes
grendello Jan 16, 2025
198acae
Fixes and workarounds to make CoreCLR build happen
grendello Jan 16, 2025
9eef4c4
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 17, 2025
579505f
Hack to be able to use CoreCLR runtime pack we created
grendello Jan 17, 2025
66a32f5
Fake CoreCLR runtime pack works. Next step: use correct CoreCLR inste…
grendello Jan 17, 2025
79a7006
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 20, 2025
cc64d57
Add support for local version of CoreCLR runtime pack
grendello Jan 20, 2025
9421f41
Support for CoreCLR in xaprepare
grendello Jan 21, 2025
487dac0
Limit CoreCLR builds to android-arm64 for now
grendello Jan 21, 2025
3803f37
Build tweaks to make progress easier
grendello Jan 21, 2025
0e0b648
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 21, 2025
e47f577
A couple more hacks
grendello Jan 21, 2025
f027b24
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 21, 2025
c64912a
Fix JCW generation for CoreCLR
grendello Jan 22, 2025
7e8b92c
A handful of fixlets
grendello Jan 22, 2025
8041644
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 22, 2025
4ff8fd0
Fix JCW again
grendello Jan 22, 2025
130161e
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 22, 2025
276a4cf
Revert "Fix JCW again", trying to figure out what's actually broken
grendello Jan 22, 2025
d834edc
Add some temporary logging
grendello Jan 22, 2025
9906b4c
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 23, 2025
22fb1c3
Runtime config properties now stored in libxamarin-app.so
grendello Jan 23, 2025
af37286
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 24, 2025
57ed2b7
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 27, 2025
0fb2cfd
[WIP] Unicode strings support
grendello Jan 27, 2025
26ae8ef
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 28, 2025
6df7b62
More elegant solution to managing same strings with different encodings
grendello Jan 28, 2025
4b77a37
Add a missing variable
grendello Jan 28, 2025
61b19b6
One step closer
grendello Jan 28, 2025
120244d
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 28, 2025
ccb1c86
More work towards assembly store support in CLR
grendello Jan 29, 2025
6774e34
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 29, 2025
215189c
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 30, 2025
e080c70
Assembly stores support for CLR done
grendello Jan 30, 2025
6f2229b
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 31, 2025
2a421e7
On the road to first managed call
grendello Jan 31, 2025
2e0b0f6
Merge branch 'main' into dev/grendel/clr-host
grendello Jan 31, 2025
8ddc328
Hook into some error logging in CLR
grendello Jan 31, 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
14 changes: 14 additions & 0 deletions CLR-Host-Notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Notes

## Potential optimizations

* https://github.com/dotnet/runtime/blob/9b24fb60a19f62620ca1fc5e4eb2e3ae0b3b086d/src/coreclr/binder/assemblybindercommon.cpp#L844-L889
* Managed C++ assemblies aren't available on Unix, no point in looking for them
* `candidates[]` is `WCHAR*`, while `ProbeAppBundle` takes UTF-8 - no point in doing the
conversion here
* Host contract
* It might make sense to pass strings as Unicode to host and back, to avoid conversions.
p/invoke names for instance, can be Unicode. So can be the assembly names. Native library
names should be UTF-8, but we can generate lookup tables for those at application build time
(e.g. indexed by an xxHash of the Unicode version of the name) - no conversion at run time.
* We need declarations of all he possible HRESULT errors (`S_OK` etc)
14 changes: 11 additions & 3 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,18 @@
<MicrosoftAndroidSdkPackName Condition="$([MSBuild]::IsOSPlatform('osx'))">Microsoft.Android.Sdk.Darwin</MicrosoftAndroidSdkPackName>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAndroidPacksRootDir>$(BuildOutputDirectory)lib\packs\</MicrosoftAndroidPacksRootDir>
<AutoProvision Condition=" '$(AutoProvision)' == '' ">False</AutoProvision>
<AutoProvisionUsesSudo Condition=" '$(AutoProvisionUsesSudo)' == '' ">False</AutoProvisionUsesSudo>
<_XABinRelativeInstallPrefix>lib\xamarin.android</_XABinRelativeInstallPrefix>
<XAInstallPrefix Condition=" '$(XAInstallPrefix)' == '' ">$(MSBuildThisFileDirectory)bin\$(Configuration)\$(_XABinRelativeInstallPrefix)\</XAInstallPrefix>
<_MonoAndroidNETOutputRoot>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\</_MonoAndroidNETOutputRoot>
<_MonoAndroidNETDefaultOutDir>$(_MonoAndroidNETOutputRoot)$(AndroidApiLevel)\</_MonoAndroidNETDefaultOutDir>
<MicrosoftAndroidRefPackDir>$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidApiLevel)\$(AndroidPackVersion)\ref\$(DotNetTargetFramework)\</MicrosoftAndroidRefPackDir>
<MicrosoftAndroidSdkPackDir>$(BuildOutputDirectory)lib\packs\$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\</MicrosoftAndroidSdkPackDir>
<NativeRuntimeOutputRootDir>$(BuildOutputDirectory)lib\runtimes\</NativeRuntimeOutputRootDir>
<MicrosoftAndroidRefPackDir>$(MicrosoftAndroidPacksRootDir)Microsoft.Android.Ref.$(AndroidApiLevel)\$(AndroidPackVersion)\ref\$(DotNetTargetFramework)\</MicrosoftAndroidRefPackDir>
<MicrosoftAndroidSdkPackDir>$(MicrosoftAndroidPacksRootDir)$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\</MicrosoftAndroidSdkPackDir>
<MicrosoftAndroidSdkOutDir>$(MicrosoftAndroidSdkPackDir)\tools\</MicrosoftAndroidSdkOutDir>
<MicrosoftAndroidSdkAnalysisOutDir>$(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidLatestStableApiLevel)\$(AndroidPackVersion)\analyzers\dotnet\cs\</MicrosoftAndroidSdkAnalysisOutDir>
<MicrosoftAndroidSdkAnalysisOutDir>$(MicrosoftAndroidPacksRootDir)Microsoft.Android.Ref.$(AndroidLatestStableApiLevel)\$(AndroidPackVersion)\analyzers\dotnet\cs\</MicrosoftAndroidSdkAnalysisOutDir>
<MakeConcurrency Condition=" '$(MakeConcurrency)' == '' And '$(HostCpuCount)' != '' ">-j$(HostCpuCount)</MakeConcurrency>
<ManagedRuntime Condition=" '$(ManagedRuntime)' == '' And '$(OS)' != 'Windows_NT' ">mono</ManagedRuntime>
<ManagedRuntimeArgs Condition=" '$(ManagedRuntimeArgs)' == '' And '$(ManagedRuntime)' == 'mono' ">--debug=casts</ManagedRuntimeArgs>
Expand Down Expand Up @@ -216,5 +218,11 @@
<ItemGroup>
<AndroidAbiAndRuntimeFlavor Include="@(AndroidSupportedTargetJitAbi)" AndroidRuntime="Mono" />
<AndroidAbiAndRuntimeFlavor Include="@(AndroidSupportedTargetJitAbi)" AndroidRuntime="NativeAOT" />
<AndroidAbiAndRuntimeFlavor Include="@(AndroidSupportedTargetJitAbi)" AndroidRuntime="CoreCLR" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out if we should case it CoreClr or CoreCLR:

I found both, so we can probably decide which we prefer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like CoreCLR better, since CLR is an acronym

</ItemGroup>

<!-- TEMPORARY: to be removed once this PR is ready to be merged -->
<PropertyGroup>
<_LocalClrDirectory Condition=" Exists('$(AndroidToolchainDirectory)\clr') ">$(AndroidToolchainDirectory)\clr</_LocalClrDirectory>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ PREPARE_SCENARIO =
PREPARE_CI_PR ?= 0
PREPARE_CI ?= 0
PREPARE_AUTOPROVISION ?= 0
LOCAL_CLR ?=

_PREPARE_CI_MODE_PR_ARGS = --no-emoji --run-mode=CI
_PREPARE_CI_MODE_ARGS = $(_PREPARE_CI_MODE_PR_ARGS) -a
Expand Down Expand Up @@ -65,6 +66,10 @@ ifeq ($(XA_FORCE_COMPONENT_REFRESH),true)
_PREPARE_ARGS += -refresh
endif

ifneq ($(LOCAL_CLR),)
_PREPARE_ARGS += -p:_LocalClrDirectory="$(LOCAL_CLR)"
endif

_PREPARE_ARGS += $(PREPARE_ARGS)

include build-tools/scripts/msbuild.mk
Expand Down
9 changes: 8 additions & 1 deletion Xamarin.Android.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop.Tools.Diagnost
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop.Tools.Cecil", "external\Java.Interop\src\Java.Interop.Tools.Cecil\Java.Interop.Tools.Cecil.csproj", "{D48EE8D0-0A0A-4493-AEF5-DAF5F8CF86AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "native", "src\native\native.csproj", "{53EE4C57-1C03-405A-8243-8DA539546C88}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "native", "src\native\native-mono.csproj", "{53EE4C57-1C03-405A-8243-8DA539546C88}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}"
EndProject
Expand Down Expand Up @@ -125,6 +125,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Android.Sdk.Analy
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proguard-android", "src\proguard-android\proguard-android.csproj", "{5FD0133B-69E5-4474-9B67-9FD1D0150C70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "native-clr", "src\native\native-clr.csproj", "{39F49484-872A-489D-8E6B-3BC532DD571D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AnyCPU = Debug|AnyCPU
Expand Down Expand Up @@ -347,6 +349,10 @@ Global
{5FD0133B-69E5-4474-9B67-9FD1D0150C70}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{5FD0133B-69E5-4474-9B67-9FD1D0150C70}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{5FD0133B-69E5-4474-9B67-9FD1D0150C70}.Release|AnyCPU.Build.0 = Release|Any CPU
{39F49484-872A-489D-8E6B-3BC532DD571D}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{39F49484-872A-489D-8E6B-3BC532DD571D}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{39F49484-872A-489D-8E6B-3BC532DD571D}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{39F49484-872A-489D-8E6B-3BC532DD571D}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -406,6 +412,7 @@ Global
{A39B6D7C-6616-40D6-8AE4-C6CEE93D2708} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
{5E806C9F-1B67-4B6B-A6AB-258834250DBB} = {FFCF518F-2A4A-40A2-9174-2EE13B76C723}
{5FD0133B-69E5-4474-9B67-9FD1D0150C70} = {FFCF518F-2A4A-40A2-9174-2EE13B76C723}
{39F49484-872A-489D-8E6B-3BC532DD571D} = {FFCF518F-2A4A-40A2-9174-2EE13B76C723}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {53A1F287-EFB2-4D97-A4BB-4A5E145613F6}
Expand Down
27 changes: 22 additions & 5 deletions build-tools/create-packs/Microsoft.Android.Runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ projects that use the Microsoft.Android framework in .NET 6+.
DependsOnTargets="_GetLicense">
<PropertyGroup>
<FrameworkListFile Condition="'$(FrameworkListFile)' == ''">$(IntermediateOutputPath)$(AndroidRID)\RuntimeList.xml</FrameworkListFile>
<_RuntimeFlavorDirName Condition=" '$(AndroidRuntime)' == 'CoreCLR' ">clr</_RuntimeFlavorDirName>
<_RuntimeFlavorDirName Condition=" '$(AndroidRuntime)' == 'Mono' Or '$(AndroidRuntime)' == '' ">mono</_RuntimeFlavorDirName>
</PropertyGroup>

<ItemGroup>
Expand All @@ -41,12 +43,27 @@ projects that use the Microsoft.Android framework in .NET 6+.
<_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputRoot)$(AndroidLatestStableApiLevel)\Mono.Android.Export.dll" />
</ItemGroup>

<ItemGroup Condition=" '$(AndroidRuntime)' == 'CoreCLR' ">
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.debug.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.debug.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.release.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.release.so" />
</ItemGroup>

<ItemGroup Condition=" '$(AndroidRuntime)' == 'Mono' ">
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libmono-android.debug.so" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libmono-android.release.so" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libxamarin-debug-app-helper.so" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libxamarin-native-tracing.so" />
<_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libunwind_xamarin.a" />
<_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.debug.so" />
<_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.release.so" />
<_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-debug-app-helper.so" />
<_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-native-tracing.so" />
<_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libunwind_xamarin.a" />
</ItemGroup>

<ItemGroup Condition=" '$(AndroidRuntime)' != 'NativeAOT' ">
<!-- TODO: the Exists() checks must go away once we build CoreCLR host for all the targets -->
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\liblog.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\liblog.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libm.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libm.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libz.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libz.so" />
<_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so" />
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 4 additions & 12 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_fastdev_net6.jar" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_net6.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_fastdev_net6.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_clr.jar" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_fastdev_clr.jar" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_clr.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)java_runtime_fastdev_clr.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)manifestmerger.jar" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)proguard-android.txt" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)protobuf-net.dll" />
Expand Down Expand Up @@ -176,18 +180,6 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)K4os.Compression.LZ4.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ELFSharp.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ManifestOverlays\Timing.xml" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-arm64\libc.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-arm64\libm.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-arm\libc.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-arm\libm.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-x64\libc.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-x64\libm.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-x86\libc.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)libstubs\android-x86\libm.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)dsostubs\android-arm64\libarchive-dso-stub.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)dsostubs\android-arm\libarchive-dso-stub.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)dsostubs\android-x64\libarchive-dso-stub.so" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)dsostubs\android-x86\libarchive-dso-stub.so" />
</ItemGroup>
<ItemGroup>
<_MSBuildTargetsSrcFiles Include="$(MSBuildTargetsSrcDir)\Xamarin.Android.AvailableItems.targets" />
Expand Down
5 changes: 5 additions & 0 deletions build-tools/scripts/xa_build_configuration.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ set(NETCORE_APP_RUNTIME_DIR_ARM "@NETCORE_APP_RUNTIME_ANDROID_ARM@")
set(NETCORE_APP_RUNTIME_DIR_ARM64 "@NETCORE_APP_RUNTIME_ANDROID_ARM64@")
set(NETCORE_APP_RUNTIME_DIR_X86 "@NETCORE_APP_RUNTIME_ANDROID_X86@")
set(NETCORE_APP_RUNTIME_DIR_X86_64 "@NETCORE_APP_RUNTIME_ANDROID_X86_64@")

set(CORECLR_APP_RUNTIME_DIR_ARM "@CORECLR_APP_RUNTIME_ANDROID_ARM@")
set(CORECLR_APP_RUNTIME_DIR_ARM64 "@CORECLR_APP_RUNTIME_ANDROID_ARM64@")
set(CORECLR_APP_RUNTIME_DIR_X86 "@CORECLR_APP_RUNTIME_ANDROID_X86@")
set(CORECLR_APP_RUNTIME_DIR_X86_64 "@CORECLR_APP_RUNTIME_ANDROID_X86_64@")
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static class KnownProperties
public const string JavaSdkDirectory = "JavaSdkDirectory";
public const string JdkIncludePath = "JdkIncludePath";
public const string LibZipSourceFullPath = "LibZipSourceFullPath";
public const string LocalClrDirectory = "_LocalClrDirectory";
public const string ManagedRuntime = "ManagedRuntime";
public const string MicrosoftAndroidSdkOutDir = "MicrosoftAndroidSdkOutDir";
public const string MonoCecilVersion = "MonoCecilVersion";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace Xamarin.Android.Prepare
properties.Add (KnownProperties.JavaSdkDirectory, StripQuotes (@"@JavaSdkDirectory@"));
properties.Add (KnownProperties.JdkIncludePath, StripQuotes (@"@JdkIncludePath@"));
properties.Add (KnownProperties.LibZipSourceFullPath, StripQuotes (@"@LibZipSourceFullPath@"));
properties.Add (KnownProperties.LocalClrDirectory, StripQuotes (@"@_LocalClrDirectory@"));
properties.Add (KnownProperties.ManagedRuntime, StripQuotes (@"@ManagedRuntime@"));
properties.Add (KnownProperties.MicrosoftAndroidSdkOutDir, StripQuotes (@"@MicrosoftAndroidSdkOutDir@"));
properties.Add (KnownProperties.MonoCecilVersion, StripQuotes ("@MonoCecilVersion@"));
Expand Down
30 changes: 29 additions & 1 deletion build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ public static partial class Paths
public static string OpenJDKInstallDir => GetCachedPath (ref openJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), Defaults.JdkFolder));
public static string OpenJDKCacheDir => GetCachedPath (ref openJDKCacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));

// .NET 6
// .NET 6+
public static string NetcoreAppRuntimeAndroidARM => GetCachedPath (ref netcoreAppRuntimeAndroidARM, () => GetNetcoreAppRuntimePath (ctx, "arm"));
public static string NetcoreAppRuntimeAndroidARM64 => GetCachedPath (ref netcoreAppRuntimeAndroidARM64, () => GetNetcoreAppRuntimePath (ctx, "arm64"));
public static string NetcoreAppRuntimeAndroidX86 => GetCachedPath (ref netcoreAppRuntimeAndroidX86, () => GetNetcoreAppRuntimePath (ctx, "x86"));
public static string NetcoreAppRuntimeAndroidX86_64 => GetCachedPath (ref netcoreAppRuntimeAndroidX86_64, () => GetNetcoreAppRuntimePath (ctx, "x64"));

// CoreCLR
public static string CoreClrAppRuntimeAndroidARM => GetCachedPath (ref coreclrAppRuntimeAndroidARM, () => GetCoreClrAppRuntimePath (ctx, "arm"));
public static string CoreClrAppRuntimeAndroidARM64 => GetCachedPath (ref coreclrAppRuntimeAndroidARM64, () => GetCoreClrAppRuntimePath (ctx, "arm64"));
public static string CoreClrAppRuntimeAndroidX86 => GetCachedPath (ref coreclrAppRuntimeAndroidX86, () => GetCoreClrAppRuntimePath (ctx, "x86"));
public static string CoreClrAppRuntimeAndroidX86_64 => GetCachedPath (ref coreclrAppRuntimeAndroidX86_64, () => GetCoreClrAppRuntimePath (ctx, "x64"));

public static string MicrosoftNETWorkloadMonoPackageDir => Path.Combine (
XAPackagesDir,
$"microsoft.net.workload.mono.toolchain.{{0}}.manifest-{ctx.Properties.GetRequiredValue (KnownProperties.DotNetMonoManifestVersionBand)}",
Expand Down Expand Up @@ -242,6 +248,24 @@ static string GetNetcoreAppRuntimePath (Context ctx, string androidTarget)
);
}

static string GetCoreClrAppRuntimePath (Context ctx, string androidTarget)
{
string? localClrDir = ctx.Properties.GetValue (KnownProperties.LocalClrDirectory);
if (!String.IsNullOrEmpty (localClrDir)) {
return Path.Combine (localClrDir, "runtimes", $"android-{androidTarget}");
}

// TODO: The nuget id and the ref package version are guesses atm, since the CoreCLR packages don't exist yet
Log.Instance.Todo ("The nuget id and the ref package version are guesses atm, since the CoreCLR packages don't exist yet");
return Path.Combine (
XAPackagesDir,
$"microsoft.netcore.app.runtime.coreclr.android-{androidTarget}",
ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftNETCoreAppRefPackageVersion),
"runtimes",
$"android-{androidTarget}"
);
}

static string EnsureAndroidToolchainBinDirectories ()
{
if (androidToolchainBinDirectory != null)
Expand Down Expand Up @@ -278,6 +302,10 @@ static string GetCachedPath (ref string? variable, Func<string> creator)
static string? netcoreAppRuntimeAndroidARM64;
static string? netcoreAppRuntimeAndroidX86;
static string? netcoreAppRuntimeAndroidX86_64;
static string? coreclrAppRuntimeAndroidARM;
static string? coreclrAppRuntimeAndroidARM64;
static string? coreclrAppRuntimeAndroidX86;
static string? coreclrAppRuntimeAndroidX86_64;
}
}
}
Loading
Loading