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

Added wasi-sdk flow #307

Merged
merged 36 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ad1ca5e
Added wasi-sdk flow
mkhamoyan Jan 17, 2023
426b8ff
Added wasi in azure-pipelines
mkhamoyan Jan 17, 2023
2525da0
Removed container name
mkhamoyan Jan 17, 2023
a0cb465
Change Wasi_SDK_PATH for CI
mkhamoyan Jan 17, 2023
17beb4d
update paths
mkhamoyan Jan 17, 2023
3f2da6c
update path
mkhamoyan Jan 17, 2023
f38f521
update path
mkhamoyan Jan 17, 2023
915bc84
update path
mkhamoyan Jan 17, 2023
90c071d
change wasi-sdk-version
mkhamoyan Jan 17, 2023
b1ed769
Updated PatchWasiSdk
mkhamoyan Jan 18, 2023
d5fd0ef
update icu.proj
mkhamoyan Jan 18, 2023
a4b8734
update icu.proj
mkhamoyan Jan 18, 2023
a536b93
update the root
mkhamoyan Jan 18, 2023
bf0e0aa
update icu.proj
mkhamoyan Jan 18, 2023
a443d2c
upate icu.proj
mkhamoyan Jan 18, 2023
3f15161
update icu.proj
mkhamoyan Jan 18, 2023
2b441a6
update wasi clang paths
mkhamoyan Jan 18, 2023
a8e96b4
update comfiler-flags
mkhamoyan Jan 18, 2023
32e532b
update compiler_flags
mkhamoyan Jan 18, 2023
f244f8b
update compiler_flags
mkhamoyan Jan 18, 2023
4ab7653
update compiler flags
mkhamoyan Jan 18, 2023
d717f61
update compiler config
mkhamoyan Jan 18, 2023
2955160
update compiler-config
mkhamoyan Jan 18, 2023
24885c9
update
mkhamoyan Jan 18, 2023
1f7ff41
Fix icu for wasi
mkhamoyan Jan 19, 2023
a7d2c77
Added patch for icu changes
mkhamoyan Jan 20, 2023
40a1e89
update hardcoded HOST_PLATFORM
mkhamoyan Jan 20, 2023
605ef11
Remove not used host
mkhamoyan Jan 20, 2023
1163a29
update condition for platform check
mkhamoyan Jan 20, 2023
1b926d9
Merge branch 'dotnet/main' into icu_wasi_sdk
mkhamoyan Jan 24, 2023
ea55666
Refactoring
mkhamoyan Jan 24, 2023
17e2613
download wasi-sdk when needed
mkhamoyan Jan 25, 2023
30a53d9
Added comments
mkhamoyan Jan 25, 2023
3036bc2
Remove unused code
mkhamoyan Jan 25, 2023
ca26058
Removed extra line
mkhamoyan Jan 25, 2023
e435609
update
mkhamoyan Jan 26, 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 eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
<PropertyGroup>
<MicrosoftDotNetBuildTasksPackagingVersion>8.0.0-beta.23067.5</MicrosoftDotNetBuildTasksPackagingVersion>
</PropertyGroup>
<PropertyGroup>
<WasiSdkVersion>16</WasiSdkVersion>
</PropertyGroup>
</Project>
55 changes: 55 additions & 0 deletions eng/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,51 @@ stages:
artifactName: Artifacts_Browser_Threading
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

############ WASI BUILD ############
- job: Build_Wasi
displayName: Wasi
timeoutInMinutes: 360
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
vmImage: ubuntu-20.04
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
container:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-webassembly
steps:
- bash: |
./build.sh --ci --restore --build --configuration $(_BuildConfig) /p:TargetOS=Wasi /p:TargetArchitecture=wasm $(_InternalBuildArgs)
displayName: Build
- task: PublishPipelineArtifact@1
displayName: Upload artifacts
inputs:
targetPath: 'artifacts/bin'
artifactName: Artifacts_Wasi
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

- job: Build_Wasi_Threading
displayName: Wasi_Threading
timeoutInMinutes: 360
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
vmImage: ubuntu-20.04
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
container:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-webassembly
steps:
- bash: |
./build.sh --ci --restore --build --configuration $(_BuildConfig) /p:TargetOS=Wasi /p:TargetArchitecture=wasm /p:WasmEnableThreads=true $(_InternalBuildArgs)
displayName: Build
- task: PublishPipelineArtifact@1
displayName: Upload artifacts
inputs:
targetPath: 'artifacts/bin'
artifactName: Artifacts_Wasi_Threading
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

############ iOS BUILD ############
- job: Build_iOS
displayName: iOS
Expand Down Expand Up @@ -168,6 +213,8 @@ stages:
dependsOn:
- Build_Browser
- Build_Browser_Threading
- Build_Wasi
- Build_Wasi_Threading
- Build_iOS
- Build_MacCatalyst
- Build_tvOS
Expand All @@ -188,6 +235,14 @@ stages:
inputs:
artifact: Artifacts_Browser_Threading
path: 'artifacts/bin/browser-threading'
- task: DownloadPipelineArtifact@2
Copy link
Member

Choose a reason for hiding this comment

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

For a future PR: This Publish Packages job should run for PRs too, and generate the packages, but skip the publishing part itself. This would ensure that the PR doesn't break packaging.

inputs:
artifact: Artifacts_Wasi
path: 'artifacts/bin'
- task: DownloadPipelineArtifact@2
inputs:
artifact: Artifacts_Wasi_Threading
path: 'artifacts/bin/wasi-threading'
- task: DownloadPipelineArtifact@2
inputs:
artifact: Artifacts_iOS
Expand Down
4 changes: 2 additions & 2 deletions eng/icu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ data-$(2): $(TARGET_OBJDIR)/$(1)/.stamp-configure | $(TARGET_OBJDIR)/$(1) $(TARG

endef

ifeq ($(TARGET_OS),browser)
$(eval $(call TargetBuildTemplate,icudt_browser,icudt))
steveisok marked this conversation as resolved.
Show resolved Hide resolved
ifeq ($(TARGET_ARCHITECTURE),wasm)
pavelsavara marked this conversation as resolved.
Show resolved Hide resolved
$(eval $(call TargetBuildTemplate,icudt_wasm,icudt))
else
$(eval $(call TargetBuildTemplate,icudt_mobile,icudt))
endif
Expand Down
26 changes: 24 additions & 2 deletions eng/icu.proj
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<Project>
<Target Name="Build" Condition="'$(PackOnly)' != 'true'" DependsOnTargets="PatchEmscripten;CopyEmscriptenVersion">
<Import Project="$(RepositoryEngineeringDir)Versions.props" />

<Target Name="Build" Condition="'$(PackOnly)' != 'true'" DependsOnTargets="PatchEmscripten;CopyEmscriptenVersion;DownloadWasiSdk">
<Error Condition="'$(TargetOS)' == ''" Text="TargetOS needs to be specified!" />
<Error Condition="'$(TargetArchitecture)' == ''" Text="TargetArchitecture needs to be specified!" />

<PropertyGroup>
<_ExtraParams Condition="'$(WasmEnableThreads)' == 'true'">WASM_ENABLE_THREADS=true</_ExtraParams>
</PropertyGroup>

<!-- Set WASI sdk path if WASI_SDK_PATH env variable is not set -->
<PropertyGroup Condition="'$(TargetOS)' == 'Wasi' and '$(WASI_SDK_PATH)' == ''">
<WASI_SDK_PATH Condition="'$(WASI_SDK_PATH)' == ''">$(RepoRoot)artifacts/wasi-sdk</WASI_SDK_PATH>
</PropertyGroup>

<Copy SourceFiles="$(MSBuildThisFileDirectory)\..\icu-filters\curr-root.txt"
DestinationFiles="$(MSBuildThisFileDirectory)\..\icu\icu4c\source\data\curr\root.txt"/>
<Exec WorkingDirectory="$(MSBuildThisFileDirectory)"
Command="make -f icu.mk all TARGET_OS=$(TargetOS.ToLower()) TARGET_ARCHITECTURE=$(TargetArchitecture) ICU_TRACING=$(IcuTracing) $(_ExtraParams) SHELL=/bin/bash"
Command="make -f icu.mk all TARGET_OS=$(TargetOS.ToLower()) TARGET_ARCHITECTURE=$(TargetArchitecture) ICU_TRACING=$(IcuTracing) WASI_SDK_PATH=$(WASI_SDK_PATH) $(_ExtraParams) SHELL=/bin/bash"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="Restore" />
Expand All @@ -37,4 +44,19 @@
Lines="@(_ItemsFromEmscriptenVersionFile->Replace('&quot;', ''))"
Overwrite="true" />
</Target>

<!-- Download WASI sdk if WASI_SDK_PATH env variable is not set -->
<Target Name="DownloadWasiSdk" Condition="'$(TargetOS)' == 'Wasi' and '$(WASI_SDK_PATH)' == ''">
<PropertyGroup>
<_WasiLocalPath>$(RepoRoot)\artifacts</_WasiLocalPath>
<_WasiSdkUrl Condition="$([MSBuild]::IsOSPlatform('Linux'))">https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-linux.tar.gz</_WasiSdkUrl>
<_WasiSdkUrl Condition="$([MSBuild]::IsOSPlatform('OSX'))">https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-macos.tar.gz</_WasiSdkUrl>
</PropertyGroup>

<Error Condition="'$(_WasiSdkUrl)' == ''" Text="_WasiSdkUrl is not set!" />

<Exec Command="rm -rf wasi-sdk-*/ wasi-sdk/ &amp;&amp; curl -L -o- $(_WasiSdkUrl) --fail -S | tar -xvz &amp;&amp; mv wasi-sdk-$(WasiSdkVersion).*/ wasi-sdk/"
WorkingDirectory="$(_WasiLocalPath)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>
29 changes: 29 additions & 0 deletions eng/icu.wasi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# TODO: add other host platform/arch combinations
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
UNAME_R := $(shell uname -r)

ifeq ($(UNAME_S),Linux)
HOST_PLATFORM=x86_64-pc-linux-gnu
endif
ifeq ($(UNAME_S),Darwin)
ifeq ($(UNAME_M),arm64)
HOST_PLATFORM=arm64-apple-darwin$(UNAME_R)
endif
ifeq ($(UNAME_M),x86_64)
HOST_PLATFORM=x86_64-apple-darwin$(UNAME_R)
endif
endif
ifeq ($(WASM_ENABLE_THREADS),true)
pavelsavara marked this conversation as resolved.
Show resolved Hide resolved
THREADS_FLAG="-pthread"
endif

CONFIGURE_COMPILER_FLAGS += \
CFLAGS="-Oz -fno-exceptions -Wno-sign-compare $(THREADS_FLAG) $(ICU_DEFINES)" \
CXXFLAGS="-Oz -fno-exceptions -Wno-sign-compare $(THREADS_FLAG) $(ICU_DEFINES)" \
CC="$(WASI_SDK_PATH)/bin/clang --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot" \
CXX="$(WASI_SDK_PATH)/bin/clang++ --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot" \
--host=$(HOST_PLATFORM) --build=wasm32

check-env:
:
File renamed without changes.
Loading