Skip to content

Commit

Permalink
[release/8.0-preview4] [wasi] Fix support for paths with spaces (#85998)
Browse files Browse the repository at this point in the history
* [wasi] Fix disabling wasi build for projects

* [wasi] Fix quoting in Wasi targets

* [wasi] WBT: don't run wasi targets for the tests project

---------

Co-authored-by: Ankit Jain <[email protected]>
  • Loading branch information
github-actions[bot] and radical authored May 9, 2023
1 parent 9139d44 commit 84a3d0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/mono/wasi/Wasi.Build.Tests/Wasi.Build.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<InstallWorkloadForTesting>true</InstallWorkloadForTesting>

<!-- don't run any wasm build steps -->
<IsBrowserWasmProject>false</IsBrowserWasmProject>
<IsWasiProject>false</IsWasiProject>
<UseDefaultTestHost>true</UseDefaultTestHost>

<EnableRunSettingsSupport>false</EnableRunSettingsSupport>
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasi/build/WasiApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</PropertyGroup>
</Target>

<Target Name="_WasiBuildNativeCore" DependsOnTargets="$(_WasiBuildNativeCoreDependsOn)" Condition="'$(WasmBuildNative)' == 'true'" />
<Target Name="_WasiBuildNativeCore" BeforeTargets="_WasiGenerateAppBundle" DependsOnTargets="$(_WasiBuildNativeCoreDependsOn)" Condition="'$(WasmBuildNative)' == 'true'" />

<Target Name="_PrepareForWasiBuildNative">
<Error Condition="'$(_IsToolchainMissing)' == 'true'"
Expand Down Expand Up @@ -446,8 +446,8 @@
<_WasiFilePathForFixup Include="@(_WasmNativeFileForLinking)" />
<_WasiFilePathForFixup Include="@(_WasmRuntimePackSrcFile)" />

<_WasiSdkClangArgs Condition="'$(OS)' == 'Windows_NT'" Include="$([System.String]::new(%(_WasiFilePathForFixup.Identity)).Replace('\', '/'))" />
<_WasiSdkClangArgs Condition="'$(OS)' != 'Windows_NT'" Include="@(_WasiFilePathForFixup)" />
<_WasiSdkClangArgs Condition="'$(OS)' == 'Windows_NT'" Include="&quot;$([System.String]::new(%(_WasiFilePathForFixup.Identity)).Replace('\', '/'))&quot;" />
<_WasiSdkClangArgs Condition="'$(OS)' != 'Windows_NT'" Include="@(_WasiFilePathForFixup -> '&quot;%(Identity)&quot;')" />

<_WasiSdkClangArgs Include="@(_WasmCommonCFlags)" />

Expand All @@ -470,9 +470,9 @@

<WriteLinesToFile Lines="@(_WasiSdkClangArgs)" File="$(_WasmIntermediateOutputPath)clang-compile.rsp" Overwrite="true" />
<!--<Message Importance="High" Text="Performing WASI SDK build: &quot;$(WasiClang)&quot; @(_WasiSdkClangArgs, ' ')" />-->
<Message Importance="High" Text="Performing WASI SDK build: &quot;$(WasiClang)&quot; @$(_WasmIntermediateOutputPath)clang-compile.rsp" />
<Message Importance="High" Text="Performing WASI SDK build: &quot;$(WasiClang)&quot; &quot;@$(_WasmIntermediateOutputPath)clang-compile.rsp&quot;" />
<!--<Exec Command="&quot;$(WasiClang)&quot; @(_WasiSdkClangArgs, ' ')" />-->
<Exec Command="&quot;$(WasiClang)&quot; @$(_WasmIntermediateOutputPath)clang-compile.rsp" />
<Exec Command="&quot;$(WasiClang)&quot; &quot;@$(_WasmIntermediateOutputPath)clang-compile.rsp&quot;" />

<!-- FIXME: this will be done by the bundler -->
<Copy SourceFiles="$(_WasmOutputFileName)" DestinationFolder="$(WasmAppDir)" />
Expand Down
2 changes: 0 additions & 2 deletions src/mono/wasi/build/WasiApp.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
<RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
<UseMonoRuntime>true</UseMonoRuntime>
<TrimMode Condition="'$(TrimMode)' == ''">partial</TrimMode>
<WasmBuildNativeTarget>_WasiBuildNativeCore</WasmBuildNativeTarget>

<_WasmBuildCoreDependsOn>
_InitializeCommonProperties;
_PrepareForAfterBuild;
_BeforeWasmBuildApp;
$(WasmBuildNativeTarget);
_WasiGenerateAppBundle;
</_WasmBuildCoreDependsOn>
<WasmBuildAppDependsOn>
Expand Down
6 changes: 3 additions & 3 deletions src/mono/wasi/build/WasiApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

<Target Name="WasmTriggerPublishApp"
AfterTargets="$(WasmTriggerPublishAppAfterThisTarget)"
Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'">
Condition="'$(IsWasiProject)' == 'true' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'">

<!-- Use a unique property, so the already run wasm targets can also run -->
<MSBuild Projects="$(MSBuildProjectFile)"
Expand Down Expand Up @@ -221,7 +221,7 @@
<Target Name="WasmBuildApp"
AfterTargets="$(WasmBuildAppAfterThisTarget)"
DependsOnTargets="$(WasmBuildAppDependsOn)"
Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' == '' and '$(WasmBuildOnlyAfterPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'" />
Condition="'$(IsWasiProject)' == 'true' and '$(WasmBuildingForNestedPublish)' == '' and '$(WasmBuildOnlyAfterPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'" />

<Target Name="_InitializeCommonProperties">
<Error Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == '' and ('%(ResolvedRuntimePack.PackageDirectory)' == '' or !Exists(%(ResolvedRuntimePack.PackageDirectory)))"
Expand Down Expand Up @@ -385,7 +385,7 @@
<FileWrites Include="$(WasmRunWasmtimeScriptPath)" />
</ItemGroup>

<Exec Condition="'$(OS)' != 'Windows_NT'" Command="chmod a+x $(WasmRunWasmtimeScriptPath)" />
<Exec Condition="'$(OS)' != 'Windows_NT'" Command="chmod a+x &quot;$(WasmRunWasmtimeScriptPath)&quot;" />
</Target>

<Target Name="_WasmResolveReferences" Condition="'$(WasmResolveAssembliesBeforeBuild)' == 'true'">
Expand Down

0 comments on commit 84a3d0e

Please sign in to comment.