-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[WASI] Acquire the WASI SDK for runtime build automatically and centrally #119253
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1fa6eec
Fix a minor doc typo
SingleAccretion fbafc6b
Remove $(WasiSysRoot)
SingleAccretion 608354a
Fix missing UsingTask for RuntimeConfigParserTask
SingleAccretion a806d73
Remove dead comments
SingleAccretion c0bf4d8
Acquire the WASI SDK for runtime build automatically and centrally
SingleAccretion b19d75b
Move to MonoDependsOnTargets
SingleAccretion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <!-- | ||
| Import these targets to acquire the WASI SDK. | ||
| - Use DependsOnTargets="AcquireWasiSdk" on the target that depends on WASI SDK. | ||
| - By default, this target is conditioned on $(TargetsWasi). | ||
| - You can depend on "AcquireWasiSdkUnconditional" instead if this doesn't work for your project. | ||
| - Use $(RuntimeBuildWasiSdkPath) (set by "AcquireWasiSdk") to refer to the SDK root in your target. | ||
| --> | ||
| <Project> | ||
| <PropertyGroup> | ||
| <_WasiSdkVersion>25.0</_WasiSdkVersion> | ||
| <_RuntimeLocalWasiSdkPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'wasi-sdk'))</_RuntimeLocalWasiSdkPath> | ||
pavelsavara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </PropertyGroup> | ||
|
|
||
| <!-- If the user wants us to use an explicit SDK, validate it matches our expectations. --> | ||
| <Target Name="_ValidateWasiSdk"> | ||
| <PropertyGroup> | ||
| <_ActualWasiSdkVersion Condition="'$(WASI_SDK_PATH)' != '' and Exists('$(WASI_SDK_PATH)/VERSION')">$([System.IO.File]::ReadAllText('$(WASI_SDK_PATH)/VERSION').Split()[0])</_ActualWasiSdkVersion> | ||
| <_UseRuntimeLocalWasiSdk Condition="'$(_WasiSdkVersion)' != '$(_ActualWasiSdkVersion)'">true</_UseRuntimeLocalWasiSdk> | ||
| </PropertyGroup> | ||
| </Target> | ||
|
|
||
| <!-- Otherwise, download our own SDK. Use this file as the input since that's what defines the version. --> | ||
| <Target Name="_AcquireLocalWasiSdk" | ||
| Condition="'$(_UseRuntimeLocalWasiSdk)' == 'true'" | ||
| Inputs="$(MSBuildThisFileFullPath)" | ||
| Outputs="$(_RuntimeLocalWasiSdkPath)VERSION"> | ||
|
|
||
| <Message Text="Downloading a runtime-local WASI SDK $(_WasiSdkVersion) to '$(_RuntimeLocalWasiSdkPath)'" Importance="High" /> | ||
|
|
||
| <PropertyGroup> | ||
pavelsavara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <_WasiSdkMajorVersion>$(_WasiSdkVersion.Split('.')[0])</_WasiSdkMajorVersion> | ||
| <_WasiSdkUrl>https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(_WasiSdkMajorVersion)/wasi-sdk-$(_WasiSdkVersion)-x86_64-linux.tar.gz</_WasiSdkUrl> | ||
| <_WasiSdkUrl Condition="'$(HostOS)' == 'osx'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(_WasiSdkMajorVersion)/wasi-sdk-$(_WasiSdkVersion)-x86_64-macos.tar.gz</_WasiSdkUrl> | ||
| <_WasiSdkUrl Condition="'$(HostOS)' == 'windows'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(_WasiSdkMajorVersion)/wasi-sdk-$(_WasiSdkVersion)-x86_64-windows.tar.gz</_WasiSdkUrl> | ||
| </PropertyGroup> | ||
|
|
||
| <RemoveDir Directories="$(_RuntimeLocalWasiSdkPath)" /> | ||
| <MakeDir Directories="$(_RuntimeLocalWasiSdkPath)" /> | ||
|
|
||
| <Exec Command="curl -L -o wasi-sdk-$(_WasiSdkVersion).tar.gz $(_WasiSdkUrl) && tar --strip-components=1 -xzmf wasi-sdk-$(_WasiSdkVersion).tar.gz -C $(_RuntimeLocalWasiSdkPath)" | ||
pavelsavara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Condition="'$(HostOS)' != 'windows'" | ||
| WorkingDirectory="$(ArtifactsObjDir)" | ||
| IgnoreStandardErrorWarningFormat="true" /> | ||
|
|
||
| <Exec Command="powershell -NonInteractive -command "& $(MSBuildThisFileDirectory)\download-wasi-sdk.ps1 -WasiSdkUrl $(_WasiSdkUrl) -WasiSdkVersion $(_WasiSdkVersion) -WasiSdkPath $(_RuntimeLocalWasiSdkPath); Exit $LastExitCode "" | ||
| Condition="'$(HostOS)' == 'windows'" | ||
| WorkingDirectory="$(ArtifactsObjDir)" | ||
| IgnoreStandardErrorWarningFormat="true" /> | ||
| </Target> | ||
|
|
||
| <Target Name="AcquireWasiSdkUnconditional" | ||
| DependsOnTargets="_ValidateWasiSdk;_AcquireLocalWasiSdk"> | ||
| <PropertyGroup> | ||
| <RuntimeBuildWasiSdkPath Condition="'$(_UseRuntimeLocalWasiSdk)' != 'true'">$([MSBuild]::NormalizeDirectory('$(WASI_SDK_PATH)'))</RuntimeBuildWasiSdkPath> | ||
| <RuntimeBuildWasiSdkPath Condition="'$(_UseRuntimeLocalWasiSdk)' == 'true'">$(_RuntimeLocalWasiSdkPath)</RuntimeBuildWasiSdkPath> | ||
| </PropertyGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="AcquireWasiSdk" | ||
| Condition="'$(TargetsWasi)' == 'true'" | ||
| DependsOnTargets="AcquireWasiSdkUnconditional" /> | ||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.