diff --git a/Directory.Build.props b/Directory.Build.props index 7b78bd6efc0f6b..5eeb3ed7f86822 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -63,7 +63,7 @@ - src/mono/msbuild/apple/build/AppleBuild.targets - src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml - src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml - - src/tasks/AotCompilerTask/MonoAOTCompiler.props + - src/mono/msbuild/common/MonoAOTCompiler.props - src/tasks/AppleAppBuilder/Xcode.cs - src/tasks/MobileBuildTasks/Apple/AppleProject.cs - https://github.com/dotnet/sdk repo > src/Installer/redist-installer/targets/GeneratePKG.targets diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 76f22763eac181..a71adb42e82b3e 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -256,6 +256,14 @@ + + + + + + + + diff --git a/src/mono/msbuild/android/build/AndroidBuild.props b/src/mono/msbuild/android/build/AndroidBuild.props index 9263ef8a7c82d2..de95c1d581efbb 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.props +++ b/src/mono/msbuild/android/build/AndroidBuild.props @@ -1,18 +1,21 @@ $(TargetOS)-$(TargetArchitecture.ToLowerInvariant()) - true - true + + false + true + true <_HostOS Condition="$([MSBuild]::IsOSPlatform('Windows'))">windows <_HostOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx <_HostOS Condition="'$(_HostOS)' == ''">linux - <_IsLibraryMode Condition="'$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true - <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest + <_IsLibraryMode Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true + <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest Publish - + $(_ReadRuntimeComponentsManifestTargetName); _InitializeCommonProperties; _BeforeAndroidBuild; @@ -23,11 +26,19 @@ _AndroidGenerateAppBundle; _AfterAndroidBuild + + _InitializeCommonProperties; + _BeforeAndroidBuild; + _AndroidResolveReferences; + _AndroidGenerateAppBundle; + _AfterAndroidBuild + <_CommonTargetsDir Condition="'$(_CommonTargetsDir)' == ''">$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', '..', 'common')) - - + + + \ No newline at end of file diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index 6774939f2fba4e..b5c2a588962631 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -7,9 +7,6 @@ false - @@ -24,6 +21,8 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) $(PlatformTarget) + $(AssemblyName) + False @@ -38,10 +37,11 @@ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'Bundle')) $(AndroidBundleDir) - <_MonoHeaderPath>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0')) + $(CoreClrProjectRoot)hosts\inc - + @@ -94,7 +94,7 @@ <_AOTMode Condition="'$(UseMonoJustInterp)' != 'true'">Normal <_AOTMode Condition="'$(UseMonoJustInterp)' == 'true'">JustInterp - <_AOTMode Condition="'$(ForceFullAOT)' == 'true'">Full + <_AOTMode Condition="'$(ForceAOT)' == 'true' and '$(AOTWithLibraryFiles)' != 'true'">Full <_AotOutputType>AsmOnly @@ -112,33 +112,11 @@ <_AotOutputType>ObjectFile - - <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi - <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android - <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android - <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android - - - - <_AsOptions>-target $(_Triple) -c -x assembler - <_LdName>clang - <_LdOptions>-fuse-ld=lld - <_AsName>clang - - + - - - - - - - - - @@ -150,11 +128,6 @@ 21 - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) - <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) - - <_AotInputAssemblies Include="@(_AssembliesToBundleInternal)" Condition="'%(_AssembliesToBundleInternal._InternalForceInterpret)' != 'true'"> @@ -246,8 +219,7 @@ - @@ -255,7 +227,15 @@ <_NativeDependencies Include="$(LibraryOutputPath)" /> + + + <_RuntimeFlavor>Mono + <_RuntimeFlavor Condition="'$(UseMonoRuntime)' == 'false' and '$(UseNativeAOTRuntime)' != 'true'">CoreCLR + + + StripDebugSymbols="$(StripDebugSymbols)"> diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index 6625f122c63efb..c1e8952f835e76 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -12,6 +12,8 @@ true $(TargetOS)-$(TargetArchitecture.ToLowerInvariant()) + true true @@ -46,4 +48,5 @@ + \ No newline at end of file diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets index 0aafe5b5612d09..d14a4c7b79a069 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.targets +++ b/src/mono/msbuild/apple/build/AppleBuild.targets @@ -54,7 +54,7 @@ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'Bundle')) $(AppleBundleDir) - <_MonoHeaderPath Condition="'$(UseMonoRuntime)' != 'false' and '$(UseNativeAOTRuntime)' != 'true'">$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0')) <_AotModuleTablePath>$(AppleBundleDir)\modules.m $(AssemblyName) @@ -324,7 +324,7 @@ InvariantGlobalization="$(InvariantGlobalization)" IsLibraryMode="$(_IsLibraryMode)" MainLibraryFileName="$(MainLibraryFileName)" - MonoRuntimeHeaders="$(_MonoHeaderPath)" + MonoRuntimeHeaders="$(RuntimeHeaders)" NativeMainSource="$(NativeMainSource)" NativeDependencies="@(NativeDependencies)" Optimized="$(Optimized)" diff --git a/src/mono/msbuild/common/LibraryBuilder.targets b/src/mono/msbuild/common/LibraryBuilder.targets index 9ea4a4562ee1e9..bb93a3b8ca54f0 100644 --- a/src/mono/msbuild/common/LibraryBuilder.targets +++ b/src/mono/msbuild/common/LibraryBuilder.targets @@ -33,7 +33,7 @@ ExtraLinkerArguments="@(_ExtraLinkerArgs)" ExtraSources="@(_ExtraLibrarySources)" IsSharedLibrary="$(_IsSharedLibrary)" - MonoRuntimeHeaders="$(_MonoHeaderPath)" + MonoRuntimeHeaders="$(RuntimeHeaders)" Name="$(AssemblyName)" OutputDirectory="$(BundleDir)" RuntimeIdentifier="$(RuntimeIdentifier)" diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.props b/src/mono/msbuild/common/MonoAOTCompiler.props similarity index 82% rename from src/tasks/AotCompilerTask/MonoAOTCompiler.props rename to src/mono/msbuild/common/MonoAOTCompiler.props index 1fc8e8f41adf50..d717c8e2df3a44 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.props +++ b/src/mono/msbuild/common/MonoAOTCompiler.props @@ -4,8 +4,6 @@ - - @@ -15,12 +13,6 @@ - - - - - - @@ -28,7 +20,9 @@ - + + + @@ -36,4 +30,14 @@ + + <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi + <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android + <_AsOptions>-target $(_Triple) -c -x assembler + <_LdName>clang + <_LdOptions>-fuse-ld=lld + <_AsName>clang + diff --git a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj index 8d9a5f20f6e83d..587f7590b31235 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj +++ b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj @@ -17,6 +17,7 @@ + diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index 43e92d34c84818..8917de08365c0e 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -2,151 +2,39 @@ Mono Exe - false $(NetCoreAppCurrent) android-$(TargetArchitecture) true true Link false + $(ForceAOT) + True + HelloAndroid + $(AssemblyName).dll + true + + <_UseAotDataFile Condition="'$(RunAOTCompilation)' == 'true'">false - - - - - - - <_MobileIntermediateOutputPath>$(IntermediateOutputPath)mobile - - - - - False - True - $(PublishDir)apk\ - - - - - @(MonoAOTCompilerDefaultAotArguments, ';') - @(MonoAOTCompilerDefaultProcessArguments, ';') - - - - - - - - - - - - - - - - <_AotOutputType>Library - <_AotLibraryFormat>So - <_AotMode Condition="'$(AotMode)' == ''">Normal - - - - <_AotOutputType>AsmOnly - <_AotModulesTablePath>$(ApkDir)\modules.c - <_AotMode Condition="'$(AotMode)' == ''">Full - - - - 21 - + + - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) - <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) - - - - <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi - <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android - <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android - <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android - - - - <_AsOptions>-target $(_Triple) -c -x assembler - <_LdName>clang - <_LdOptions>-fuse-ld=lld - <_AsName>clang - - - - - - - - $(MicrosoftNetCoreAppRuntimePackDir)runtimes\android-$(TargetArchitecture)\native\include\mono-2.0 - $(CoreClrProjectRoot)hosts\inc - - - - - - - - - - - + + - - - - + AfterTargets="_AfterAndroidBuild" + DependsOnTargets="$(AndroidBuildDependsOn)" > diff --git a/src/mono/sample/Android/Makefile b/src/mono/sample/Android/Makefile index 82539298194b20..f0be463045a7c6 100644 --- a/src/mono/sample/Android/Makefile +++ b/src/mono/sample/Android/Makefile @@ -44,7 +44,7 @@ run: appbuilder /p:ForceAOT=$(AOT) \ /p:AOTWithLibraryFiles=$(AOT_WITH_LIBRARY_FILES) \ /p:MonoForceInterpreter=$(INTERP) \ - /p:UseLLVM=$(USE_LLVM) \ + /p:MonoEnableLLVM=$(USE_LLVM) \ /p:RunActivity=false \ '/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' \ /p:RuntimeFlavor=$(RUNTIME_FLAVOR) \ diff --git a/src/mono/sample/mbr/apple/AppleDelta.csproj b/src/mono/sample/mbr/apple/AppleDelta.csproj index 716fd9b61c64fe..12706ebedeb0fc 100644 --- a/src/mono/sample/mbr/apple/AppleDelta.csproj +++ b/src/mono/sample/mbr/apple/AppleDelta.csproj @@ -27,7 +27,7 @@ - - + diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj index 35e3f5892c3d40..2a5fce2048862e 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj @@ -23,11 +23,6 @@ - - - PreserveNewest - - diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Android.Device_Emulator.LibraryMode_Aot_Llvm.Test.csproj b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Android.Device_Emulator.LibraryMode_Aot_Llvm.Test.csproj new file mode 100644 index 00000000000000..7a80fe0814e636 --- /dev/null +++ b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Android.Device_Emulator.LibraryMode_Aot_Llvm.Test.csproj @@ -0,0 +1,25 @@ + + + Exe + false + true + true + $(NetCoreAppCurrent) + Android.Device_Emulator.LibraryMode_Aot_Llvm.Test.dll + 42 + true + true + true + shared + true + + + + + + + + + + + diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/ILLink.Descriptors.xml b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/ILLink.Descriptors.xml new file mode 100644 index 00000000000000..96491444910b04 --- /dev/null +++ b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/ILLink.Descriptors.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Program.cs b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Program.cs new file mode 100644 index 00000000000000..916d1f1aa03b80 --- /dev/null +++ b/src/tests/FunctionalTests/Android/Device_Emulator/LibraryMode_AOT_LLVM/Program.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.InteropServices; + +public static class Program +{ + [UnmanagedCallersOnly(EntryPoint = nameof(SayHello))] + public static void SayHello() + { + Console.WriteLine("Called from native! Hello!"); + } + + public static int Main() + { + Console.WriteLine("Hello, Android!"); // logcat + return 42; + } +}