Skip to content

Commit ae93e81

Browse files
committed
[wasm] build: Revert to older behavior for WasmNativeStrip
The earlier change was done in 678fd6a, which changed to pass `-g` to the link step also. But that resulted in increased native file sizes. Changed sizes for the `minimum blazor template - publish` scenario: ``` | Last rc1 run | With the change ----------------------------------------------------------|----------------- |------------------ SOD - Minimum Blazor Template - Publish |8590723.000 bytes |7889806.000 bytes Total Uncompressed _framework |4304274.000 bytes |4202273.000 bytes pub/wwwroot/_framework/dotnet.js |35722.000 bytes |35838.000 bytes pub/wwwroot/_framework/dotnet.native.8.0.0-VERSION.js |239307.000 bytes |134566.000 bytes pub/wwwroot/_framework/dotnet.native.wasm |1174394.000 bytes |1148841.000 bytes pub/wwwroot/_framework/dotnet.runtime.8.0.0-VERSION.js |221356.000 bytes |221712.000 bytes ```
1 parent 5eefacf commit ae93e81

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/mono/wasm/build/WasmApp.Native.targets

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
$(_BeforeWasmBuildAppDependsOn);
2323
_SetupEmscripten;
2424
_SetWasmBuildNativeDefaults;
25-
_SetWasmNativeStripDefault;
2625
_ReadEmccProps
2726
</_BeforeWasmBuildAppDependsOn>
2827

@@ -119,6 +118,7 @@
119118
<_BoolPropertiesThatTriggerRelinking Include="InvariantTimezone" DefaultValueInRuntimePack="false" />
120119
<_BoolPropertiesThatTriggerRelinking Include="InvariantGlobalization" DefaultValueInRuntimePack="false" />
121120
<_BoolPropertiesThatTriggerRelinking Include="WasmNativeStrip" DefaultValueInRuntimePack="true" />
121+
<!--<_BoolPropertiesThatTriggerRelinking Include="WasmNativeDebugSymbols" DefaultValueInRuntimePack="true" />-->
122122
</ItemGroup>
123123

124124
<PropertyGroup>
@@ -133,7 +133,6 @@
133133
<WasmBuildNative Condition="'$(RunAOTCompilation)' == 'true' and '$(RunAOTCompilationAfterBuild)' == 'true'">true</WasmBuildNative>
134134

135135
<WasmBuildNative Condition="'$(WasmBuildNative)' == '' and @(NativeFileReference->Count()) > 0" >true</WasmBuildNative>
136-
<WasmBuildNative Condition="'$(WasmBuildNative)' == ''">false</WasmBuildNative>
137136
</PropertyGroup>
138137

139138
<!-- When Publishing -->
@@ -147,10 +146,23 @@
147146

148147
<!-- default to relinking in Release config -->
149148
<WasmBuildNative Condition="'$(WasmBuildNative)' == '' and '$(Configuration)' == 'Release'">true</WasmBuildNative>
149+
</PropertyGroup>
150150

151+
<PropertyGroup>
151152
<WasmBuildNative Condition="'$(WasmBuildNative)' == ''">false</WasmBuildNative>
152153
</PropertyGroup>
153154

155+
<!-- Default with nothing set: Build+relink+config=debug -->
156+
<PropertyGroup Condition="'$(WasmNativeDebugSymbols)' == '' and '$(WasmNativeStrip)' == '' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">
157+
<WasmNativeDebugSymbols>true</WasmNativeDebugSymbols>
158+
<WasmNativeStrip>false</WasmNativeStrip>
159+
</PropertyGroup>
160+
161+
<PropertyGroup>
162+
<WasmNativeDebugSymbols Condition="'$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
163+
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
164+
</PropertyGroup>
165+
154166
<!-- If we want to default to true, and sdk is missing, then just warn, and set it to false -->
155167
<Warning Condition="'$(WasmBuildNative)' == 'true' and '$(_IsEMSDKMissing)' == 'true'"
156168
Text="$(_EMSDKMissingErrorMessage) Emscripten SDK is required for building native files." />
@@ -160,14 +172,6 @@
160172
</PropertyGroup>
161173
</Target>
162174

163-
<Target Name="_SetWasmNativeStripDefault" Condition="'$(WasmNativeStrip)' == ''">
164-
<PropertyGroup>
165-
<!-- Build+relink+config=debug -->
166-
<WasmNativeStrip Condition="'$(WasmBuildingForNestedPublish)' != 'true' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">false</WasmNativeStrip>
167-
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
168-
</PropertyGroup>
169-
</Target>
170-
171175
<Target Name="_WasmBuildNativeCore" DependsOnTargets="$(_WasmBuildNativeCoreDependsOn)" Condition="'$(WasmBuildNative)' == 'true'" />
172176

173177
<Target Name="_PrepareForWasmBuildNative">
@@ -178,7 +182,6 @@
178182
<_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm'))</_MonoAotCrossCompilerPath>
179183
<_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp'))</_EmccDefaultFlagsRsp>
180184
<_EmccDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp'))</_EmccDefaultLinkFlagsRsp>
181-
<WasmNativeDebugSymbols Condition="'$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
182185
<WasmLinkIcalls Condition="'$(WasmLinkIcalls)' == ''">$(WasmBuildNative)</WasmLinkIcalls>
183186

184187
<_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h</_WasmICallTablePath>
@@ -221,7 +224,7 @@
221224

222225
<_EmccCommonFlags Include="$(_DefaultEmccFlags)" />
223226
<_EmccCommonFlags Include="$(EmccFlags)" />
224-
<_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
227+
<_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
225228
<_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" />
226229
<_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
227230
<_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
@@ -249,6 +252,7 @@
249252
<_EmccCFlags Include="-emit-llvm" />
250253

251254
<_EmccCFlags Include="&quot;-I%(_EmccIncludePaths.Identity)&quot;" />
255+
<_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
252256

253257
<!-- Adding optimization flag at the top, so it gets precedence -->
254258
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />

0 commit comments

Comments
 (0)