From e006cc7443304bd9fa9bdcd3396829406a91e1c1 Mon Sep 17 00:00:00 2001 From: Adeel Date: Wed, 27 May 2020 20:37:51 +0300 Subject: [PATCH 1/3] Implement RID for SunOS-derived operating systems --- eng/Configurations.props | 5 +- eng/build.sh | 14 +- eng/native/configureplatform.cmake | 15 ++ eng/native/init-distro-rid.sh | 25 ++- eng/native/init-os-and-arch.sh | 8 +- eng/run-test.sh | 8 +- eng/targetframeworksuffix.props | 13 +- src/coreclr/dir.common.props | 5 +- src/coreclr/src/.nuget/Directory.Build.props | 22 ++- .../targets/Microsoft.NET.Sdk.IL.targets | 3 +- src/coreclr/tests/scripts/run-pmi-diffs.py | 34 ++-- .../tests/setup-stress-dependencies.sh | 9 +- src/coreclr/tests/src/Directory.Build.props | 13 +- .../JIT/Directed/StructABI/StructABI.csproj | 2 +- src/installer/Directory.Build.props | 17 +- .../corehost/cli/hostmisc/hostmisc.cmake | 4 + src/installer/corehost/cli/hostmisc/pal.h | 10 +- .../corehost/cli/hostmisc/pal.unix.cpp | 63 ++++++- .../projects/netcoreapp/Directory.Build.props | 3 +- .../pkg/projects/netcoreappRIDs.props | 3 +- .../System/PlatformDetection.Unix.cs | 33 ++++ .../TestUtilities/System/PlatformDetection.cs | 6 +- src/libraries/Directory.Build.props | 20 ++- src/libraries/Native/Unix/configure.cmake | 6 +- src/libraries/OSGroups.json | 24 ++- .../runtime.compatibility.json | 159 ++++++++++++++++++ .../Microsoft.NETCore.Platforms/runtime.json | 99 +++++++++++ .../runtimeGroups.props | 28 +++ 28 files changed, 574 insertions(+), 77 deletions(-) diff --git a/eng/Configurations.props b/eng/Configurations.props index 06ee77bbe8d17..406d310264232 100644 --- a/eng/Configurations.props +++ b/eng/Configurations.props @@ -52,7 +52,8 @@ OSX FreeBSD NetBSD - SunOS + Illumos + Solaris Linux Windows_NT $(TargetOS) @@ -70,4 +71,4 @@ true - \ No newline at end of file + diff --git a/eng/build.sh b/eng/build.sh index 02c5d278e259d..5acbe8d35b4ea 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -18,7 +18,7 @@ usage() { echo "Common settings:" echo " --subset Build a subset, print available subsets with -subset help (short: -s)" - echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS" + echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD, Illumos or Solaris" echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm" echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)" echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" @@ -62,7 +62,7 @@ usage() initDistroRid() { - source $scriptroot/native/init-distro-rid.sh + source "$scriptroot"/native/init-distro-rid.sh local passedRootfsDir="" local targetOs="$1" @@ -138,7 +138,7 @@ while [[ $# > 0 ]]; do ;; -configuration|-c) - if [ -z ${2+x} ]; then + if [ -z ${2+x} ]; then echo "No configuration supplied. See help (--help) for supported configurations." 1>&2 exit 1 fi @@ -190,11 +190,13 @@ while [[ $# > 0 ]]; do os="Android" ;; browser) os="Browser" ;; - sunos) - os="SunOS" ;; + illumos) + os="Illumos" ;; + solaris) + os="Solaris" ;; *) echo "Unsupported target OS '$2'." - echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, and SunOS." + echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, Illumos and Solaris." exit 1 ;; esac diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 04fdfaed45a99..bbc7877e8f9fa 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -159,7 +159,17 @@ if(CLR_CMAKE_HOST_OS STREQUAL SunOS) clr_unknown_arch() endif() + EXECUTE_PROCESS( + COMMAND uname -o + OUTPUT_VARIABLE SUNOS_KERNEL_KIND + ERROR_QUIET) + set(CLR_CMAKE_HOST_SUNOS 1) + if(SUNOS_KERNEL_KIND STREQUAL illumos) + set(CLR_CMAKE_HOST_OS_ILLUMOS 1) + else(SUNOS_KERNEL_KIND STREQUAL illumos) + set(CLR_CMAKE_HOST_OS_SOLARIS 1) + endif(SUNOS_KERNEL_KIND STREQUAL illumos) endif(CLR_CMAKE_HOST_OS STREQUAL SunOS) if(CLR_CMAKE_HOST_OS STREQUAL Windows) @@ -312,6 +322,11 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL NetBSD) if(CLR_CMAKE_TARGET_OS STREQUAL SunOS) set(CLR_CMAKE_TARGET_UNIX 1) + if(CLR_CMAKE_HOST_OS_ILLUMOS) + set(CLR_CMAKE_TARGET_OS_ILLUMOS 1) + else(CLR_CMAKE_HOST_OS_ILLUMOS) + set(CLR_CMAKE_TARGET_OS_SOLARIS 1) + endif(CLR_CMAKE_HOST_OS_ILLUMOS) set(CLR_CMAKE_TARGET_SUNOS 1) endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS) diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index 22efd8e8b5423..a446a2b9a3b04 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -70,6 +70,25 @@ initNonPortableDistroRid() elif getprop ro.product.system.model 2>&1 | grep -qi android; then __android_sdk_version=$(getprop ro.build.version.sdk) nonPortableBuildID="android.$__android_sdk_version-${buildArch}" + elif [ "$targetOs" = "Illumos" ]; then + __uname_version=$(uname -v) + case "$__uname_version" in + omnios-*) + __omnios_major_version=$(echo "${__uname_version:8:2}") + nonPortableBuildID=omnios."$__omnios_major_version"-"$buildArch" + ;; + joyent_*) + __smartos_major_version=$(echo "${__uname_version:7:4}") + nonPortableBuildID=smartos."$__smartos_major_version"-"$buildArch" + ;; + illumos_*) + nonPortableBuildID=openindiana-"$buildArch" + ;; + esac + elif [ "$targetOs" = "Solaris" ]; then + __uname_version=$(uname -v) + __solaris_major_version=$(echo "${__uname_version%.*}") + nonPortableBuildID=solaris."$__solaris_major_version"-"$buildArch" fi if [ -n "${nonPortableBuildID}" ]; then @@ -169,8 +188,10 @@ initDistroRidGlobal() distroRid="browser-$buildArch" elif [ "$targetOs" = "FreeBSD" ]; then distroRid="freebsd-$buildArch" - elif [ "$targetOs" = "SunOS" ]; then - distroRid="sunos-$buildArch" + elif [ "$targetOs" = "Illumos" ]; then + distroRid="illumos-$buildArch" + elif [ "$targetOs" = "Solaris" ]; then + distroRid="solaris-$buildArch" fi fi diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 0323964cd82a0..e568d13bb7e71 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -9,7 +9,7 @@ fi case "$OSName" in FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android) - os=$OSName ;; + os="$OSName" ;; Darwin) os=OSX ;; *) @@ -20,7 +20,11 @@ esac # On Solaris, `uname -m` is discoragued, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html # and `uname -p` returns processor type (e.g. i386 on amd64). # The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. -if [ "$OSName" = "SunOS" ]; then +if [ "$os" = "SunOS" ]; then + os="Solaris" + if uname -o 2>&1 | grep -q illumos; then + os="Illumos" + fi CPUName=$(isainfo -n) else # For rest of the operating systems, use uname(1) to determine what the CPU is. diff --git a/eng/run-test.sh b/eng/run-test.sh index 5f14e6f6121be..a09ac1b3207f1 100644 --- a/eng/run-test.sh +++ b/eng/run-test.sh @@ -15,12 +15,12 @@ wait_on_pids() usage() { - echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD or SunOS" + echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD, Illumos or Solaris" echo "usage: run-test [options]" echo echo "Input sources:" echo " --runtime Location of root of the binaries directory" - echo " containing the FreeBSD, Linux, NetBSD or SunOS runtime" + echo " containing the FreeBSD, Linux, NetBSD, Illumos or Solaris runtime" echo " default: /bin/testhost/netcoreapp---" echo " --corefx-tests Location of the root binaries location containing" echo " the tests to run" @@ -29,7 +29,7 @@ usage() echo "Flavor/OS/Architecture options:" echo " --configuration Configuration to run (Debug/Release)" echo " default: Debug" - echo " --os OS to run (FreeBSD, Linux, NetBSD or SunOS)" + echo " --os OS to run (FreeBSD, Linux, NetBSD, Illumos or Solaris)" echo " default: detect current OS" echo " --arch Architecture to run (x64, arm, armel, x86, arm64)" echo " default: detect current architecture" @@ -254,7 +254,7 @@ then exit 1 fi -if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "SunOS" ] +if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "Illumos" ] && [ "$OS" != "Solaris" ] then echo "error: OS should be FreeBSD, Linux, NetBSD or Linux" exit 1 diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index f89923d3ab86c..7e3dc8de024c0 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -62,11 +62,18 @@ netbsd - + true - true - sunos + true + illumos + + + + + true + true + solaris diff --git a/src/coreclr/dir.common.props b/src/coreclr/dir.common.props index 2ff54f14de24a..b7b3b8de82e43 100644 --- a/src/coreclr/dir.common.props +++ b/src/coreclr/dir.common.props @@ -55,11 +55,12 @@ true true true - true + true + true true true - true + true $(__DistroRid) diff --git a/src/coreclr/src/.nuget/Directory.Build.props b/src/coreclr/src/.nuget/Directory.Build.props index 2fd932c03b84e..e6f2177e9fb89 100644 --- a/src/coreclr/src/.nuget/Directory.Build.props +++ b/src/coreclr/src/.nuget/Directory.Build.props @@ -28,7 +28,7 @@ $(OSRid) - Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;SunOS + Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;Illumos;Solaris ;$(SupportedPackageOSGroups); - sunos-$(TargetArchitecture) + illumos-$(TargetArchitecture) + + + + + solaris-$(TargetArchitecture) + + solaris-$(TargetArchitecture) @@ -176,8 +183,11 @@ - - + + + + + diff --git a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets index f2c0a3fb64973..9a4272c394798 100644 --- a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets +++ b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets @@ -25,7 +25,8 @@ Copyright (c) .NET Foundation. All rights reserved. <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('freebsd'))">freebsd <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('netbsd'))">netbsd - <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('sunos'))">sunos + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('illumos'))">illumos + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('solaris'))">solaris <_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) $(_OSPlatform)-$(_OSArchitecture.ToLower()) diff --git a/src/coreclr/tests/scripts/run-pmi-diffs.py b/src/coreclr/tests/scripts/run-pmi-diffs.py index 59fac0d22db1e..db4e60baa89a0 100755 --- a/src/coreclr/tests/scripts/run-pmi-diffs.py +++ b/src/coreclr/tests/scripts/run-pmi-diffs.py @@ -55,6 +55,8 @@ Docker_name_arm64 = 'microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921' Docker_opts_arm64 = '-e ROOTFS_DIR=/crossrootfs/arm64' +Is_illumos = ('illumos' in subprocess.Popen(["uname", "-o"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8')) + # This should be factored out of build.sh Unix_name_map = { 'Linux': 'Linux', @@ -62,7 +64,7 @@ 'FreeBSD': 'FreeBSD', 'OpenBSD': 'OpenBSD', 'NetBSD': 'NetBSD', - 'SunOS': 'SunOS' + 'SunOS': 'Illumos' if Is_illumos else 'Solaris' } Is_windows = (os.name == 'nt') @@ -131,13 +133,13 @@ def validate_args(args): Returns: args (CoreclrArguments) : Args parsed Notes: - If the arguments are valid then return them all in a tuple. If not, + If the arguments are valid then return them all in a tuple. If not, raise an exception stating x argument is incorrect. """ - coreclr_setup_args = CoreclrArguments(args, - require_built_test_dir=False, - require_built_core_root=True, + coreclr_setup_args = CoreclrArguments(args, + require_built_test_dir=False, + require_built_core_root=True, require_built_product_dir=False) coreclr_setup_args.verify(args, @@ -161,7 +163,7 @@ def validate_args(args): "skip_baseline_build", lambda unused: True, "Error setting baseline build") - + coreclr_setup_args.verify(args, "skip_diffs", lambda unused: True, @@ -183,15 +185,15 @@ def validate_args(args): "Error setting ci_arch") args = ( - coreclr_setup_args.arch, - coreclr_setup_args.ci_arch, - coreclr_setup_args.build_type, - coreclr_setup_args.base_root, - coreclr_setup_args.diff_root, - coreclr_setup_args.scratch_root, - coreclr_setup_args.skip_baseline_build, - coreclr_setup_args.skip_diffs, - coreclr_setup_args.target_branch, + coreclr_setup_args.arch, + coreclr_setup_args.ci_arch, + coreclr_setup_args.build_type, + coreclr_setup_args.base_root, + coreclr_setup_args.diff_root, + coreclr_setup_args.scratch_root, + coreclr_setup_args.skip_baseline_build, + coreclr_setup_args.skip_diffs, + coreclr_setup_args.target_branch, coreclr_setup_args.commit_hash ) @@ -328,7 +330,7 @@ def baseline_build(): buildOpts = 'cross' scriptPath = baseCoreClrPath - # Build a checked baseline jit + # Build a checked baseline jit if Is_windows: command = 'set __TestIntermediateDir=int&&build.cmd %s checked skiptests skipbuildpackages' % arch diff --git a/src/coreclr/tests/setup-stress-dependencies.sh b/src/coreclr/tests/setup-stress-dependencies.sh index a81c8fff7b2a7..ad4ee386321be 100755 --- a/src/coreclr/tests/setup-stress-dependencies.sh +++ b/src/coreclr/tests/setup-stress-dependencies.sh @@ -131,8 +131,13 @@ case "$OSName" in ;; SunOS) - __TargetOS=SunOS - __HostOS=SunOS + if uname -o 2>&1 | grep -q illumos; then + __TargetOS=Illumos + __HostOS=Illumos + else + __TargetOS=Solaris + __HostOS=Solaris + fi ;; *) diff --git a/src/coreclr/tests/src/Directory.Build.props b/src/coreclr/tests/src/Directory.Build.props index c4ed9921bd310..c411b5f979872 100644 --- a/src/coreclr/tests/src/Directory.Build.props +++ b/src/coreclr/tests/src/Directory.Build.props @@ -98,10 +98,17 @@ ubuntu.14.04-$(TargetArchitecture) - + true - true + true + ubuntu.14.04-$(TargetArchitecture) + + + + + true + true ubuntu.14.04-$(TargetArchitecture) @@ -123,7 +130,7 @@ - true + true C# IL diff --git a/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj b/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj index 696b406cf0b98..9ae9f99b490a7 100644 --- a/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj +++ b/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props index d1edd4ec5388f..06381740cfce5 100644 --- a/src/installer/Directory.Build.props +++ b/src/installer/Directory.Build.props @@ -81,7 +81,8 @@ linux-$(TargetArchitecture) freebsd-$(TargetArchitecture) netbsd-$(TargetArchitecture) - sunos-$(TargetArchitecture) + illumos-$(TargetArchitecture) + solaris-$(TargetArchitecture) ios-$(TargetArchitecture) tvos-$(TargetArchitecture) android-$(TargetArchitecture) @@ -124,8 +125,8 @@ false true - - true + + true $(AssetOutputPath)sharedfx_$(OutputRid)_$(Configuration)_version_badge.svg @@ -291,9 +292,15 @@ true - + - true + true + true + + + + + true true diff --git a/src/installer/corehost/cli/hostmisc/hostmisc.cmake b/src/installer/corehost/cli/hostmisc/hostmisc.cmake index f6813e1293cc3..eee0275874991 100644 --- a/src/installer/corehost/cli/hostmisc/hostmisc.cmake +++ b/src/installer/corehost/cli/hostmisc/hostmisc.cmake @@ -5,6 +5,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/configure.cmake) include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(CLR_CMAKE_TARGET_OS_ILLUMOS) + add_definitions(-DTARGET_ILLUMOS) +endif() + # CMake does not recommend using globbing since it messes with the freshness checks list(APPEND SOURCES ${CMAKE_CURRENT_LIST_DIR}/trace.cpp diff --git a/src/installer/corehost/cli/hostmisc/pal.h b/src/installer/corehost/cli/hostmisc/pal.h index 1e1f4cf5f5c4f..dff9b5b46a766 100644 --- a/src/installer/corehost/cli/hostmisc/pal.h +++ b/src/installer/corehost/cli/hostmisc/pal.h @@ -76,8 +76,16 @@ #else #define LIB_PREFIX _X("lib") #define MAKE_LIBNAME(NAME) (LIB_PREFIX _X(NAME) _X(".so")) +#if defined(TARGET_FREEBSD) +#define FALLBACK_HOST_RID _X("freebsd") +#elif defined(TARGET_ILLUMOS) +#define FALLBACK_HOST_RID _X("illumos") +#elif defined(__sun) +#define FALLBACK_HOST_RID _X("solaris") +#else #define FALLBACK_HOST_RID _X("linux") #endif +#endif #define LIBCORECLR_FILENAME (LIB_PREFIX _X("coreclr")) #define LIBCORECLR_NAME MAKE_LIBNAME("coreclr") @@ -146,7 +154,7 @@ namespace pal inline int strncasecmp(const char_t* str1, const char_t* str2, int len) { return ::_wcsnicmp(str1, str2, len); } inline int pathcmp(const pal::string_t &path1, const pal::string_t &path2) { return strcasecmp(path1.c_str(), path2.c_str()); } inline string_t to_string(int value) { return std::to_wstring(value); } - + inline size_t strlen(const char_t* str) { return ::wcslen(str); } inline FILE * file_open(const string_t& path, const char_t* mode) { return ::_wfopen(path.c_str(), mode); } diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp index a17487636d60b..a2207e356145f 100644 --- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp @@ -26,6 +26,8 @@ #include #include #include +#elif defined(__sun) +#include #endif #if defined(TARGET_LINUX) @@ -583,20 +585,69 @@ pal::string_t pal::get_current_os_rid_platform() pal::string_t pal::get_current_os_rid_platform() { pal::string_t ridOS; - char str[256]; - size_t size = sizeof(str); int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0); + if (ret == 0) { - char *pos = strchr(str,'.'); + char *pos = strchr(str, '.'); + if (pos) + { + ridOS.append(_X("freebsd.")) + .append(str, pos - str); + } + } + + return ridOS; +} +#elif defined(__sun) +pal::string_t pal::get_current_os_rid_platform() +{ + // Code: + // struct utsname u; + // if (uname(&u) != -1) + // printf("sysname: %s, release: %s, version: %s, machine: %s\n", u.sysname, u.release, u.version, u.machine); + // + // Output Examples: + // on OmniOS + // sysname: SunOS, release: 5.11, version: omnios-r151018-95eaa7e, machine: i86pc + // on OpenIndiana Hipster: + // sysname: SunOS, release: 5.11, version: illumos-63878f749f, machine: i86pc + // on SmartOS: + // sysname: SunOS, release: 5.11, version: joyent_20200408T231825Z, machine: i86pc + // on Solaris 11: + // sysname: SunOS, release: 5.11, version: 11.3, machine: i86pc + + pal::string_t ridOS; + struct utsname utsname_obj; + if (uname(&utsname_obj) < 0) + { + return ridOS; + } + + if (strncmp(utsname_obj.version, "omnios", strlen("omnios")) == 0) + { + ridOS.append(_X("omnios.")) + .append(utsname_obj.version, strlen("omnios-r"), 2); // e.g. omnios.15 + } + else if (strncmp(utsname_obj.version, "illumos-", strlen("illumos-")) == 0) + { + ridOS.append(_X("openindiana")); // version-less + } + else if (strncmp(utsname_obj.version, "joyent_", strlen("joyent_")) == 0) + { + ridOS.append(_X("smartos.")) + .append(utsname_obj.version, strlen("joyent_"), 4); // e.g. smartos.2020 + } + else // solaris + { + char *pos = strchr(utsname_obj.version, '.'); if (pos) { - *pos = '\0'; + ridOS.append(_X("solaris.")) + .append(utsname_obj.version, pos - utsname_obj.version); // e.g. solaris.11 } - ridOS.append(_X("freebsd.")); - ridOS.append(str); } return ridOS; diff --git a/src/installer/pkg/projects/netcoreapp/Directory.Build.props b/src/installer/pkg/projects/netcoreapp/Directory.Build.props index 59ac9e4269092..4b66aa2fb7be3 100644 --- a/src/installer/pkg/projects/netcoreapp/Directory.Build.props +++ b/src/installer/pkg/projects/netcoreapp/Directory.Build.props @@ -15,7 +15,8 @@ Browser FreeBSD NetBSD - SunOS + Illumos + Solaris $(CoreCLRTargetOS) diff --git a/src/installer/pkg/projects/netcoreappRIDs.props b/src/installer/pkg/projects/netcoreappRIDs.props index 706135723a29c..0b3024cf53838 100644 --- a/src/installer/pkg/projects/netcoreappRIDs.props +++ b/src/installer/pkg/projects/netcoreappRIDs.props @@ -12,7 +12,8 @@ - + + x86 diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 38fb7d598ce0a..153b3c382b07e 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -162,6 +162,39 @@ private static DistroInfo GetDistroInfo() // What we want is major release as minor releases should be compatible. result.VersionId = ToVersion(RuntimeInformation.OSDescription.Split()[1].Split('.')[0]); } + else if (IsIllumos) + { + // examples: + // on OmniOS + // SunOS 5.11 omnios-r151018-95eaa7e + // on OpenIndiana Hipster: + // SunOS 5.11 illumos-63878f749f + // on SmartOS: + // SunOS 5.11 joyent_20200408T231825Z + var versionDescription = RuntimeInformation.OSDescription.Split(' ')[2]; + switch (versionDescription) + { + case string version when version.StartsWith("omnios"): + result.Id = "OmniOS"; + result.VersionId = ToVersion(version.Substring("omnios-r".Length, 2)); // e.g. 15 + break; + case string version when version.StartsWith("joyent"): + result.Id = "SmartOS"; + result.VersionId = ToVersion(version.Substring("joyent_".Length, 4)); // e.g. 2020 + break; + case string version when version.StartsWith("illumos"): + result.Id = "OpenIndiana"; + // version-less + break; + } + } + else if (IsSolaris) + { + // example: + // SunOS 5.11 11.3 + result.Id = "Solaris"; + result.VersionId = ToVersion(RuntimeInformation.OSDescription.Split(' ')[2]); // e.g. 11.3 + } else if (File.Exists("/etc/os-release")) { foreach (string line in File.ReadAllLines("/etc/os-release")) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index a17d3eebce28d..c02986f6225b5 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -26,6 +26,8 @@ public static partial class PlatformDetection public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); + public static bool IsIllumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("Illumos")); + public static bool IsSolaris => RuntimeInformation.IsOSPlatform(OSPlatform.Create("Solaris")); public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; public static bool IsNotArmProcess => !IsArmProcess; @@ -111,7 +113,7 @@ public static bool IsNonZeroLowerBoundArraySupported // Windows - Schannel supports alpn from win8.1/2012 R2 and higher. // Linux - OpenSsl supports alpn from openssl 1.0.2 and higher. // OSX - SecureTransport doesn't expose alpn APIs. TODO https://github.com/dotnet/runtime/issues/27727 - public static bool IsOpenSslSupported => IsLinux || IsFreeBSD; + public static bool IsOpenSslSupported => IsLinux || IsFreeBSD || IsIllumos || IsSolaris; public static bool SupportsAlpn => (IsWindows && !IsWindows7) || (IsOpenSslSupported && @@ -272,7 +274,7 @@ private static bool GetTls13Support() } else if (IsOpenSslSupported) { - // Covers Linux and FreeBSD + // Covers Linux, FreeBSD, Illumos and Solaris return OpenSslVersion >= new Version(1,1,1); } diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index fca7201e832da..0fc21d4b9ba46 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -15,12 +15,12 @@ $(RepositoryEngineeringDir)BeforeTargetFrameworkInference.targets $(RepoRoot)artifacts\toolset\Common\ $([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24')) - true + true $(RepositoryEngineeringDir)depProj.common.targets $(LibrariesProjectRoot)OSGroups.json $(NetCoreAppCurrent) false - $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD + $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Illumos;$(NetCoreAppCurrent)-Solaris $(RepositoryEngineeringDir)LicenseHeader.txt @@ -30,7 +30,7 @@ - + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) arm @@ -42,7 +42,7 @@ $(TargetOS.ToLowerInvariant()) - + Debug $(TargetFramework) @@ -94,6 +94,8 @@ <_portableOS Condition="'$(_runtimeOSFamily)' == 'win' or '$(TargetOS)' == 'Windows_NT'">win <_portableOS Condition="'$(_runtimeOSFamily)' == 'osx'">osx <_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd + <_portableOS Condition="'$(_runtimeOSFamily)' == 'Illumos'">illumos + <_portableOS Condition="'$(_runtimeOSFamily)' == 'Solaris'">solaris <_portableOS Condition="'$(RuntimeOS)' == 'Browser'">browser <_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios <_portableOS Condition="'$(RuntimeOS)' == 'tvos'">tvos @@ -124,10 +126,10 @@ $(ToolRuntimeRID) - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'Illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'Illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux <_packageRID /> <_packageRID Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture) @@ -159,14 +161,14 @@ - + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(MSBuildProjectName)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(MSBuildProjectName)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)', 'ref')) - $([MSBuild]::NormalizeDirectory('$(AssemblyBinDirOutputPath)', 'ref')) + $([MSBuild]::NormalizeDirectory('$(AssemblyBinDirOutputPath)', 'ref')) diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index 4dc8b93c36de8..865c32da69bc4 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -30,7 +30,11 @@ elseif (CLR_CMAKE_TARGET_FREEBSD) elseif (CLR_CMAKE_TARGET_NETBSD) set(PAL_UNIX_NAME \"NETBSD\") elseif (CLR_CMAKE_TARGET_SUNOS) - set(PAL_UNIX_NAME \"SUNOS\") + if (CLR_CMAKE_TARGET_ILLUMOS) + set(PAL_UNIX_NAME \"ILLUMOS\") + else () + set(PAL_UNIX_NAME \"SOLARIS\") + endif () # requires /opt/tools when building in Global Zone (GZ) include_directories(SYSTEM /opt/local/include /opt/tools/include) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector") diff --git a/src/libraries/OSGroups.json b/src/libraries/OSGroups.json index 6b26bd7e2aecf..dfe59c9691e35 100644 --- a/src/libraries/OSGroups.json +++ b/src/libraries/OSGroups.json @@ -1,6 +1,6 @@ { "runtimes": { - "Unix" : { + "Unix" : { }, "Browser" : { "#import": [ @@ -38,6 +38,28 @@ ] }, "NetBSD": { + "#import": [ + "Unix" + ] + }, + "Illumos": { + "#import": [ + "Unix" + ] + } + }, + "Solaris": { + "#import": [ + "Unix" + ] + }, + "Illumos": { + "#import": [ + "Unix" + ] + } + }, + "Solaris": { "#import": [ "Unix" ] diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json index ca8d8b4493f6a..41a7e17807e7c 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json @@ -2063,6 +2063,20 @@ "any", "base" ], + "illumos": [ + "illumos", + "unix", + "any", + "base" + ], + "illumos-x64": [ + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], "ios": [ "ios", "unix", @@ -3298,6 +3312,60 @@ "any", "base" ], + "omnios": [ + "omnios", + "illumos", + "unix", + "any", + "base" + ], + "omnios-x64": [ + "omnios-x64", + "omnios", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "omnios.15": [ + "omnios.15", + "omnios", + "illumos", + "unix", + "any", + "base" + ], + "omnios.15-x64": [ + "omnios.15-x64", + "omnios.15", + "omnios-x64", + "omnios", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "openindiana": [ + "openindiana", + "illumos", + "unix", + "any", + "base" + ], + "openindiana-x64": [ + "openindiana-x64", + "openindiana", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], "opensuse": [ "opensuse", "linux", @@ -4250,6 +4318,97 @@ "any", "base" ], + "smartos": [ + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos-x64": [ + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "smartos.2020": [ + "smartos.2020", + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos.2020-x64": [ + "smartos.2020-x64", + "smartos.2020", + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "smartos.2021": [ + "smartos.2021", + "smartos.2020", + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos.2021-x64": [ + "smartos.2021-x64", + "smartos.2021", + "smartos.2020-x64", + "smartos.2020", + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "solaris": [ + "solaris", + "unix", + "any", + "base" + ], + "solaris-x64": [ + "solaris-x64", + "solaris", + "unix-x64", + "unix", + "any", + "base" + ], + "solaris.11": [ + "solaris.11", + "solaris", + "unix", + "any", + "base" + ], + "solaris.11-x64": [ + "solaris.11-x64", + "solaris.11", + "solaris-x64", + "solaris", + "unix-x64", + "unix", + "any", + "base" + ], "tizen": [ "tizen", "linux", diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json index aa9f28ca15d33..4584c45f8e267 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json @@ -898,6 +898,17 @@ "linux-x64" ] }, + "illumos": { + "#import": [ + "unix" + ] + }, + "illumos-x64": { + "#import": [ + "illumos", + "unix-x64" + ] + }, "ios": { "#import": [ "unix" @@ -1397,6 +1408,39 @@ "rhel.8.0-x64" ] }, + "omnios": { + "#import": [ + "illumos" + ] + }, + "omnios-x64": { + "#import": [ + "omnios", + "illumos-x64" + ] + }, + "omnios.15": { + "#import": [ + "omnios" + ] + }, + "omnios.15-x64": { + "#import": [ + "omnios.15", + "omnios-x64" + ] + }, + "openindiana": { + "#import": [ + "illumos" + ] + }, + "openindiana-x64": { + "#import": [ + "openindiana", + "illumos-x64" + ] + }, "opensuse": { "#import": [ "linux" @@ -1823,6 +1867,61 @@ "sles.15-x64" ] }, + "smartos": { + "#import": [ + "illumos" + ] + }, + "smartos-x64": { + "#import": [ + "smartos", + "illumos-x64" + ] + }, + "smartos.2020": { + "#import": [ + "smartos" + ] + }, + "smartos.2020-x64": { + "#import": [ + "smartos.2020", + "smartos-x64" + ] + }, + "smartos.2021": { + "#import": [ + "smartos.2020" + ] + }, + "smartos.2021-x64": { + "#import": [ + "smartos.2021", + "smartos.2020-x64" + ] + }, + "solaris": { + "#import": [ + "unix" + ] + }, + "solaris-x64": { + "#import": [ + "solaris", + "unix-x64" + ] + }, + "solaris.11": { + "#import": [ + "solaris" + ] + }, + "solaris.11-x64": { + "#import": [ + "solaris.11", + "solaris-x64" + ] + }, "tizen": { "#import": [ "linux" diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props index 1cb561273e87a..49876be074df1 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props @@ -130,6 +130,34 @@ 11;12;13 + + unix + x64 + 11 + + + + unix + x64 + + + + illumos + x64 + 15 + + + + illumos + x64 + + + + illumos + x64 + 2020;2021 + + linux From 8e5ae6ed20987d9f46a6639a8f7e29226de3eae9 Mon Sep 17 00:00:00 2001 From: Adeel Date: Thu, 28 May 2020 00:32:25 +0300 Subject: [PATCH 2/3] Use official capitalization in all strings --- eng/Configurations.props | 2 +- eng/build.sh | 6 +++--- eng/native/init-distro-rid.sh | 4 ++-- eng/native/init-os-and-arch.sh | 5 +++-- eng/run-test.sh | 8 ++++---- eng/targetframeworksuffix.props | 2 +- src/coreclr/dir.common.props | 2 +- src/coreclr/src/.nuget/Directory.Build.props | 4 ++-- src/coreclr/tests/scripts/run-pmi-diffs.py | 2 +- src/coreclr/tests/setup-stress-dependencies.sh | 4 ++-- src/coreclr/tests/src/Directory.Build.props | 4 ++-- .../src/JIT/Directed/StructABI/StructABI.csproj | 2 +- src/installer/Directory.Build.props | 6 +++--- .../pkg/projects/netcoreapp/Directory.Build.props | 2 +- .../TestUtilities/System/PlatformDetection.cs | 6 +++--- src/libraries/Directory.Build.props | 8 ++++---- src/libraries/OSGroups.json | 14 +------------- 17 files changed, 35 insertions(+), 46 deletions(-) diff --git a/eng/Configurations.props b/eng/Configurations.props index 406d310264232..1d6ad36e8150c 100644 --- a/eng/Configurations.props +++ b/eng/Configurations.props @@ -52,7 +52,7 @@ OSX FreeBSD NetBSD - Illumos + illumos Solaris Linux Windows_NT diff --git a/eng/build.sh b/eng/build.sh index 5acbe8d35b4ea..56c78713cb249 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -18,7 +18,7 @@ usage() { echo "Common settings:" echo " --subset Build a subset, print available subsets with -subset help (short: -s)" - echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD, Illumos or Solaris" + echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD, illumos or Solaris" echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm" echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)" echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)" @@ -191,12 +191,12 @@ while [[ $# > 0 ]]; do browser) os="Browser" ;; illumos) - os="Illumos" ;; + os="illumos" ;; solaris) os="Solaris" ;; *) echo "Unsupported target OS '$2'." - echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, Illumos and Solaris." + echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, illumos and Solaris." exit 1 ;; esac diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index a446a2b9a3b04..b6921a903469b 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -70,7 +70,7 @@ initNonPortableDistroRid() elif getprop ro.product.system.model 2>&1 | grep -qi android; then __android_sdk_version=$(getprop ro.build.version.sdk) nonPortableBuildID="android.$__android_sdk_version-${buildArch}" - elif [ "$targetOs" = "Illumos" ]; then + elif [ "$targetOs" = "illumos" ]; then __uname_version=$(uname -v) case "$__uname_version" in omnios-*) @@ -188,7 +188,7 @@ initDistroRidGlobal() distroRid="browser-$buildArch" elif [ "$targetOs" = "FreeBSD" ]; then distroRid="freebsd-$buildArch" - elif [ "$targetOs" = "Illumos" ]; then + elif [ "$targetOs" = "illumos" ]; then distroRid="illumos-$buildArch" elif [ "$targetOs" = "Solaris" ]; then distroRid="solaris-$buildArch" diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index e568d13bb7e71..46c128de93c9f 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -21,9 +21,10 @@ esac # and `uname -p` returns processor type (e.g. i386 on amd64). # The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. if [ "$os" = "SunOS" ]; then - os="Solaris" if uname -o 2>&1 | grep -q illumos; then - os="Illumos" + os="illumos" + else + os="Solaris" fi CPUName=$(isainfo -n) else diff --git a/eng/run-test.sh b/eng/run-test.sh index a09ac1b3207f1..b3d382a5cf098 100644 --- a/eng/run-test.sh +++ b/eng/run-test.sh @@ -15,12 +15,12 @@ wait_on_pids() usage() { - echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD, Illumos or Solaris" + echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD, illumos or Solaris" echo "usage: run-test [options]" echo echo "Input sources:" echo " --runtime Location of root of the binaries directory" - echo " containing the FreeBSD, Linux, NetBSD, Illumos or Solaris runtime" + echo " containing the FreeBSD, Linux, NetBSD, illumos or Solaris runtime" echo " default: /bin/testhost/netcoreapp---" echo " --corefx-tests Location of the root binaries location containing" echo " the tests to run" @@ -29,7 +29,7 @@ usage() echo "Flavor/OS/Architecture options:" echo " --configuration Configuration to run (Debug/Release)" echo " default: Debug" - echo " --os OS to run (FreeBSD, Linux, NetBSD, Illumos or Solaris)" + echo " --os OS to run (FreeBSD, Linux, NetBSD, illumos or Solaris)" echo " default: detect current OS" echo " --arch Architecture to run (x64, arm, armel, x86, arm64)" echo " default: detect current architecture" @@ -254,7 +254,7 @@ then exit 1 fi -if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "Illumos" ] && [ "$OS" != "Solaris" ] +if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "illumos" ] && [ "$OS" != "Solaris" ] then echo "error: OS should be FreeBSD, Linux, NetBSD or Linux" exit 1 diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index 7e3dc8de024c0..fb6bbd5e0602e 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -62,7 +62,7 @@ netbsd - + true true diff --git a/src/coreclr/dir.common.props b/src/coreclr/dir.common.props index b7b3b8de82e43..f45eb84e8f277 100644 --- a/src/coreclr/dir.common.props +++ b/src/coreclr/dir.common.props @@ -55,7 +55,7 @@ true true true - true + true true true true diff --git a/src/coreclr/src/.nuget/Directory.Build.props b/src/coreclr/src/.nuget/Directory.Build.props index e6f2177e9fb89..1a8f5c0d7414b 100644 --- a/src/coreclr/src/.nuget/Directory.Build.props +++ b/src/coreclr/src/.nuget/Directory.Build.props @@ -28,7 +28,7 @@ $(OSRid) - Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;Illumos;Solaris + Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;illumos;Solaris ;$(SupportedPackageOSGroups); - true + + true $(AssetOutputPath)sharedfx_$(OutputRid)_$(Configuration)_version_badge.svg diff --git a/src/installer/pkg/projects/netcoreapp/Directory.Build.props b/src/installer/pkg/projects/netcoreapp/Directory.Build.props index 4b66aa2fb7be3..63ce1c404aba0 100644 --- a/src/installer/pkg/projects/netcoreapp/Directory.Build.props +++ b/src/installer/pkg/projects/netcoreapp/Directory.Build.props @@ -15,7 +15,7 @@ Browser FreeBSD NetBSD - Illumos + illumos Solaris $(CoreCLRTargetOS) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index c02986f6225b5..7b3a14364a409 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -26,8 +26,8 @@ public static partial class PlatformDetection public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); - public static bool IsIllumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("Illumos")); - public static bool IsSolaris => RuntimeInformation.IsOSPlatform(OSPlatform.Create("Solaris")); + public static bool IsIllumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")); + public static bool IsSolaris => RuntimeInformation.IsOSPlatform(OSPlatform.Create("SOLARIS")); public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; public static bool IsNotArmProcess => !IsArmProcess; @@ -274,7 +274,7 @@ private static bool GetTls13Support() } else if (IsOpenSslSupported) { - // Covers Linux, FreeBSD, Illumos and Solaris + // Covers Linux, FreeBSD, illumos and Solaris return OpenSslVersion >= new Version(1,1,1); } diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 0fc21d4b9ba46..b5a48f86c0ff4 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -20,7 +20,7 @@ $(LibrariesProjectRoot)OSGroups.json $(NetCoreAppCurrent) false - $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Illumos;$(NetCoreAppCurrent)-Solaris + $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris $(RepositoryEngineeringDir)LicenseHeader.txt @@ -94,7 +94,7 @@ <_portableOS Condition="'$(_runtimeOSFamily)' == 'win' or '$(TargetOS)' == 'Windows_NT'">win <_portableOS Condition="'$(_runtimeOSFamily)' == 'osx'">osx <_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd - <_portableOS Condition="'$(_runtimeOSFamily)' == 'Illumos'">illumos + <_portableOS Condition="'$(_runtimeOSFamily)' == 'illumos'">illumos <_portableOS Condition="'$(_runtimeOSFamily)' == 'Solaris'">solaris <_portableOS Condition="'$(RuntimeOS)' == 'Browser'">browser <_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios @@ -126,10 +126,10 @@ $(ToolRuntimeRID) - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'Illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'Illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux <_packageRID /> <_packageRID Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture) diff --git a/src/libraries/OSGroups.json b/src/libraries/OSGroups.json index dfe59c9691e35..c63d8d977b182 100644 --- a/src/libraries/OSGroups.json +++ b/src/libraries/OSGroups.json @@ -42,23 +42,11 @@ "Unix" ] }, - "Illumos": { - "#import": [ - "Unix" - ] - } - }, - "Solaris": { + "illumos": { "#import": [ "Unix" ] }, - "Illumos": { - "#import": [ - "Unix" - ] - } - }, "Solaris": { "#import": [ "Unix" From ded38ca2212672d8bd0206705f978ecc8a4ca439 Mon Sep 17 00:00:00 2001 From: Adeel Date: Tue, 2 Jun 2020 07:30:25 +0000 Subject: [PATCH 3/3] Compile get rid functions separately --- .../corehost/cli/hostmisc/pal.unix.cpp | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp index a2207e356145f..4a3e408208515 100644 --- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp @@ -601,7 +601,7 @@ pal::string_t pal::get_current_os_rid_platform() return ridOS; } -#elif defined(__sun) +#elif defined(TARGET_ILLUMOS) pal::string_t pal::get_current_os_rid_platform() { // Code: @@ -609,15 +609,13 @@ pal::string_t pal::get_current_os_rid_platform() // if (uname(&u) != -1) // printf("sysname: %s, release: %s, version: %s, machine: %s\n", u.sysname, u.release, u.version, u.machine); // - // Output Examples: + // Output examples: // on OmniOS // sysname: SunOS, release: 5.11, version: omnios-r151018-95eaa7e, machine: i86pc // on OpenIndiana Hipster: // sysname: SunOS, release: 5.11, version: illumos-63878f749f, machine: i86pc // on SmartOS: // sysname: SunOS, release: 5.11, version: joyent_20200408T231825Z, machine: i86pc - // on Solaris 11: - // sysname: SunOS, release: 5.11, version: 11.3, machine: i86pc pal::string_t ridOS; struct utsname utsname_obj; @@ -640,14 +638,32 @@ pal::string_t pal::get_current_os_rid_platform() ridOS.append(_X("smartos.")) .append(utsname_obj.version, strlen("joyent_"), 4); // e.g. smartos.2020 } - else // solaris + + return ridOS; +} +#elif defined(__sun) +pal::string_t pal::get_current_os_rid_platform() +{ + // Code: + // struct utsname u; + // if (uname(&u) != -1) + // printf("sysname: %s, release: %s, version: %s, machine: %s\n", u.sysname, u.release, u.version, u.machine); + // + // Output example on Solaris 11: + // sysname: SunOS, release: 5.11, version: 11.3, machine: i86pc + + pal::string_t ridOS; + struct utsname utsname_obj; + if (uname(&utsname_obj) < 0) { - char *pos = strchr(utsname_obj.version, '.'); - if (pos) - { - ridOS.append(_X("solaris.")) - .append(utsname_obj.version, pos - utsname_obj.version); // e.g. solaris.11 - } + return ridOS; + } + + char *pos = strchr(utsname_obj.version, '.'); + if (pos) + { + ridOS.append(_X("solaris.")) + .append(utsname_obj.version, pos - utsname_obj.version); // e.g. solaris.11 } return ridOS;