Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[wasi] compile with libs.native #79046

Merged
merged 56 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bbd925f
wip
pavelsavara Nov 30, 2022
fa5081a
wip
pavelsavara Nov 30, 2022
31964c3
wip
pavelsavara Nov 30, 2022
d261d1b
wip
pavelsavara Nov 30, 2022
2782819
wip
pavelsavara Nov 30, 2022
867e8d8
wip
pavelsavara Nov 30, 2022
87de23e
wip
pavelsavara Nov 30, 2022
2ae0339
fix
pavelsavara Nov 30, 2022
269d7a2
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 1, 2022
2efd28f
provision SDK to WASI_SDK_PATH
pavelsavara Dec 1, 2022
6bffc9d
fix
pavelsavara Dec 1, 2022
83a54e3
wip
pavelsavara Dec 1, 2022
8de88e1
wip
pavelsavara Dec 1, 2022
9382309
Merge branch 'wasi_native_prep' of https://github.com/pavelsavara/run…
pavelsavara Dec 1, 2022
dd71877
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 5, 2022
9b36c3b
fix after merge
pavelsavara Dec 5, 2022
e67bb29
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 5, 2022
2a3d7ea
wip
pavelsavara Dec 5, 2022
f213ab6
feedback
pavelsavara Dec 5, 2022
97687bc
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 6, 2022
61f1276
add wasi_wasm container
pavelsavara Dec 6, 2022
288199b
feedback
pavelsavara Dec 6, 2022
db57540
wip
pavelsavara Dec 6, 2022
0434363
fix
pavelsavara Dec 6, 2022
8a3c728
container
pavelsavara Dec 6, 2022
d494bec
fix
pavelsavara Dec 7, 2022
461eeda
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 7, 2022
b4f9759
Merge remote-tracking branch 'origin/main' into wasi_native_prep
radical Dec 8, 2022
d039ca6
Merge remote-tracking branch 'origin/main' into wasi_native_prep
radical Dec 12, 2022
f80e897
wasm-library-tests: re-enable tests
radical Dec 12, 2022
596689a
Add back wasm linker-tests job
radical Dec 12, 2022
033164b
getrusage isn't available
radical Dec 12, 2022
86a1024
Merge remote-tracking branch 'origin/main' into wasi_native_prep
radical Dec 12, 2022
4947cf8
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 14, 2022
a9fd1ad
fix
pavelsavara Dec 14, 2022
39e58f2
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 16, 2022
bd8fb9e
Update eng/pipelines/common/templates/pipeline-with-resources.yml
pavelsavara Dec 19, 2022
9bb5faf
Update src/libraries/System.Private.CoreLib/src/System/Runtime/Intero…
pavelsavara Dec 19, 2022
d4ba0b2
Update src/libraries/System.Private.CoreLib/src/System/Threading/Over…
pavelsavara Dec 19, 2022
829ae38
Update src/mono/Directory.Build.props
pavelsavara Dec 19, 2022
d640c98
Update Directory.Build.props
pavelsavara Dec 19, 2022
1dc21c6
Update src/mono/cmake/configure.cmake
pavelsavara Dec 19, 2022
0d79ba5
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 20, 2022
17f9043
feedback
pavelsavara Dec 20, 2022
92f9bc8
wip
pavelsavara Dec 20, 2022
9d26f1d
wip
pavelsavara Dec 20, 2022
8026107
feedback
pavelsavara Dec 20, 2022
609c42e
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 21, 2022
99065d9
feedback
pavelsavara Dec 21, 2022
2700e30
Merge branch 'main' into wasi_native_prep
pavelsavara Dec 26, 2022
f53ba77
Merge branch 'main' into wasi_native_prep
pavelsavara Jan 2, 2023
b172a04
Merge branch 'main' into wasi_native_prep
pavelsavara Jan 3, 2023
edfe354
feedback
pavelsavara Jan 3, 2023
f7f8cb9
Merge branch 'main' into wasi_native_prep
pavelsavara Jan 6, 2023
3a273db
fix merge
pavelsavara Jan 6, 2023
c1b834d
fix
pavelsavara Jan 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 's390x'">s390x</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'ppc64le'">ppc64le</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and ('$(TargetOS)' == 'Browser' or '$(RuntimeIdentifier)' == 'browser-wasm')">wasm</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and ('$(TargetOS)' == 'wasi' or '$(RuntimeIdentifier)' == 'wasi-wasm')">wasm</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(TargetsMobile)' == 'true'">x64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<Platform Condition="'$(Platform)' == '' and '$(InferPlatformFromTargetArchitecture)' == 'true'">$(TargetArchitecture)</Platform>
Expand Down Expand Up @@ -129,6 +130,8 @@
<TestExclusionListTasksAssemblyPath>$([MSBuild]::NormalizePath('$(TestExclusionListTasksDir)', 'TestExclusionListTasks.dll'))</TestExclusionListTasksAssemblyPath>
<CoreCLRToolPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)'))</CoreCLRToolPath>
<ILAsmToolPath Condition="'$(DotNetBuildFromSource)' == 'true' or '$(BuildArchitecture)' == 's390x' or '$(BuildArchitecture)' == 'ppc64le'">$(CoreCLRToolPath)</ILAsmToolPath>

<WasmtimeDir>$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
</PropertyGroup>

<PropertyGroup Label="CalculateConfiguration">
Expand Down
4 changes: 4 additions & 0 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ if ($PSBoundParameters.ContainsKey('os') -and $PSBoundParameters['os'] -eq "Brow
# make sure it is capitalized
$PSBoundParameters['os'] = "Browser"
}
if ($PSBoundParameters.ContainsKey('os') -and $PSBoundParameters['os'] -eq "wasi") {
# make sure it is not capitalized
$PSBoundParameters['os'] = "wasi"
}

foreach ($argument in $PSBoundParameters.Keys)
{
Expand Down
6 changes: 3 additions & 3 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ elseif (CLR_CMAKE_HOST_UNIX)
endif ()
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)

if(CLR_CMAKE_HOST_BROWSER)
if(CLR_CMAKE_HOST_BROWSER OR CLR_CMAKE_HOST_WASI)
# The emscripten build has additional warnings so -Werror breaks
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-alloca)
Expand Down Expand Up @@ -390,7 +390,7 @@ if (CLR_CMAKE_HOST_UNIX)
add_definitions(-DLSE_INSTRUCTIONS_ENABLED_BY_DEFAULT)
add_compile_options(-mcpu=apple-m1)
endif(CLR_CMAKE_HOST_UNIX_ARM64)
elseif(NOT CLR_CMAKE_HOST_BROWSER)
elseif(NOT CLR_CMAKE_HOST_BROWSER AND NOT CLR_CMAKE_HOST_WASI)
check_c_compiler_flag(-fstack-protector-strong COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
if (COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
add_compile_options(-fstack-protector-strong)
Expand Down Expand Up @@ -795,7 +795,7 @@ if (CLR_CMAKE_HOST_WIN32)
message(FATAL_ERROR "MC not found")
endif()

elseif (NOT CLR_CMAKE_HOST_BROWSER)
elseif (NOT CLR_CMAKE_HOST_BROWSER AND NOT CLR_CMAKE_HOST_WASI)
# This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995.
#
# In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain
Expand Down
12 changes: 6 additions & 6 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ if(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
set(CLR_CMAKE_HOST_BROWSER 1)
endif(CLR_CMAKE_HOST_OS STREQUAL Emscripten)

if(CLR_CMAKE_TARGET_OS STREQUAL Wasi)
if(CLR_CMAKE_TARGET_OS STREQUAL WASI)
set(CLR_CMAKE_HOST_WASI 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL Wasi)
endif(CLR_CMAKE_TARGET_OS STREQUAL WASI)

#--------------------------------------------
# This repo builds two set of binaries
Expand Down Expand Up @@ -417,9 +417,9 @@ if(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
set(CLR_CMAKE_TARGET_BROWSER 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)

if(CLR_CMAKE_TARGET_OS STREQUAL Wasi)
if(CLR_CMAKE_TARGET_OS STREQUAL WASI)
set(CLR_CMAKE_TARGET_WASI 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL Wasi)
endif(CLR_CMAKE_TARGET_OS STREQUAL WASI)

if(CLR_CMAKE_TARGET_UNIX)
if(CLR_CMAKE_TARGET_ARCH STREQUAL x64)
Expand Down Expand Up @@ -454,7 +454,7 @@ else()
endif(CLR_CMAKE_TARGET_UNIX)

# check if host & target os/arch combination are valid
if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS))
if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS) AND NOT CLR_CMAKE_TARGET_WASI)
if(NOT (CLR_CMAKE_HOST_OS STREQUAL windows))
message(FATAL_ERROR "Invalid host and target os/arch combination. Host OS: ${CLR_CMAKE_HOST_OS}")
endif()
Expand All @@ -466,7 +466,7 @@ if (NOT (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS))
endif()
endif()

if(NOT CLR_CMAKE_TARGET_BROWSER)
if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
# The default linker on Solaris also does not support PIE.
if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_HOST_TVOS AND NOT CLR_CMAKE_HOST_IOS AND NOT MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
Expand Down
2 changes: 1 addition & 1 deletion eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (CMAKE_C_COMPILER MATCHES "-?[0-9]+(\.[0-9]+)?$")
set(CLR_CMAKE_COMPILER_FILE_NAME_VERSION "${CMAKE_MATCH_0}")
endif()

if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(APPLE)
set(TOOLSET_PREFIX "")
Expand Down
23 changes: 18 additions & 5 deletions eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,34 @@ if /i "%__Arch%" == "wasm" (
)
if /i "%__Os%" == "Browser" (
if "%EMSDK_PATH%" == "" (
if not exist "%__repoRoot%src\mono\wasm\emsdk" (
if not exist "%__repoRoot%\src\mono\wasm\emsdk" (
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
exit /B 1
)

set EMSDK_PATH=%__repoRoot%src\mono\wasm\emsdk
set EMSDK_PATH=!EMSDK_PATH:\=/!
set EMSDK_PATH=%__repoRoot%\src\mono\wasm\emsdk
)
:: replace backslash with forward slash and append last slash
set "EMSDK_PATH=!EMSDK_PATH:\=/!"
pavelsavara marked this conversation as resolved.
Show resolved Hide resolved
if not "!EMSDK_PATH:~-1!" == "/" set "EMSDK_PATH=!EMSDK_PATH!/"

set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_TOOLCHAIN_FILE=!EMSDK_PATH!/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
set __UseEmcmake=1
)
if /i "%__Os%" == "wasi" (
echo Error: WASI build not implemented on Windows yet
exit /B 1
if "%WASI_SDK_PATH%" == "" (
if not exist "%__repoRoot%\src\mono\wasi\wasi-sdk" (
echo Error: Should set WASI_SDK_PATH environment variable pointing to emsdk root.
exit /B 1
)

set WASI_SDK_PATH=%__repoRoot%src\mono\wasi\wasi-sdk
)
:: replace backslash with forward slash and append last slash
set "WASI_SDK_PATH=!WASI_SDK_PATH:\=/!"
if not "!WASI_SDK_PATH:~-1!" == "/" set "WASI_SDK_PATH=!WASI_SDK_PATH!/"
set __CmakeGenerator=Ninja
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=WASI -DCLR_CMAKE_TARGET_ARCH=wasm "-DWASI_SDK_PREFIX=!WASI_SDK_PATH!" "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk.cmake" "-DCMAKE_SYSROOT=!WASI_SDK_PATH!/share/wasi-sysroot"
)
) else (
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"
Expand Down
21 changes: 21 additions & 0 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,27 @@ jobs:
crossBuild: true
${{ insert }}: ${{ parameters.jobParameters }}

# WASI WebAssembly

- ${{ if containsValue(parameters.platforms, 'wasi_wasm') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
osGroup: wasi
archType: wasm
targetRid: wasi-wasm
platform: wasi_wasm
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container: wasi_wasm
jobParameters:
hostedOs: Linux
runtimeFlavor: ${{ parameters.runtimeFlavor }}
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
${{ insert }}: ${{ parameters.jobParameters }}

# Browser WebAssembly

- ${{ if containsValue(parameters.platforms, 'Browser_wasm') }}:
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/common/templates/pipeline-with-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ resources:
- container: Browser_wasm
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-webassembly

- container: wasi_wasm
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-webassembly

- container: FreeBSD_x64
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-freebsd-12
env:
Expand Down
49 changes: 49 additions & 0 deletions eng/pipelines/common/templates/wasi-build-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
parameters:
alwaysRun: false
extraBuildArgs: ''
isExtraPlatformsBuild: false
nameSuffix: ''
platforms: []

jobs:

#
# Build for WASI/wasm and test it
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms: ${{ parameters.platforms }}
variables:
# map dependencies variables to local variables
- name: alwaysRunVar
value: ${{ parameters.alwaysRun }}
- name: shouldRunOnDefaultPipelines
value: $[
or(
eq(variables['wasmDarcDependenciesChanged'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
and(
eq(dependencies.evaluate_paths.outputs['SetPathVars_wasm.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_non_runtimetests.containsChange'], true)),
eq(dependencies.evaluate_paths.outputs['SetPathVars_wasm_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true))
]
jobParameters:
isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
testGroup: innerloop
nameSuffix: ${{ parameters.nameSuffix }}_BuildOnly
buildArgs: -s mono+libs+host -c $(_BuildConfig) /p:ArchiveTests=true ${{ parameters.extraBuildArgs }}
timeoutInMinutes: 240
# if !alwaysRun, then:
# if this is runtime-wasm (isWasmOnlyBuild):
# - then run only if it would not have run on default pipelines (based
# on path changes)
# - else run based on path changes
condition: >-
or(
eq(variables['alwaysRunVar'], true),
eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
10 changes: 1 addition & 9 deletions eng/pipelines/common/templates/wasm-library-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,8 @@ jobs:
eq(variables['alwaysRunVar'], true),
eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/common/templates/additional-steps-then-helix.yml
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
additionalSteps:
- ${{ if eq(parameters.buildAndRunWasi, true) }}:
- script: >-
make -C src/mono/wasi provision-deps all &&
make -C src/mono/wasi/sample/console run
name: build_wasi
displayName: Build WASI, and run a sample

creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
extraHelixArguments: /p:BrowserHost=$(_hostedOs) $(_wasmRunSmokeTestsOnlyArg) ${{ parameters.extraHelixArgs }}
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ jobs:
- ${{ if eq(parameters.platform, 'windows_arm64') }}:
- Windows.11.Arm64.Open

# Browser WebAssembly
- ${{ if eq(parameters.platform, 'Browser_wasm') }}:
# Browser/WASI WebAssembly
- ${{ if in(parameters.platform, 'Browser_wasm', 'wasi_wasm') }}:
- Ubuntu.1804.Amd64.Open

# Browser WebAssembly Firefox
Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,13 @@ extends:
extraBuildArgs: /p:MonoWasmBuildVariant=perftrace
alwaysRun: ${{ variables.isRollingBuild }}

# BUILD ONLY - WASI/Wasm
- template: /eng/pipelines/common/templates/wasi-build-only.yml
parameters:
platforms:
- wasi_wasm
alwaysRun: ${{ variables.isRollingBuild }}

#
# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
# Build the whole product using Mono and run libraries tests
Expand Down
2 changes: 1 addition & 1 deletion eng/targetingpacks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;wasi-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackLabels="Mono"
Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/>
<KnownCrossgen2Pack Include="$(LocalFrameworkOverrideName).Crossgen2"
Expand Down
3 changes: 3 additions & 0 deletions eng/testing/wasi-provisioning.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)ProvisioningVersions.props" />
</Project>
6 changes: 6 additions & 0 deletions eng/versioning.targets
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == '' and !$(TargetFrameworks.Contains('$(TargetFramework)-browser'))">
<CrossPlatformAndHasNoBrowserTarget>true</CrossPlatformAndHasNoBrowserTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == '' and !$(TargetFrameworks.Contains('$(TargetFramework)-wasi'))">
<CrossPlatformAndHasNoWasiTarget>true</CrossPlatformAndHasNoWasiTarget>
</PropertyGroup>

<!-- Enables warnings for Android, iOS, tvOS and macCatalyst for all builds -->
<ItemGroup>
Expand All @@ -78,6 +81,9 @@
<ItemGroup Condition="('$(TargetPlatformIdentifier)' == 'browser' or '$(CrossPlatformAndHasNoBrowserTarget)' == 'true') and '$(IsTestProject)' != 'true'">
<SupportedPlatform Include="browser"/>
</ItemGroup>
<ItemGroup Condition="('$(TargetPlatformIdentifier)' == 'wasi' or '$(CrossPlatformAndHasNoWasiTarget)' == 'true') and '$(IsTestProject)' != 'true'">
<SupportedPlatform Include="wasi"/>
</ItemGroup>

<!-- Add target platforms into MSBuild SupportedPlatform list -->
<ItemGroup Condition="'$(IsTestProject)' != 'true'">
Expand Down
38 changes: 36 additions & 2 deletions src/libraries/System.Console/src/System.Console.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)</TargetFrameworks>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetPlatformIdentifier)' == ''">SR.PlatformNotSupported_SystemConsole</GeneratePlatformNotSupportedAssemblyMessage>
<DefineConstants Condition="'$(TargetPlatformIdentifier)' == 'Browser'">$(DefineConstants);TARGET_BROWSER</DefineConstants>
<DefineConstants Condition="'$(TargetPlatformIdentifier)' == 'wasi'">$(DefineConstants);TARGET_WASI</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetPlatformIdentifier)' != ''">
<Compile Include="System\Console.cs" />
Expand Down Expand Up @@ -47,7 +49,7 @@
<Link>Common\Interop\Android\Interop.Libraries.cs</Link>
</Compile>
</ItemGroup>
<!-- WebAssembly -->
<!-- Browser -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
<Compile Include="System\ConsolePal.WebAssembly.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Dup.cs"
Expand All @@ -63,6 +65,37 @@
<Compile Include="$(CommonPath)Interop\Unix\Interop.IOErrors.cs"
Link="Common\Interop\Unix\Interop.IOErrors.cs" />
</ItemGroup>
<!-- WASI is like unix without dup and termio -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'wasi'">
<Compile Include="System\ConsolePal.Wasi.cs" />
<Compile Include="System\ConsolePal.Unix.ConsoleStream.cs" />
<!--
<Compile Include="System\IO\SyncTextReader.Unix.cs" />
-->

<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.StdinReady.cs"
Link="Common\Interop\Unix\Interop.StdinReady.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.ReadStdinUnbuffered.cs"
Link="Common\Interop\Unix\Interop.ReadStdinUnbuffered.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Poll.cs"
Link="Common\Interop\Unix\Interop.Poll.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Poll.Structs.cs"
Link="Common\Interop\Unix\Interop.Poll.Structs.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Read.cs"
Link="Common\Interop\Unix\Interop.Read.cs" />
<Compile Include="$(CommonPath)System\Text\EncodingHelper.Unix.cs"
Link="Common\System\Text\EncodingHelper.Unix.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Write.cs"
Link="Common\Interop\Unix\Interop.Write.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
Link="Common\Interop\Unix\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
Link="Common\Interop\Unix\Interop.Errors.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FileDescriptors.cs"
Link="Common\Interop\Unix\Interop.FileDescriptors.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.IOErrors.cs"
Link="Common\Interop\Unix\Interop.IOErrors.cs" />
</ItemGroup>
<!-- Windows -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
<Compile Include="System\ConsolePal.Windows.cs" />
Expand Down Expand Up @@ -158,6 +191,7 @@
<!-- Unix -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix'">
<Compile Include="System\ConsolePal.Unix.cs" />
<Compile Include="System\ConsolePal.Unix.ConsoleStream.cs" />
<Compile Include="System\TerminalFormatStrings.cs" />
<Compile Include="$(CommonPath)System\Console\ConsoleUtils.cs"
Link="Common\System\Console\ConsoleUtils.cs" />
Expand Down
Loading