From 4981587e5b4af560d7fc72e137d1aec01475a229 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 31 Mar 2021 09:09:40 -0400 Subject: [PATCH 01/32] Initial support for compiling clr runtime subset against maccatalyst --- .../System.Private.CoreLib.csproj | 8 ++ .../src/System/Environment.iOS.cs | 105 ++++++++++++++++++ src/coreclr/clrdefinitions.cmake | 4 + src/coreclr/dlls/mscoree/CMakeLists.txt | 4 + .../dlls/mscoree/coreclr/CMakeLists.txt | 11 +- src/coreclr/jit/CMakeLists.txt | 2 +- src/coreclr/pal/src/CMakeLists.txt | 4 + src/coreclr/pal/src/configure.cmake | 17 ++- src/coreclr/pal/src/map/virtual.cpp | 10 +- src/coreclr/pal/src/misc/dbgmsg.cpp | 2 + src/coreclr/pal/src/misc/msgbox.cpp | 5 + src/coreclr/vm/pinvokeoverride.cpp | 2 + src/native/corehost/CMakeLists.txt | 2 +- .../corehost/apphost/static/CMakeLists.txt | 12 +- .../hostpolicy/hostpolicy_context.cpp | 3 +- 15 files changed, 178 insertions(+), 13 deletions(-) create mode 100644 src/coreclr/System.Private.CoreLib/src/System/Environment.iOS.cs diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index f927f1f64193a..23745e5c1c77c 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -20,6 +20,8 @@ $(MSBuildThisFileDirectory)src\ILLink\ true + + true @@ -286,6 +288,12 @@ + + + + Common\Interop\OSX\Interop.SearchPath.cs + + diff --git a/src/coreclr/System.Private.CoreLib/src/System/Environment.iOS.cs b/src/coreclr/System.Private.CoreLib/src/System/Environment.iOS.cs new file mode 100644 index 0000000000000..372805e70086e --- /dev/null +++ b/src/coreclr/System.Private.CoreLib/src/System/Environment.iOS.cs @@ -0,0 +1,105 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Threading; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using NSSearchPathDirectory = Interop.Sys.NSSearchPathDirectory; + +namespace System +{ + public static partial class Environment + { + private static Dictionary? s_specialFolders; + + private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) + { + if (s_specialFolders == null) + { + Interlocked.CompareExchange(ref s_specialFolders, new Dictionary(), null); + } + + string? path; + lock (s_specialFolders) + { + if (!s_specialFolders.TryGetValue(folder, out path)) + { + path = GetSpecialFolder(folder) ?? string.Empty; + s_specialFolders[folder] = path; + } + } + return path; + } + + private static string? GetSpecialFolder(SpecialFolder folder) + { + switch (folder) + { + // TODO: fix for tvOS (https://github.com/dotnet/runtime/issues/34007) + // The "normal" NSDocumentDirectory is a read-only directory on tvOS + // and that breaks a lot of assumptions in the runtime and the BCL + + case SpecialFolder.Personal: + case SpecialFolder.LocalApplicationData: + return Interop.Sys.SearchPath(NSSearchPathDirectory.NSDocumentDirectory); + + case SpecialFolder.ApplicationData: + // note: at first glance that looked like a good place to return NSLibraryDirectory + // but it would break isolated storage for existing applications + return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, ".config"); + + case SpecialFolder.Resources: + return Interop.Sys.SearchPath(NSSearchPathDirectory.NSLibraryDirectory); // older (8.2 and previous) would return String.Empty + + case SpecialFolder.Desktop: + case SpecialFolder.DesktopDirectory: + return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Desktop"); + + case SpecialFolder.MyMusic: + return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Music"); + + case SpecialFolder.MyPictures: + return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Pictures"); + + case SpecialFolder.Templates: + return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, "Templates"); + + case SpecialFolder.MyVideos: + return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Videos"); + + case SpecialFolder.CommonTemplates: + return "/usr/share/templates"; + + case SpecialFolder.Fonts: + return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, ".fonts"); + + case SpecialFolder.Favorites: + return CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, "Favorites"); + + case SpecialFolder.ProgramFiles: + return Interop.Sys.SearchPath(NSSearchPathDirectory.NSApplicationDirectory); + + case SpecialFolder.InternetCache: + return Interop.Sys.SearchPath(NSSearchPathDirectory.NSCachesDirectory); + + case SpecialFolder.UserProfile: + return GetEnvironmentVariable("HOME"); + + case SpecialFolder.CommonApplicationData: + return "/usr/share"; + + default: + return string.Empty; + } + + static string CombineSearchPath(NSSearchPathDirectory searchPath, string subdirectory) + { + string? path = Interop.Sys.SearchPath(searchPath); + return path != null ? + Path.Combine(path, subdirectory) : + string.Empty; + } + } + } +} diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index 115031ff49b6c..181fdfd9f4b56 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -220,6 +220,10 @@ if(CLR_CMAKE_TARGET_OSX) add_definitions(-DFEATURE_WRITEBARRIER_COPY) endif(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_MACCATALYST) + add_definitions(-DTARGET_MACCATALYST) +endif(CLR_CMAKE_TARGET_MACCATALYST) + if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) add_compile_definitions($<$>>:FEATURE_EH_FUNCLETS>) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) diff --git a/src/coreclr/dlls/mscoree/CMakeLists.txt b/src/coreclr/dlls/mscoree/CMakeLists.txt index 4571b196aaa94..a3b2de2f3c84d 100644 --- a/src/coreclr/dlls/mscoree/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/CMakeLists.txt @@ -15,6 +15,10 @@ list(APPEND CLR_SOURCES Native.rc ) +if(CLR_CMAKE_TARGET_MACCATALYST) + add_definitions(-DTARGET_MACCATALYST) +endif(CLR_CMAKE_TARGET_MACCATALYST) + set (DEF_SOURCES mscorwks_ntdef.src ) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index b22ccf1a6bc58..997aad3c1c624 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -50,11 +50,11 @@ else(CLR_CMAKE_HOST_WIN32) set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) - if(CLR_CMAKE_TARGET_OSX) + if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST) # These options are used to force every object to be included even if it's unused. set(START_WHOLE_ARCHIVE -force_load) set(END_WHOLE_ARCHIVE ) - endif(CLR_CMAKE_TARGET_OSX) + endif(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST) set_exports_linker_option(${EXPORTS_FILE}) @@ -107,10 +107,15 @@ set(CORECLR_LIBRARIES ildbsymlib utilcode v3binder - System.Globalization.Native-Static interop ) +if(NOT CLR_CMAKE_TARGET_MACCATALYST) + list(APPEND CORECLR_LIBRARIES + System.Globalization.Native-Static + ) +endif() + if(CLR_CMAKE_TARGET_WIN32) list(APPEND CORECLR_LIBRARIES ${STATIC_MT_CRT_LIB} diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 3eb595b9eaded..92b769f5fc010 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -466,7 +466,7 @@ endif (FEATURE_MERGE_JIT_AND_ENGINE) # Creates a static library "clrjit_static" to link into the VM. add_subdirectory(static) -if (CLR_CMAKE_TARGET_OSX AND CLR_CMAKE_TARGET_ARCH_ARM64) +if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST) AND CLR_CMAKE_TARGET_ARCH_ARM64) set(TARGET_OS_NAME unix_osx) # Apple Arm64 has a special ABI, distinguish it. elseif (CLR_CMAKE_TARGET_UNIX) set(TARGET_OS_NAME unix) diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt index cde932098692d..14585efee1a82 100644 --- a/src/coreclr/pal/src/CMakeLists.txt +++ b/src/coreclr/pal/src/CMakeLists.txt @@ -55,6 +55,10 @@ if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND) add_definitions(-DFEATURE_USE_SYSTEM_LIBUNWIND) endif(CLR_CMAKE_USE_SYSTEM_LIBUNWIND) +if(CLR_CMAKE_TARGET_MACCATALYST) + add_definitions(-DTARGET_MACCATALYST) +endif(CLR_CMAKE_TARGET_MACCATALYST) + if(CLR_CMAKE_TARGET_OSX) add_definitions(-DTARGET_OSX) if(CLR_CMAKE_TARGET_ARCH_AMD64) diff --git a/src/coreclr/pal/src/configure.cmake b/src/coreclr/pal/src/configure.cmake index ee4a3241196ea..24649b335d263 100644 --- a/src/coreclr/pal/src/configure.cmake +++ b/src/coreclr/pal/src/configure.cmake @@ -14,7 +14,7 @@ elseif(CLR_CMAKE_TARGET_SUNOS) set(CMAKE_REQUIRED_INCLUDES /opt/local/include) endif() -if(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST) set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE) elseif(NOT CLR_CMAKE_TARGET_FREEBSD AND NOT CLR_CMAKE_TARGET_NETBSD) set(CMAKE_REQUIRED_DEFINITIONS "-D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L") @@ -1321,7 +1321,17 @@ if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64) set(CMAKE_REQUIRED_LIBRARIES) endif() -if(CLR_CMAKE_TARGET_OSX) +if(CLR_CMAKE_TARGET_MACCATALYST) + set(HAVE__NSGETENVIRON 1) + set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1) + set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))") + set(PAL_PT_ATTACH PT_ATTACH) + set(PAL_PT_DETACH PT_DETACH) + set(PAL_PT_READ_D PT_READ_D) + set(PAL_PT_WRITE_D PT_WRITE_D) + set(HAS_FTRUNCATE_LENGTH_ISSUE 1) + set(HAVE_SCHED_OTHER_ASSIGNABLE 1) +elseif(CLR_CMAKE_TARGET_OSX) set(HAVE__NSGETENVIRON 1) set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1) set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))") @@ -1331,7 +1341,6 @@ if(CLR_CMAKE_TARGET_OSX) set(PAL_PT_WRITE_D PT_WRITE_D) set(HAS_FTRUNCATE_LENGTH_ISSUE 1) set(HAVE_SCHED_OTHER_ASSIGNABLE 1) - elseif(CLR_CMAKE_TARGET_FREEBSD) set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0) set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))") @@ -1374,7 +1383,7 @@ else() # Anything else is Linux set(PAL_PT_WRITE_D PTRACE_POKEDATA) set(HAS_FTRUNCATE_LENGTH_ISSUE 0) set(HAVE_SCHED_OTHER_ASSIGNABLE 1) -endif(CLR_CMAKE_TARGET_OSX) +endif(CLR_CMAKE_TARGET_MACCATALYST) check_struct_has_member( "struct statfs" diff --git a/src/coreclr/pal/src/map/virtual.cpp b/src/coreclr/pal/src/map/virtual.cpp index 456254bdbbb9a..a40ec8ec840e8 100644 --- a/src/coreclr/pal/src/map/virtual.cpp +++ b/src/coreclr/pal/src/map/virtual.cpp @@ -1760,7 +1760,7 @@ VirtualProtect( return bRetVal; } -#if defined(HOST_OSX) && defined(HOST_ARM64) +#if defined(HOST_OSX) && defined(HOST_ARM64) && !defined(TARGET_MACCATALYST) bool PAL_JITWriteEnableHolder::JITWriteEnable(bool writeEnable) { @@ -1777,6 +1777,14 @@ PAL_JITWriteEnableHolder::JITWriteEnable(bool writeEnable) } #endif +#if defined(TARGET_MACCATALYST) +bool +PAL_JITWriteEnableHolder::JITWriteEnable(bool writeEnable) +{ + return false; +} +#endif + #if HAVE_VM_ALLOCATE //--------------------------------------------------------------------------------------- // diff --git a/src/coreclr/pal/src/misc/dbgmsg.cpp b/src/coreclr/pal/src/misc/dbgmsg.cpp index a41d2d1036b47..7d01d12953708 100644 --- a/src/coreclr/pal/src/misc/dbgmsg.cpp +++ b/src/coreclr/pal/src/misc/dbgmsg.cpp @@ -821,6 +821,7 @@ void PAL_DisplayDialog(const char *szTitle, const char *szText) if (cfsText != NULL) { CFOptionFlags response; +#if !defined(TARGET_MACCATALYST) CFUserNotificationDisplayAlert(0, // Never time-out, wait for user to hit 'OK' 0, // No flags NULL, // Default icon @@ -832,6 +833,7 @@ void PAL_DisplayDialog(const char *szTitle, const char *szText) NULL, // No alternate button NULL, // No third button &response); // User's response (discarded) +#endif CFRelease(cfsText); } CFRelease(cfsTitle); diff --git a/src/coreclr/pal/src/misc/msgbox.cpp b/src/coreclr/pal/src/misc/msgbox.cpp index 9a76cc8b5c8cb..70e472ab46da6 100644 --- a/src/coreclr/pal/src/misc/msgbox.cpp +++ b/src/coreclr/pal/src/misc/msgbox.cpp @@ -311,7 +311,9 @@ MessageBoxA( cfsButton1 = CFSTR("Abort"); cfsButton2 = CFSTR("Retry"); cfsButton3 = CFSTR("Ignore"); +#if !defined(TARGET_MACCATALYST) alertFlags = kCFUserNotificationCautionAlertLevel; +#endif break; case MB_YESNO: @@ -330,6 +332,7 @@ MessageBoxA( break; } +#if !defined(TARGET_MACCATALYST) CFUserNotificationDisplayAlert(0 /* no time out */, alertFlags, NULL /* iconURL */, NULL /* soundURL */, NULL /* localizationURL */, cfsTitle, cfsText, cfsButton1, cfsButton2, cfsButton3, &response); @@ -390,8 +393,10 @@ MessageBoxA( } break; } +#endif } else + { // We're not in a login session, e.g., running via ssh, and so bringing // up a message box would be bad form. diff --git a/src/coreclr/vm/pinvokeoverride.cpp b/src/coreclr/vm/pinvokeoverride.cpp index 2f4f0924142aa..bcf4f2766e1dd 100644 --- a/src/coreclr/vm/pinvokeoverride.cpp +++ b/src/coreclr/vm/pinvokeoverride.cpp @@ -23,10 +23,12 @@ static PInvokeOverrideFn* s_overrideImpl = nullptr; // here we handle PInvokes whose implementation is always statically linked (even in .so/.dll case) static const void* DefaultResolveDllImport(const char* libraryName, const char* entrypointName) { +#if !defined(TARGET_MACCATALYST) if (strcmp(libraryName, GLOBALIZATION_DLL_NAME) == 0) { return GlobalizationResolveDllImport(entrypointName); } +#endif return nullptr; } diff --git a/src/native/corehost/CMakeLists.txt b/src/native/corehost/CMakeLists.txt index 3ce1d78bec72c..04a2ef65369df 100644 --- a/src/native/corehost/CMakeLists.txt +++ b/src/native/corehost/CMakeLists.txt @@ -27,7 +27,7 @@ add_subdirectory(hostcommon) add_subdirectory(fxr) add_subdirectory(hostpolicy) -if (NOT RUNTIME_FLAVOR STREQUAL Mono) +if ((NOT RUNTIME_FLAVOR STREQUAL Mono) AND (NOT CLR_CMAKE_TARGET_MACCATALYST)) add_subdirectory(apphost) add_subdirectory(dotnet) add_subdirectory(nethost) diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index c9222058ffdb8..38366c88e195e 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -123,17 +123,17 @@ if(CLR_CMAKE_TARGET_WIN32) RuntimeObject.lib ) + + set(RUNTIMEINFO_LIB runtimeinfo) else() set(NATIVE_LIBS coreclr_static - System.Globalization.Native-Static System.IO.Compression.Native-Static System.Net.Security.Native-Static System.Native-Static - System.Security.Cryptography.Native.OpenSsl-Static palrt coreclrpal @@ -141,6 +141,14 @@ else() nativeresourcestring ) + + if(NOT CLR_CMAKE_TARGET_MACCATALYST) + list(APPEND NATIVE_LIBS + System.Globalization.Native-Static + System.Security.Cryptography.Native.OpenSsl-Static + ) + endif() + # additional requirements for System.IO.Compression.Native include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake) append_extra_compression_libs(NATIVE_LIBS) diff --git a/src/native/corehost/hostpolicy/hostpolicy_context.cpp b/src/native/corehost/hostpolicy/hostpolicy_context.cpp index 4c7ad15f2cb2b..29a24d81369e5 100644 --- a/src/native/corehost/hostpolicy/hostpolicy_context.cpp +++ b/src/native/corehost/hostpolicy/hostpolicy_context.cpp @@ -54,6 +54,7 @@ namespace // Check if given function belongs to one of statically linked libraries and return a pointer if found. const void* STDMETHODCALLTYPE pinvoke_override(const char* libraryName, const char* entrypointName) { +#if !defined(TARGET_MACCATALYST) #if defined(_WIN32) if (strcmp(libraryName, "System.IO.Compression.Native") == 0) { @@ -87,7 +88,7 @@ namespace return CryptoAppleResolveDllImport(entrypointName); } #endif - +#endif return nullptr; } #endif From b697a831b1688fe41764d6d0564be818545d46b3 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 31 Mar 2021 09:52:43 -0400 Subject: [PATCH 02/32] Fix build on x64 --- src/coreclr/pal/src/map/virtual.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/pal/src/map/virtual.cpp b/src/coreclr/pal/src/map/virtual.cpp index a40ec8ec840e8..20e15a71f1a2e 100644 --- a/src/coreclr/pal/src/map/virtual.cpp +++ b/src/coreclr/pal/src/map/virtual.cpp @@ -1777,7 +1777,7 @@ PAL_JITWriteEnableHolder::JITWriteEnable(bool writeEnable) } #endif -#if defined(TARGET_MACCATALYST) +#if defined(HOST_ARM64) && defined(TARGET_MACCATALYST) bool PAL_JITWriteEnableHolder::JITWriteEnable(bool writeEnable) { From dd65b4eb09ed604d1db092c84426e56d5cce36b0 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 20 Apr 2021 20:44:35 -0400 Subject: [PATCH 03/32] Allow 'clr' subset to work for Mac Catalyst --- eng/Subsets.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index d9730ea2c4bf0..260804a89b3a2 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -42,7 +42,8 @@ - clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages + clr.native+clr.corelib + $(DefaultCoreClrSubsets)+linuxdac+clr.tools+clr.nativecorelib+clr.packages mono.llvm+ mono.llvm+ From 9a0b66780380cf39a612d4bc92a79e53975cb28e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 20 Apr 2021 20:44:56 -0400 Subject: [PATCH 04/32] Re-order, so single file host builds after -DTARGET_MACCATALYST is imported --- src/coreclr/CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 8f82d83fa4b73..9b68f71c77f77 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -55,14 +55,6 @@ include(pgosupport.cmake) #--------------------------------------------------- include(components.cmake) -#--------------------------- -# Build the single file host -#--------------------------- -if(NOT CLR_CROSS_COMPONENTS_BUILD) - set(CLR_SINGLE_FILE_HOST_ONLY 1) - add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static) - add_dependencies(runtime singlefilehost) -endif() #------------------------- # Enable C++ EH with SEH #------------------------- @@ -143,6 +135,15 @@ endif(CLR_CMAKE_HOST_WIN32) #---------------------------------- include(clrdefinitions.cmake) +#--------------------------- +# Build the single file host +#--------------------------- +if(NOT CLR_CROSS_COMPONENTS_BUILD) + set(CLR_SINGLE_FILE_HOST_ONLY 1) + add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static) + add_dependencies(runtime singlefilehost) +endif() + if(FEATURE_STANDALONE_GC) add_definitions(-DFEATURE_STANDALONE_GC) add_subdirectory(gc) From c813a320752293888386e9b0bd29e63b857e34a5 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 20 Apr 2021 21:41:10 -0400 Subject: [PATCH 05/32] Don't build/depend on Mono corelib --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 22e1325b211d5..9fa89e8eb2de8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -17,7 +17,7 @@ Solaris Linux windows - true + true From 914c0e64467f210058db1f0e29e93bae61c9e640 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 20 Apr 2021 22:11:14 -0400 Subject: [PATCH 06/32] Better handling of runtimeflavor --- Directory.Build.props | 2 +- eng/Subsets.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9fa89e8eb2de8..22e1325b211d5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -17,7 +17,7 @@ Solaris Linux windows - true + true diff --git a/eng/Subsets.props b/eng/Subsets.props index 260804a89b3a2..942fe977407fa 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -38,7 +38,7 @@ Mono Mono - CoreCLR + CoreCLR From 5de69c29f6af889ce902a2c58c95ec9d40e6a1df Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 20 Apr 2021 22:13:10 -0400 Subject: [PATCH 07/32] Fix --- eng/Subsets.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 942fe977407fa..c92128d764632 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -38,7 +38,7 @@ Mono Mono - CoreCLR + CoreCLR From 397849d6ce74e4396b01a836651da9bb6804b55f Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 21 Apr 2021 10:09:05 -0400 Subject: [PATCH 08/32] Don't do XplatEventSource on Catalyst --- src/coreclr/clr.featuredefines.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/clr.featuredefines.props b/src/coreclr/clr.featuredefines.props index cd6569b48b21a..183a002558e94 100644 --- a/src/coreclr/clr.featuredefines.props +++ b/src/coreclr/clr.featuredefines.props @@ -13,7 +13,7 @@ - true + true true true From 3694620731bd434983b05ea602d511b89c55333b Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 22 Apr 2021 14:33:26 -0400 Subject: [PATCH 09/32] Add System.Globalization.Native to build. Removes need for invariant mode THIS WILL BREAK MONO MACCATALYST --- src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt | 7 +------ src/coreclr/vm/pinvokeoverride.cpp | 2 -- src/libraries/Native/Unix/CMakeLists.txt | 1 + .../Native/Unix/System.Globalization.Native/CMakeLists.txt | 2 +- src/native/corehost/apphost/static/CMakeLists.txt | 2 +- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index 62fb5b9bc2c37..3b8bf9f6cb7f9 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -107,15 +107,10 @@ set(CORECLR_LIBRARIES ildbsymlib utilcode v3binder + System.Globalization.Native-Static interop ) -if(NOT CLR_CMAKE_TARGET_MACCATALYST) - list(APPEND CORECLR_LIBRARIES - System.Globalization.Native-Static - ) -endif() - if(CLR_CMAKE_TARGET_WIN32) list(APPEND CORECLR_LIBRARIES ${STATIC_MT_CRT_LIB} diff --git a/src/coreclr/vm/pinvokeoverride.cpp b/src/coreclr/vm/pinvokeoverride.cpp index bcf4f2766e1dd..2f4f0924142aa 100644 --- a/src/coreclr/vm/pinvokeoverride.cpp +++ b/src/coreclr/vm/pinvokeoverride.cpp @@ -23,12 +23,10 @@ static PInvokeOverrideFn* s_overrideImpl = nullptr; // here we handle PInvokes whose implementation is always statically linked (even in .so/.dll case) static const void* DefaultResolveDllImport(const char* libraryName, const char* entrypointName) { -#if !defined(TARGET_MACCATALYST) if (strcmp(libraryName, GLOBALIZATION_DLL_NAME) == 0) { return GlobalizationResolveDllImport(entrypointName); } -#endif return nullptr; } diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 8ebce76af457d..c597f62df2266 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -253,6 +253,7 @@ add_subdirectory(System.Native) if(CLR_CMAKE_TARGET_BROWSER) # skip for now elseif(CLR_CMAKE_TARGET_MACCATALYST) + add_subdirectory(System.Globalization.Native) add_subdirectory(System.Net.Security.Native) # System.Security.Cryptography.Native is intentionally disabled on iOS # it is only used for interacting with OpenSSL which isn't useful there diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt index 148197a6b9258..103eb310ef86e 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt @@ -69,7 +69,7 @@ if (NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_timeZoneInfo.c) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} entrypoints.c) endif() diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index cbb82855a6c0d..18917f26e26d4 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -140,6 +140,7 @@ else() set(NATIVE_LIBS coreclr_static + System.Globalization.Native-Static System.IO.Compression.Native-Static System.Net.Security.Native-Static System.Native-Static @@ -153,7 +154,6 @@ else() if(NOT CLR_CMAKE_TARGET_MACCATALYST) list(APPEND NATIVE_LIBS - System.Globalization.Native-Static System.Security.Cryptography.Native.OpenSsl-Static ) endif() From eeba7e6fcc6062707e959bdbbaaab77ed106834a Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 22 Apr 2021 14:34:11 -0400 Subject: [PATCH 10/32] Allow AppleTestRunner.dll to run on non-mono w/ CoreRun THIS WILL BREAK MONO MACCATALYST --- .../tests/AppleTestRunner/AppleTestRunner.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs index 62d01c6df836e..615a04abfded9 100644 --- a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs +++ b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs @@ -17,11 +17,11 @@ public class SimpleTestRunner : iOSApplicationEntryPoint, IDevice { // to be wired once https://github.com/dotnet/xharness/pull/46 is merged - [DllImport("__Internal")] - public extern static void mono_ios_append_output (string value); +// [DllImport("__Internal")] +// public extern static void Console.WriteLine (string value); - [DllImport("__Internal")] - public extern static void mono_ios_set_summary (string value); +// [DllImport("__Internal")] +// public extern static void Console.WriteLine (string value); private static List s_testLibs = new List(); private static string? s_MainTestName; @@ -63,11 +63,11 @@ public static async Task Main(string[] args) Console.WriteLine("."); s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]); - mono_ios_set_summary($"Starting tests..."); + Console.WriteLine($"Starting tests..."); var simpleTestRunner = new SimpleTestRunner(verbose); simpleTestRunner.TestStarted += (target, e) => { - mono_ios_append_output($"[STARTING] {e}\n"); + Console.WriteLine($"[STARTING] {e}\n"); }; int failed = 0, passed = 0, skipped = 0; @@ -85,11 +85,11 @@ public static async Task Main(string[] args) { skipped++; } - mono_ios_set_summary($"{s_MainTestName}\nPassed:{passed}, Failed: {failed}, Skipped:{skipped}"); + Console.WriteLine($"{s_MainTestName}\nPassed:{passed}, Failed: {failed}, Skipped:{skipped}"); }; await simpleTestRunner.RunAsync(); - mono_ios_append_output($"\nDone.\n"); + Console.WriteLine($"\nDone.\n"); Console.WriteLine("----- Done -----"); return 0; } From 28c754bc1b48540a824a0d4607bc884d2c24e1da Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 22 Apr 2021 15:39:43 -0400 Subject: [PATCH 11/32] Add more native libs to the build --- src/libraries/Native/Unix/CMakeLists.txt | 1 + .../Unix/System.Net.Security.Native/CMakeLists.txt | 8 ++++++-- src/native/corehost/apphost/static/CMakeLists.txt | 10 +--------- src/native/corehost/hostpolicy/hostpolicy_context.cpp | 7 ++++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index c597f62df2266..35f96dc321e60 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -255,6 +255,7 @@ if(CLR_CMAKE_TARGET_BROWSER) elseif(CLR_CMAKE_TARGET_MACCATALYST) add_subdirectory(System.Globalization.Native) add_subdirectory(System.Net.Security.Native) + add_subdirectory(System.Security.Cryptography.Native) # System.Security.Cryptography.Native is intentionally disabled on iOS # it is only used for interacting with OpenSSL which isn't useful there elseif(CLR_CMAKE_TARGET_IOS) diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt index 6fbe18f76872e..569a01d286475 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt @@ -11,6 +11,10 @@ set(NATIVEGSS_SOURCES pal_gssapi.c ) +if (CLR_CMAKE_TARGET_MACCATALYST) + add_definitions(-DTARGET_MACCATALYST) +endif() + if (GEN_SHARED_LIB) add_library(System.Net.Security.Native SHARED @@ -19,7 +23,7 @@ if (GEN_SHARED_LIB) ) endif() -if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) +if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGSS_SOURCES ${NATIVEGSS_SOURCES} entrypoints.c) endif() @@ -35,7 +39,7 @@ if (GEN_SHARED_LIB) ${NATIVE_LIBS_EXTRA} ) - if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) + if (NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER) add_custom_command(TARGET System.Net.Security.Native POST_BUILD COMMENT "Verifying System.Net.Security.Native entry points against entrypoints.c " COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index 18917f26e26d4..0d9ae541c33b1 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -132,8 +132,6 @@ if(CLR_CMAKE_TARGET_WIN32) RuntimeObject.lib ) - - set(RUNTIMEINFO_LIB runtimeinfo) else() @@ -144,6 +142,7 @@ else() System.IO.Compression.Native-Static System.Net.Security.Native-Static System.Native-Static + System.Security.Cryptography.Native.OpenSsl-Static palrt coreclrpal @@ -151,13 +150,6 @@ else() nativeresourcestring ) - - if(NOT CLR_CMAKE_TARGET_MACCATALYST) - list(APPEND NATIVE_LIBS - System.Security.Cryptography.Native.OpenSsl-Static - ) - endif() - # additional requirements for System.IO.Compression.Native include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake) append_extra_compression_libs(NATIVE_LIBS) diff --git a/src/native/corehost/hostpolicy/hostpolicy_context.cpp b/src/native/corehost/hostpolicy/hostpolicy_context.cpp index 0fa4217864c41..5628d3aaca43a 100644 --- a/src/native/corehost/hostpolicy/hostpolicy_context.cpp +++ b/src/native/corehost/hostpolicy/hostpolicy_context.cpp @@ -54,7 +54,6 @@ namespace // Check if given function belongs to one of statically linked libraries and return a pointer if found. const void* STDMETHODCALLTYPE pinvoke_override(const char* libraryName, const char* entrypointName) { -#if !defined(TARGET_MACCATALYST) #if defined(_WIN32) if (strcmp(libraryName, "System.IO.Compression.Native") == 0) { @@ -71,10 +70,12 @@ namespace return SecurityResolveDllImport(entrypointName); } +#if !defined(TARGET_MACCATALYST) if (strcmp(libraryName, "libSystem.Native") == 0) { return SystemResolveDllImport(entrypointName); } +#endif if (strcmp(libraryName, "libSystem.Security.Cryptography.Native.OpenSsl") == 0) { @@ -82,13 +83,13 @@ namespace } #endif -#if defined(TARGET_OSX) +#if defined(TARGET_OSX) && !defined(TARGET_MACCATALYST) if (strcmp(libraryName, "libSystem.Security.Cryptography.Native.Apple") == 0) { return CryptoAppleResolveDllImport(entrypointName); } #endif -#endif + return nullptr; } #endif From 593b42bf45a00a8be272379f76f566ed397e100e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 23 Apr 2021 17:17:28 -0400 Subject: [PATCH 12/32] Allow AppleAppBuilder to build a CoreCLR Catalyst app Doesn't run yet, due to empty TPA array, but FINALLY IT LINKS --- eng/liveBuilds.targets | 4 +- eng/testing/tests.mobile.targets | 6 +- src/coreclr/hosts/inc/coreclrhost.h | 8 +- .../Microsoft.NETCore.App.Runtime.sfxproj | 2 +- .../tests/AppleTestRunner/AppleTestRunner.cs | 16 +-- src/libraries/externals.csproj | 4 +- src/mono/sample/iOS/Program.csproj | 2 +- src/mono/sample/mbr/apple/AppleDelta.csproj | 2 +- src/tasks/AppleAppBuilder/AppleAppBuilder.cs | 11 +- .../Templates/CMakeLists.txt.template | 14 +- .../Templates/runtime-coreclr.m | 129 ++++++++++++++++++ src/tasks/AppleAppBuilder/Xcode.cs | 26 +++- 12 files changed, 197 insertions(+), 27 deletions(-) create mode 100644 src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 5b72dedeb1a3b..4950995cdd9cd 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -102,6 +102,8 @@ runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native true + @@ -111,7 +113,7 @@ - diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 36d20963a936b..38b905244a2e0 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -10,6 +10,7 @@ true true BundleTestAppleApp;BundleTestAndroidApp + mono @@ -190,7 +191,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="$(AssemblyName)" - MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0" + RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include" Assemblies="@(BundleAssemblies)" MainLibraryFileName="$(MainLibraryFileName)" ForceAOT="$(RunAOTCompilation)" @@ -202,7 +203,8 @@ Optimized="$(Optimized)" DevTeamProvisioning="$(DevTeamProvisioning)" OutputDirectory="$(BundleDir)" - AppDir="$(PublishDir)"> + AppDir="$(PublishDir)" + RuntimeFlavor="$(RuntimeFlavor)"> diff --git a/src/coreclr/hosts/inc/coreclrhost.h b/src/coreclr/hosts/inc/coreclrhost.h index 46a3119d628de..5f892f5a3ef44 100644 --- a/src/coreclr/hosts/inc/coreclrhost.h +++ b/src/coreclr/hosts/inc/coreclrhost.h @@ -14,13 +14,19 @@ #define CORECLR_CALLING_CONVENTION #endif +#ifndef __OBJC__ +#define CORECLR_EXTERN_C extern "C" +#else +#define CORECLR_EXTERN_C +#endif + #include // For each hosting API, we define a function prototype and a function pointer // The prototype is useful for implicit linking against the dynamic coreclr // library and the pointer for explicit dynamic loading (dlopen, LoadLibrary) #define CORECLR_HOSTING_API(function, ...) \ - extern "C" int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \ + CORECLR_EXTERN_C int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \ typedef int (CORECLR_CALLING_CONVENTION *function##_ptr)(__VA_ARGS__) // diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj index ab62ea2c383ad..bf4c643069305 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj @@ -81,7 +81,7 @@ runtimes/$(RuntimeIdentifier)/native/cross/%(RecursiveDir) runtimes/$(RuntimeIdentifier)/native/include/%(RecursiveDir) diff --git a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs index 615a04abfded9..62d01c6df836e 100644 --- a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs +++ b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs @@ -17,11 +17,11 @@ public class SimpleTestRunner : iOSApplicationEntryPoint, IDevice { // to be wired once https://github.com/dotnet/xharness/pull/46 is merged -// [DllImport("__Internal")] -// public extern static void Console.WriteLine (string value); + [DllImport("__Internal")] + public extern static void mono_ios_append_output (string value); -// [DllImport("__Internal")] -// public extern static void Console.WriteLine (string value); + [DllImport("__Internal")] + public extern static void mono_ios_set_summary (string value); private static List s_testLibs = new List(); private static string? s_MainTestName; @@ -63,11 +63,11 @@ public static async Task Main(string[] args) Console.WriteLine("."); s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]); - Console.WriteLine($"Starting tests..."); + mono_ios_set_summary($"Starting tests..."); var simpleTestRunner = new SimpleTestRunner(verbose); simpleTestRunner.TestStarted += (target, e) => { - Console.WriteLine($"[STARTING] {e}\n"); + mono_ios_append_output($"[STARTING] {e}\n"); }; int failed = 0, passed = 0, skipped = 0; @@ -85,11 +85,11 @@ public static async Task Main(string[] args) { skipped++; } - Console.WriteLine($"{s_MainTestName}\nPassed:{passed}, Failed: {failed}, Skipped:{skipped}"); + mono_ios_set_summary($"{s_MainTestName}\nPassed:{passed}, Failed: {failed}, Skipped:{skipped}"); }; await simpleTestRunner.RunAsync(); - Console.WriteLine($"\nDone.\n"); + mono_ios_append_output($"\nDone.\n"); Console.WriteLine("----- Done -----"); return 0; } diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index daf84fb3ae2d3..10c64e163db32 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -67,6 +67,8 @@ + @@ -86,7 +88,7 @@ - diff --git a/src/mono/sample/iOS/Program.csproj b/src/mono/sample/iOS/Program.csproj index 580d61cf70fb9..7d253aafc8e1b 100644 --- a/src/mono/sample/iOS/Program.csproj +++ b/src/mono/sample/iOS/Program.csproj @@ -73,7 +73,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="HelloiOS" - MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include\mono-2.0" + RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include" Assemblies="@(BundleAssemblies)" MainLibraryFileName="Program.dll" GenerateXcodeProject="True" diff --git a/src/mono/sample/mbr/apple/AppleDelta.csproj b/src/mono/sample/mbr/apple/AppleDelta.csproj index 2b040dab21f00..9618398f61a72 100644 --- a/src/mono/sample/mbr/apple/AppleDelta.csproj +++ b/src/mono/sample/mbr/apple/AppleDelta.csproj @@ -63,7 +63,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="AppleDelta" - MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include\mono-2.0" + RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include" Assemblies="@(BundleAssemblies)" NativeMainSource="$(MSBuildThisFileDirectory)\main.m" MainLibraryFileName="AppleDelta.dll" diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs index 85efde52b045f..7007bc39c8f9d 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs @@ -44,10 +44,10 @@ public string TargetOS public string AppDir { get; set; } = ""!; /// - /// Path to Mono public headers (*.h) + /// Path to public headers (*.h) /// [Required] - public string MonoRuntimeHeaders { get; set; } = ""!; + public string RuntimeHeaders { get; set; } = ""!; /// /// This library will be used as an entry-point (e.g. TestRunner.dll) @@ -146,6 +146,11 @@ public string TargetOS /// public bool EnableRuntimeLogging { get; set; } + /// + /// Specifies whether to try and use Mono or CoreCLR runtime + /// + public string? RuntimeFlavor { get; set; } + public override bool Execute() { Utils.Logger = Log; @@ -204,7 +209,7 @@ public override bool Execute() generator.EnableRuntimeLogging = EnableRuntimeLogging; XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles, - AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, StaticLinkedComponentNames, NativeMainSource); + AppDir, binDir, RuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, StaticLinkedComponentNames, NativeMainSource, RuntimeFlavor); if (BuildAppBundle) { diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template index 4dcd8b645bb52..4016916642cf3 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template @@ -11,7 +11,7 @@ add_executable( %ProjectName% %MainSource% runtime.h - runtime.m + %RuntimeDotM% %AotModulesSource% ${APP_RESOURCES} ) @@ -20,7 +20,7 @@ add_executable( %Defines% -include_directories("%MonoInclude%") +include_directories("%RuntimeInclude%") set_target_properties(%ProjectName% PROPERTIES MACOSX_BUNDLE TRUE @@ -35,6 +35,10 @@ set(HARDENED_RUNTIME %HardenedRuntime% ) +set(RPATH_RESOURCES +%RpathResources% +) + set(HARDENED_RUNTIME_USE_ENTITLEMENTS_FILE %HardenedRuntimeUseEntitlementsFile% ) @@ -46,6 +50,12 @@ if("${HARDENED_RUNTIME}") endif() endif() + +if("${RPATH_RESOURCES}") + set_target_properties(%ProjectName% PROPERTIES XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@loader_path/../Resources") +endif() + + # FIXME: `XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING` should not be NO target_link_libraries( diff --git a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m new file mode 100644 index 0000000000000..489ef09971b61 --- /dev/null +++ b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m @@ -0,0 +1,129 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#import +#include +#include +#import +#include +#include +#include +#include + +static char *bundle_path; + +#define APPLE_RUNTIME_IDENTIFIER "//%APPLE_RUNTIME_IDENTIFIER%" + +const char * +get_bundle_path (void) +{ + if (bundle_path) + return bundle_path; + NSBundle* main_bundle = [NSBundle mainBundle]; + NSString* path = [main_bundle bundlePath]; + +#if TARGET_OS_MACCATALYST + path = [path stringByAppendingString:@"/Contents/Resources"]; +#endif + + bundle_path = strdup ([path UTF8String]); + + return bundle_path; +} + +char * +strdup_printf (const char *msg, ...) +{ + va_list args; + char *formatted = NULL; + va_start (args, msg); + vasprintf (&formatted, msg, args); + va_end (args); + return formatted; +} + +void +log_callback (const char *log_domain, const char *log_level, const char *message, bool fatal, void *user_data) +{ + os_log_info (OS_LOG_DEFAULT, "(%s %s) %s", log_domain, log_level, message); + if (fatal) { + os_log_info (OS_LOG_DEFAULT, "Exit code: %d.", 1); + exit (1); + } +} + +void +mono_ios_runtime_init (void) +{ +#if INVARIANT_GLOBALIZATION + setenv ("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", TRUE); +#endif + + id args_array = [[NSProcessInfo processInfo] arguments]; + assert ([args_array count] <= 128); + const char *managed_argv [128]; + int argi; + for (argi = 0; argi < [args_array count]; argi++) { + NSString* arg = [args_array objectAtIndex: argi]; + managed_argv[argi] = [arg UTF8String]; + } + + const char* bundle = get_bundle_path (); + chdir (bundle); + + char icu_dat_path [1024]; + int res; + + res = snprintf (icu_dat_path, sizeof (icu_dat_path) - 1, "%s/%s", bundle, "icudt.dat"); + assert (res > 0); + + // TODO: set TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS and NATIVE_DLL_SEARCH_DIRECTORIES + const char *appctx_keys [] = { + "RUNTIME_IDENTIFIER", + "APP_CONTEXT_BASE_DIRECTORY", +#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST + "ICU_DAT_FILE_PATH" +#endif + }; + const char *appctx_values [] = { + APPLE_RUNTIME_IDENTIFIER, + bundle, +#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST + icu_dat_path +#endif + }; + + void* hostHandle; + unsigned int domainId; + const char* propertyKeys[] = { + "TRUSTED_PLATFORM_ASSEMBLIES" + }; + const char* propertyValues[] = { + "" + }; + + coreclr_initialize ( + bundle, + APPLE_RUNTIME_IDENTIFIER, + sizeof(propertyKeys) / sizeof(char*), + propertyKeys, + propertyValues, + &hostHandle, + &domainId); + + const char* executable = "%EntryPointLibName%"; + + coreclr_execute_assembly ( + hostHandle, + domainId, + argi, + managed_argv, + executable, + (unsigned int*)&res); + os_log_info (OS_LOG_DEFAULT, "Executable: %s", executable); + + // Print this so apps parsing logs can detect when we exited + os_log_info (OS_LOG_DEFAULT, "Exit code: %d.", res); + + exit (res); +} diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 90bf0ff56ab2a..0e894ef2cc8c4 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -46,7 +46,7 @@ public string GenerateXCode( IEnumerable asmFiles, string workspace, string binDir, - string monoInclude, + string runtimeInclude, bool preferDylibs, bool useConsoleUiTemplate, bool forceAOT, @@ -54,8 +54,14 @@ public string GenerateXCode( bool invariantGlobalization, bool stripDebugSymbols, string? staticLinkedComponentNames=null, - string? nativeMainSource = null) + string? nativeMainSource = null, + string? runtimeFlavor = "mono") { + var runtimedotm = "coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase) ? "runtime-coreclr.m" : "runtime.m"; + if ("mono".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase)) + { + runtimeInclude = Path.Combine (runtimeInclude, "mono-2.0"); + } // bundle everything as resources excluding native files var excludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib" }; if (stripDebugSymbols) @@ -100,8 +106,9 @@ public string GenerateXCode( .Replace("%ProjectName%", projectName) .Replace("%AppResources%", string.Join(Environment.NewLine, resources.Select(r => " " + r))) .Replace("%MainSource%", nativeMainSource) - .Replace("%MonoInclude%", monoInclude) - .Replace("%HardenedRuntime%", hardenedRuntime ? "TRUE" : "FALSE"); + .Replace("%RuntimeInclude%", runtimeInclude) + .Replace("%HardenedRuntime%", hardenedRuntime ? "TRUE" : "FALSE") + .Replace("%RuntimeDotM%", runtimedotm); string toLink = ""; @@ -167,6 +174,12 @@ public string GenerateXCode( } } + if ("coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase)) + { + var libcoreclrpath = Array.Find (dylibs, element => element.EndsWith("libcoreclr.dylib")); + toLink += $" \"{libcoreclrpath}\"{Environment.NewLine}"; + } + string aotSources = ""; foreach (string asm in asmFiles) { @@ -186,6 +199,7 @@ public string GenerateXCode( cmakeLists = cmakeLists.Replace("%NativeLibrariesToLink%", toLink); cmakeLists = cmakeLists.Replace("%AotSources%", aotSources); cmakeLists = cmakeLists.Replace("%AotModulesSource%", string.IsNullOrEmpty(aotSources) ? "" : "modules.m"); + cmakeLists = cmakeLists.Replace("%RpathResources%", "coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase) ? "TRUE" : "FALSE"); var defines = new StringBuilder(); if (forceInterpreter) @@ -274,8 +288,8 @@ public string GenerateXCode( dllMap.AppendLine($" mono_dllmap_insert (NULL, \"System.Globalization.Native\", NULL, \"__Internal\", NULL);"); - File.WriteAllText(Path.Combine(binDir, "runtime.m"), - Utils.GetEmbeddedResource("runtime.m") + File.WriteAllText(Path.Combine(binDir, runtimedotm), + Utils.GetEmbeddedResource(runtimedotm) .Replace("//%DllMap%", dllMap.ToString()) .Replace("//%APPLE_RUNTIME_IDENTIFIER%", RuntimeIdentifier) .Replace("%EntryPointLibName%", Path.GetFileName(entryPointLib))); From 58e470a9b84c7eff49c9a8edfe3c5fd198cf8551 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 11:47:54 -0400 Subject: [PATCH 13/32] Fix up coreclr runtime template --- .../Templates/runtime-coreclr.m | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m index 489ef09971b61..0727a9f55bf21 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m @@ -9,8 +9,10 @@ #include #include #include +#include static char *bundle_path; +static char *tpa_list; #define APPLE_RUNTIME_IDENTIFIER "//%APPLE_RUNTIME_IDENTIFIER%" @@ -31,6 +33,28 @@ return bundle_path; } +const char * +get_tpa_list (const char *bundle) +{ + if (tpa_list) + return tpa_list; + NSString *path = @(bundle_path); + NSArray *dirs = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL]; + NSMutableArray *assemblies = [[NSMutableArray alloc] init]; + [dirs enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + NSString *filename = (NSString *)obj; + NSString *extension = [[filename pathExtension] lowercaseString]; + if ([extension isEqualToString:@"dll"]) { + [assemblies addObject:[path stringByAppendingPathComponent:filename]]; + } + }]; + + NSString *ns_tpa_list = [assemblies componentsJoinedByString:@":"]; + tpa_list = strdup ([ns_tpa_list UTF8String]); + + return tpa_list; +} + char * strdup_printf (const char *msg, ...) { @@ -52,6 +76,17 @@ } } +void * +pinvoke_override (const char *libraryName, const char *entrypointName) +{ + void *symbol = NULL; + + if (strcmp (libraryName, "__Internal") == 0) { + symbol = dlsym (RTLD_DEFAULT, entrypointName); + } + return symbol; +} + void mono_ios_runtime_init (void) { @@ -71,6 +106,8 @@ const char* bundle = get_bundle_path (); chdir (bundle); + const char* tpa = get_tpa_list (bundle); + char icu_dat_path [1024]; int res; @@ -93,13 +130,17 @@ #endif }; + char *pinvokeOverride = strdup_printf ("%p", &pinvoke_override); + void* hostHandle; unsigned int domainId; const char* propertyKeys[] = { + "PINVOKE_OVERRIDE", "TRUSTED_PLATFORM_ASSEMBLIES" }; const char* propertyValues[] = { - "" + pinvokeOverride, + tpa }; coreclr_initialize ( From a3970e147ed9f9a0282be695fd45bc462361bde0 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 13:30:20 -0400 Subject: [PATCH 14/32] Add CoreCLR Catalyst x64 to runtime-staging --- eng/pipelines/runtime-staging.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index d8ed185dbcbff..5d8e8ae6d095d 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -295,7 +295,7 @@ jobs: timeoutInMinutes: 120 # -# CoreCLR Build for running Apple Silicon libraries-innerloop +# CoreCLR Build for running Catalyst & Apple Silicon libraries-innerloop # - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -304,10 +304,11 @@ jobs: platforms: - ${{ if eq(variables['isFullMatrix'], true) }}: - OSX_arm64 + - MacCatalyst_x64 jobParameters: testGroup: innerloop # -# Libraries Build for running Apple Silicon libraries-innerloop +# Libraries Build for running Catalyst & Apple Silicon libraries-innerloop # - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -316,6 +317,7 @@ jobs: platforms: - ${{ if eq(variables['isFullMatrix'], true) }}: - OSX_arm64 + - MacCatalyst_x64 helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml jobParameters: isOfficialBuild: ${{ variables['isOfficialBuild'] }} From 51d2c7614780fc1a462b78ee2fac54faee0588cf Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 13:45:16 -0400 Subject: [PATCH 15/32] Don't only run Catalyst on FullMatrix --- eng/pipelines/runtime-staging.yml | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 61a91b0f2cd5e..8f6caa54e95ef 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -335,7 +335,35 @@ jobs: timeoutInMinutes: 120 # -# CoreCLR Build for running Catalyst & Apple Silicon libraries-innerloop +# CoreCLR Build for running Mac Catalyst libraries-innerloop +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml + buildConfig: release + platforms: + - MacCatalyst_x64 + jobParameters: + testGroup: innerloop +# +# Libraries Build for running Mac Catalyst libraries-innerloop +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/libraries/build-job.yml + buildConfig: Release + platforms: + - MacCatalyst_x64 + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + jobParameters: + isOfficialBuild: ${{ variables['isOfficialBuild'] }} + isFullMatrix: ${{ variables['isFullMatrix'] }} + runTests: true + testScope: innerloop + liveRuntimeBuildConfig: release + +# +# CoreCLR Build for running Apple Silicon libraries-innerloop # - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -344,11 +372,10 @@ jobs: platforms: - ${{ if eq(variables['isFullMatrix'], true) }}: - OSX_arm64 - - MacCatalyst_x64 jobParameters: testGroup: innerloop # -# Libraries Build for running Catalyst & Apple Silicon libraries-innerloop +# Libraries Build for running Apple Silicon libraries-innerloop # - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -357,7 +384,6 @@ jobs: platforms: - ${{ if eq(variables['isFullMatrix'], true) }}: - OSX_arm64 - - MacCatalyst_x64 helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml jobParameters: isOfficialBuild: ${{ variables['isOfficialBuild'] }} From 189422a560d21ec8432c751715debe90b70282a7 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 13:51:29 -0400 Subject: [PATCH 16/32] Don't hardcode Mono RuntimeFlavor on Catalyst --- eng/pipelines/common/platform-matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 6e92936ffca30..3d69d0ef6859f 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -381,7 +381,7 @@ jobs: targetRid: maccatalyst-x64 platform: MacCatalyst_x64 jobParameters: - runtimeFlavor: mono + runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} ${{ if eq(parameters.passPlatforms, true) }}: @@ -402,7 +402,7 @@ jobs: targetRid: maccatalyst-arm64 platform: MacCatalyst_arm64 jobParameters: - runtimeFlavor: mono + runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} ${{ if eq(parameters.passPlatforms, true) }}: From 5432b12b5403b8f30c70dabf38958998ffb55318 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 14:02:07 -0400 Subject: [PATCH 17/32] Treat Catalyst like OSX in AzDO --- eng/pipelines/coreclr/templates/build-job.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index a3567fe88ef2a..5286ef8f475da 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -96,7 +96,7 @@ jobs: - name: compilerArg value: '' # AppleClang has different version scheme, so we let complier introspection pick up the available clang from PATH - - ${{ if eq(parameters.osGroup, 'OSX') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}: - name: compilerArg value: '' - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: @@ -149,7 +149,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # 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') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'windows') }}: @@ -175,7 +175,7 @@ jobs: continueOnError: false condition: and(succeeded(), in(variables['SignType'], 'real', 'test')) - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h @@ -194,7 +194,7 @@ jobs: - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) displayName: Build CoreCLR Runtime - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: | du -sh $(Build.SourcesDirectory)/* df -h @@ -216,7 +216,7 @@ jobs: # Sign and add entitlements to these MacOS binaries - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(parameters.osGroup, 'OSX') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}: - template: /eng/pipelines/common/macos-sign-with-entitlements.yml parameters: From 52c17ac073750d39e2426f137fa82c443d2310c1 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 14:11:55 -0400 Subject: [PATCH 18/32] Add Catalyst to eng/install-native-dependencies.sh --- eng/install-native-dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index b32774a68a7f0..9390ae6c2a788 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -28,7 +28,7 @@ if [ "$1" = "Linux" ]; then if [ "$?" != "0" ]; then exit 1; fi -elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then +elif [ "$1" = "OSX" ] || [ "$1" = "MacCatalyst" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then engdir=$(dirname "${BASH_SOURCE[0]}") if [ "$3" = "azDO" ]; then @@ -47,7 +47,7 @@ elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then exit 1; fi else - echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument." + echo "Must pass \"Linux\", \"tvOS\", \"iOS\", \"MacCatalyst\" or \"OSX\" as first argument." exit 1 fi From a996d91151a698a083c782613d8d2483f5f94bd9 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 14:22:14 -0400 Subject: [PATCH 19/32] CoreCLR bypasses build.sh, ensure we pass an OS to build-runtime.sh --- eng/pipelines/libraries/base-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml index bea30446deed6..65cf60c312d51 100644 --- a/eng/pipelines/libraries/base-job.yml +++ b/eng/pipelines/libraries/base-job.yml @@ -70,7 +70,7 @@ jobs: - _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04 # force a value for OS when cross-building - - ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}: + - ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'MacCatalyst', 'tvOS', 'Android', 'FreeBSD') }}: - _osArg: -os ${{ parameters.osGroup }} - ${{ if ne(parameters.framework, '') }}: From d47bc747cd8b1c05adc34d5ad52c474c78cf251a Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 15:04:13 -0400 Subject: [PATCH 20/32] Try passing osArg into native test component build --- eng/pipelines/coreclr/templates/xplat-pipeline-job.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml index e3200502b7060..93c91d8eee312 100644 --- a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml @@ -156,4 +156,8 @@ jobs: - name: osArg value: -os FreeBSD + - ${{ if eq(parameters.osGroup, 'MacCatalyst') }}: + - name: osArg + value: -os MacCatalyst + steps: ${{ parameters.steps }} From 80730bf4ce66f03e8f5adf010894f0daf8410552 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 15:32:26 -0400 Subject: [PATCH 21/32] Don't try to build stuff we aren't targeting on MacCatalyst --- eng/pipelines/coreclr/templates/build-job.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index 5286ef8f475da..c5cd79dc85695 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -201,8 +201,12 @@ jobs: displayName: Disk Usage after Build # Build CoreCLR Managed Components - - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci - displayName: Build managed product components and packages + - ${{ if ne(parameters.osGroup, 'MacCatalyst') }}: + - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci + displayName: Build managed product components and packages + - ${{ if eq(parameters.osGroup, 'MacCatalyst') }}: + - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci + displayName: Build managed product components # Run CoreCLR Tools unit tests - ${{ if eq(parameters.testGroup, 'clrTools') }}: From 8f253969b5780cae375888f0e21a93a2a51bd430 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 26 Apr 2021 16:30:34 -0400 Subject: [PATCH 22/32] Force Flavor to be specified, as we use it for coreclr vs mono Catalyst --- eng/pipelines/libraries/build-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/libraries/build-job.yml b/eng/pipelines/libraries/build-job.yml index ee0c0fc938f69..18c814642034a 100644 --- a/eng/pipelines/libraries/build-job.yml +++ b/eng/pipelines/libraries/build-job.yml @@ -73,7 +73,7 @@ jobs: # If platform is in testBuildPlatforms we build tests as well. - ${{ if or(eq(parameters.runTests, true), containsValue(parameters.testBuildPlatforms, parameters.platform)) }}: - _subset: libs+libs.tests - - _additionalBuildArguments: /p:ArchiveTests=true + - _additionalBuildArguments: /p:ArchiveTests=true /p:RuntimeFlavor=${{ parameters.runtimeFlavor }} - ${{ parameters.variables }} From c3433be07eaf846d7cba2dd48d6b69868292a34f Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 08:53:07 -0400 Subject: [PATCH 23/32] Ensure coreclrhost.h is bundled into artifacts folder --- eng/liveBuilds.targets | 4 +--- src/coreclr/hosts/CMakeLists.txt | 1 + src/coreclr/hosts/inc/CMakeLists.txt | 2 ++ .../Microsoft.NETCore.App.Runtime.sfxproj | 2 +- src/libraries/externals.csproj | 4 +--- 5 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 src/coreclr/hosts/inc/CMakeLists.txt diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 4950995cdd9cd..5b72dedeb1a3b 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -102,8 +102,6 @@ runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native true - @@ -113,7 +111,7 @@ - diff --git a/src/coreclr/hosts/CMakeLists.txt b/src/coreclr/hosts/CMakeLists.txt index f3a3b0c8fbd0e..3e7db3020b2fc 100644 --- a/src/coreclr/hosts/CMakeLists.txt +++ b/src/coreclr/hosts/CMakeLists.txt @@ -7,3 +7,4 @@ else(CLR_CMAKE_HOST_WIN32) endif(CLR_CMAKE_HOST_WIN32) add_subdirectory(corerun) +add_subdirectory(inc) diff --git a/src/coreclr/hosts/inc/CMakeLists.txt b/src/coreclr/hosts/inc/CMakeLists.txt new file mode 100644 index 0000000000000..f8298b8a257db --- /dev/null +++ b/src/coreclr/hosts/inc/CMakeLists.txt @@ -0,0 +1,2 @@ +install (FILES coreclrhost.h + DESTINATION inc) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj index bf4c643069305..ab62ea2c383ad 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj @@ -81,7 +81,7 @@ runtimes/$(RuntimeIdentifier)/native/cross/%(RecursiveDir) runtimes/$(RuntimeIdentifier)/native/include/%(RecursiveDir) diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index 10c64e163db32..daf84fb3ae2d3 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -67,8 +67,6 @@ - @@ -88,7 +86,7 @@ - From cf6529db2216178a6d0a19ba949f8321c8f95a4e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 09:03:56 -0400 Subject: [PATCH 24/32] Try to get include folder into mobile runtime pack on mobile --- eng/liveBuilds.targets | 4 +++- .../Microsoft.NETCore.App.Runtime.sfxproj | 2 +- src/libraries/externals.csproj | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 5b72dedeb1a3b..ba086aa8c1ca4 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -102,6 +102,8 @@ runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native true + @@ -111,7 +113,7 @@ - diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj index ab62ea2c383ad..bf4c643069305 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj @@ -81,7 +81,7 @@ runtimes/$(RuntimeIdentifier)/native/cross/%(RecursiveDir) runtimes/$(RuntimeIdentifier)/native/include/%(RecursiveDir) diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index daf84fb3ae2d3..ca8e2c5b39c27 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -86,7 +86,7 @@ - From a03399d5d4519028a2696fe430c5642e9eb84dba Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 09:06:52 -0400 Subject: [PATCH 25/32] Only build system.buffers.tests for now, to avoid disk full noise in CI --- src/libraries/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 88353a36f0e3b..e5a39dbf1d328 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -389,7 +389,7 @@ - Date: Tue, 27 Apr 2021 12:40:46 -0400 Subject: [PATCH 26/32] Don't exclude libcoreclr.dylib from Resources/ --- src/tasks/AppleAppBuilder/Xcode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 374864fac0a41..0e894ef2cc8c4 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -63,7 +63,7 @@ public string GenerateXCode( runtimeInclude = Path.Combine (runtimeInclude, "mono-2.0"); } // bundle everything as resources excluding native files - var excludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib", "libcoreclr.dylib" }; + var excludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib" }; if (stripDebugSymbols) { excludes.Add(".pdb"); From 9958dcf37e817d5580f9aa24b54fb50edbc5ddaa Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 12:42:59 -0400 Subject: [PATCH 27/32] Fix up coreclr vs mono headers path --- eng/testing/tests.mobile.targets | 4 +++- src/tasks/AppleAppBuilder/Xcode.cs | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 2a146a53ca3c3..72ce9309580f2 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -11,6 +11,8 @@ true BundleTestAppleApp;BundleTestAndroidApp mono + $(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0 + $(CoreCLRArtifactsPath)inc @@ -191,7 +193,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="$(AssemblyName)" - RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include" + RuntimeHeaders="$(HeadersPath)" Assemblies="@(BundleAssemblies)" MainLibraryFileName="$(MainLibraryFileName)" ForceAOT="$(RunAOTCompilation)" diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 0e894ef2cc8c4..bbc81df7323dd 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -58,10 +58,6 @@ public string GenerateXCode( string? runtimeFlavor = "mono") { var runtimedotm = "coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase) ? "runtime-coreclr.m" : "runtime.m"; - if ("mono".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase)) - { - runtimeInclude = Path.Combine (runtimeInclude, "mono-2.0"); - } // bundle everything as resources excluding native files var excludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib" }; if (stripDebugSymbols) From fd9844fc72430fa73894fc31bade5a274b157be8 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 13:56:23 -0400 Subject: [PATCH 28/32] Required Catalyst Helix changes from #51139 --- .../libraries/helix-queues-setup.yml | 8 ++++++ eng/testing/xunit/xunit.console.targets | 2 +- src/libraries/sendtohelixhelp.proj | 25 +++++++++++++------ src/libraries/tests.proj | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index a54f7ff17da50..732080b9cc400 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -99,6 +99,14 @@ jobs: - OSX.1014.Amd64.Open - OSX.1015.Amd64.Open + # Mac Catalyst arm64 + - ${{ if eq(parameters.platform, 'MacCatalyst_arm64) }}: + - OSX.1100.ARM64.Open + + # Mac Catalyst x64 + - ${{ if eq(parameters.platform, 'MacCatalyst_x64) }}: + - OSX.1015.Amd64.Open + # Android - ${{ if in(parameters.platform, 'Android_x86', 'Android_x64') }}: - Ubuntu.1804.Amd64.Android.Open diff --git a/eng/testing/xunit/xunit.console.targets b/eng/testing/xunit/xunit.console.targets index 7710a05b5a37d..77d7363a22f4e 100644 --- a/eng/testing/xunit/xunit.console.targets +++ b/eng/testing/xunit/xunit.console.targets @@ -2,7 +2,7 @@ true testResults.xml - true + true diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index d326ebfae5310..35e3f510b732d 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -25,7 +25,7 @@ '$(Scenario)' == 'gcstress0xc_jitstress1' or '$(Scenario)' == 'gcstress0xc_jitstress2' or '$(Scenario)' == 'gcstress0xc_jitminopts_heapverify1'">01:30:00 - <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and ('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'Android')">00:30:00 + <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and ('$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'Android')">00:30:00 <_workItemTimeout Condition="'$(Scenario)' == '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">00:45:00 <_workItemTimeout Condition="'$(Scenario)' != '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">01:00:00 <_workItemTimeout Condition="'$(Scenario)' == 'BuildWasmApps' and '$(_workItemTimeout)' == ''">01:00:00 @@ -70,7 +70,7 @@ test/functional/packaging/ - + true @@ -164,6 +164,14 @@ + + + maccatalyst + $(_workItemTimeout) + $(_workItemTimeout) + + + ios-device @@ -211,20 +219,21 @@ - + ios-simulator-64 tvos-simulator ios-device tvos-device + maccatalyst - + $(AppleTestTarget) - + false @@ -277,7 +286,7 @@ - + @@ -315,8 +324,8 @@ - - + + diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index e5a39dbf1d328..e378e9be2180d 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -79,7 +79,7 @@ - + From 9a0ec573f480ee476ac1279e5933d0e97706af65 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 14:03:53 -0400 Subject: [PATCH 29/32] Typo --- eng/pipelines/libraries/helix-queues-setup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 732080b9cc400..2015d5c09d8e4 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -100,11 +100,11 @@ jobs: - OSX.1015.Amd64.Open # Mac Catalyst arm64 - - ${{ if eq(parameters.platform, 'MacCatalyst_arm64) }}: + - ${{ if eq(parameters.platform, 'MacCatalyst_arm64') }}: - OSX.1100.ARM64.Open # Mac Catalyst x64 - - ${{ if eq(parameters.platform, 'MacCatalyst_x64) }}: + - ${{ if eq(parameters.platform, 'MacCatalyst_x64') }}: - OSX.1015.Amd64.Open # Android From 153de5264c352886cfa8c5c582b93d77f1f70b17 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 14:40:04 -0400 Subject: [PATCH 30/32] Fix on ios, clean up unused ObjC code --- src/mono/sample/iOS/Program.csproj | 2 +- src/mono/sample/mbr/apple/AppleDelta.csproj | 2 +- .../Templates/runtime-coreclr.m | 26 +++++++------------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/mono/sample/iOS/Program.csproj b/src/mono/sample/iOS/Program.csproj index 7d253aafc8e1b..4ebe964781458 100644 --- a/src/mono/sample/iOS/Program.csproj +++ b/src/mono/sample/iOS/Program.csproj @@ -73,7 +73,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="HelloiOS" - RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include" + RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include\mono-2.0" Assemblies="@(BundleAssemblies)" MainLibraryFileName="Program.dll" GenerateXcodeProject="True" diff --git a/src/mono/sample/mbr/apple/AppleDelta.csproj b/src/mono/sample/mbr/apple/AppleDelta.csproj index 9618398f61a72..993666733c33d 100644 --- a/src/mono/sample/mbr/apple/AppleDelta.csproj +++ b/src/mono/sample/mbr/apple/AppleDelta.csproj @@ -63,7 +63,7 @@ TargetOS="$(TargetOS)" Arch="$(TargetArchitecture)" ProjectName="AppleDelta" - RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include" + RuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)native\include\mono-2.0" Assemblies="@(BundleAssemblies)" NativeMainSource="$(MSBuildThisFileDirectory)\main.m" MainLibraryFileName="AppleDelta.dll" diff --git a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m index 0727a9f55bf21..dbdaa59095e42 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m @@ -114,15 +114,22 @@ res = snprintf (icu_dat_path, sizeof (icu_dat_path) - 1, "%s/%s", bundle, "icudt.dat"); assert (res > 0); - // TODO: set TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS and NATIVE_DLL_SEARCH_DIRECTORIES - const char *appctx_keys [] = { + char *pinvokeOverride = strdup_printf ("%p", &pinvoke_override); + + void* hostHandle; + unsigned int domainId; + const char* propertyKeys[] = { + "PINVOKE_OVERRIDE", + "TRUSTED_PLATFORM_ASSEMBLIES", "RUNTIME_IDENTIFIER", "APP_CONTEXT_BASE_DIRECTORY", #if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST "ICU_DAT_FILE_PATH" #endif }; - const char *appctx_values [] = { + const char* propertyValues[] = { + pinvokeOverride, + tpa, APPLE_RUNTIME_IDENTIFIER, bundle, #if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST @@ -130,19 +137,6 @@ #endif }; - char *pinvokeOverride = strdup_printf ("%p", &pinvoke_override); - - void* hostHandle; - unsigned int domainId; - const char* propertyKeys[] = { - "PINVOKE_OVERRIDE", - "TRUSTED_PLATFORM_ASSEMBLIES" - }; - const char* propertyValues[] = { - pinvokeOverride, - tpa - }; - coreclr_initialize ( bundle, APPLE_RUNTIME_IDENTIFIER, From 0f3ed14fa969753cece8cf90fdb61fb32b59bb35 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 27 Apr 2021 15:47:09 -0400 Subject: [PATCH 31/32] Revert "Only build system.buffers.tests for now, to avoid disk full noise in CI" This reverts commit a03399d5d4519028a2696fe430c5642e9eb84dba. --- src/libraries/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index e378e9be2180d..cc7dbce03697a 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -389,7 +389,7 @@ - Date: Tue, 27 Apr 2021 18:58:48 -0400 Subject: [PATCH 32/32] Skip .dwarf files on Mobile targets, TOO CHONKY --- eng/liveBuilds.targets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index ba086aa8c1ca4..aac50b787296d 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -85,7 +85,9 @@ +