Skip to content

Commit 3a1d153

Browse files
committed
rebase
1 parent 60b23ce commit 3a1d153

File tree

5 files changed

+58
-44
lines changed

5 files changed

+58
-44
lines changed

src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Copyright (c) .NET Foundation. All rights reserved.
130130
</AddWasmStaticWebAssetsDependsOn>
131131
<GenerateBuildWasmBootJsonDependsOn>
132132
$(GenerateBuildWasmBootJsonDependsOn);
133+
GenerateBuildRuntimeConfigurationFiles;
133134
ResolveWasmOutputs;
134135
</GenerateBuildWasmBootJsonDependsOn>
135136
</PropertyGroup>
@@ -403,6 +404,7 @@ Copyright (c) .NET Foundation. All rights reserved.
403404
Extensions="@(WasmBootConfigExtension)"
404405
EnvVariables="@(WasmEnvironmentVariable)"
405406
Profilers="$(_WasmProfilers)"
407+
RuntimeConfigJsonPath="$(ProjectRuntimeConfigFilePath)"
406408
TargetFrameworkVersion="$(TargetFrameworkVersion)"
407409
ModuleAfterConfigLoaded="@(WasmModuleAfterConfigLoaded)"
408410
ModuleAfterRuntimeReady="@(WasmModuleAfterRuntimeReady)"
@@ -810,6 +812,7 @@ Copyright (c) .NET Foundation. All rights reserved.
810812
RuntimeOptions="$(_BlazorWebAssemblyRuntimeOptions)"
811813
EnvVariables="@(WasmEnvironmentVariable)"
812814
Profilers="$(_WasmProfilers)"
815+
RuntimeConfigJsonPath="$(ProjectRuntimeConfigFilePath)"
813816
Extensions="@(WasmBootConfigExtension)"
814817
TargetFrameworkVersion="$(TargetFrameworkVersion)"
815818
ModuleAfterConfigLoaded="@(WasmModuleAfterConfigLoaded)"

src/mono/wasi/build/WasiApp.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@
1010
</PropertyGroup>
1111

1212
<Import Project="$(WasmCommonTargetsPath)WasmApp.Common.props" />
13+
14+
<PropertyGroup>
15+
<WasmNestedPublishAppDependsOn>
16+
_PrepareForNestedPublish;
17+
$(WasmNestedPublishAppDependsOn);
18+
</WasmNestedPublishAppDependsOn>
19+
</PropertyGroup>
20+
1321
</Project>

src/mono/wasi/build/WasiApp.targets

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44
<UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.WasiAppBuilder" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" />
55

66
<PropertyGroup>
7+
<PrepareInputsForWasmBuildDependsOn>
8+
$(PrepareInputsForWasmBuildDependsOn);
9+
_WasmGetRuntimeConfigPath;
10+
</PrepareInputsForWasmBuildDependsOn>
11+
712
<PrepareForWasmBuildNativeDependsOn>
813
_CheckToolchainIsExpectedVersion;
914
_PrepareForWasiBuildNative;
1015
$(PrepareForWasmBuildNativeDependsOn)
1116
</PrepareForWasmBuildNativeDependsOn>
1217

1318
<WasmLinkDotNetDependsOn>
19+
_WasmGenerateRuntimeConfig;
1420
$(WasmLinkDotNetDependsOn);
1521
_WasiLinkDotNet;
1622
</WasmLinkDotNetDependsOn>
1723

1824
<WasmGenerateAppBundleDependsOn>
25+
_WasmGenerateRuntimeConfig;
1926
$(WasmGenerateAppBundleDependsOn);
2027
_GetWasiGenerateAppBundleDependencies;
2128
_WasiGenerateAppBundle;
@@ -46,6 +53,44 @@
4653
<!--<WasiRunner Condition="'$(WasiRunner)' == ''">wasmtime</WasiRunner>-->
4754
</PropertyGroup>
4855

56+
<Target Name="_WasmGenerateRuntimeConfig"
57+
Inputs="$(_WasmRuntimeConfigFilePath)"
58+
Outputs="$(_ParsedRuntimeConfigFilePath)"
59+
Condition="Exists('$(_WasmRuntimeConfigFilePath)')">
60+
<ItemGroup>
61+
<_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
62+
<_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
63+
</ItemGroup>
64+
65+
<RuntimeConfigParserTask
66+
RuntimeConfigFile="$(_WasmRuntimeConfigFilePath)"
67+
OutputFile="$(_ParsedRuntimeConfigFilePath)"
68+
RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)">
69+
</RuntimeConfigParserTask>
70+
71+
<ItemGroup>
72+
<WasmFilesToIncludeInFileSystem Condition="'$(WasmSingleFileBundle)' != 'true'" Include="$(_ParsedRuntimeConfigFilePath)" LoadingStage="Core" />
73+
</ItemGroup>
74+
</Target>
75+
76+
<Target Name="_WasmGetRuntimeConfigPath">
77+
<PropertyGroup>
78+
<_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == '$(AssemblyName)' and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
79+
<_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</_WasmRuntimeConfigFilePath>
80+
<_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin</_ParsedRuntimeConfigFilePath>
81+
</PropertyGroup>
82+
</Target>
83+
84+
<Target Name="_PrepareForNestedPublish" DependsOnTargets="_GetDefaultWasmAssembliesToBundle" Condition="'$(WasmBuildingForNestedPublish)' == 'true'">
85+
<PropertyGroup>
86+
<_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath>
87+
</PropertyGroup>
88+
89+
<PropertyGroup Condition="'$(_WasmRuntimeConfigFilePath)' == ''">
90+
<_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath>
91+
</PropertyGroup>
92+
</Target>
93+
4994
<Target Name="_GetWasiGenerateAppBundleDependencies">
5095
<ItemGroup Condition="'$(InvariantGlobalization)' == 'true' or '$(WasmSingleFileBundle)' == 'true'">
5196
<ReferenceCopyLocalPaths Remove="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)icudt.dat" />

src/mono/wasm/build/WasmApp.Common.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
</_WasmBuildAppCoreDependsOn>
1919

2020
<WasmNestedPublishAppDependsOn>
21-
_PrepareForNestedPublish;
2221
_WasmBuildAppCore;
2322
</WasmNestedPublishAppDependsOn>
2423
</PropertyGroup>

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

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,10 @@
125125
_ReadWasmProps;
126126
_SetWasmBuildNativeDefaults;
127127
_GetDefaultWasmAssembliesToBundle;
128-
_WasmGetRuntimeConfigPath;
129128
</PrepareInputsForWasmBuildDependsOn>
130129

131130
<WasmGenerateAppBundleDependsOn>
132131
$(WasmGenerateAppBundleDependsOn);
133-
_WasmGenerateRuntimeConfig;
134132
</WasmGenerateAppBundleDependsOn>
135133

136134
<!-- FIXME: TMP: added _PrepareForWasmBuildNative as it used by emsdk cache as beforeTargets -->
@@ -152,7 +150,6 @@
152150
_WasmSelectRuntimeComponentsForLinking;
153151
_WasmCompileAssemblyBitCodeFilesForAOT;
154152
_WasmCalculateInitialHeapSizeFromBitcodeFiles;
155-
_WasmGenerateRuntimeConfig;
156153
_WasmWriteRspForCompilingNativeSourceFiles;
157154
_WasmCompileNativeSourceFiles;
158155
_GenerateObjectFilesForSingleFileBundle;
@@ -350,14 +347,6 @@
350347
</ItemGroup>
351348
</Target>
352349

353-
<Target Name="_WasmGetRuntimeConfigPath">
354-
<PropertyGroup>
355-
<_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == '$(AssemblyName)' and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
356-
<_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</_WasmRuntimeConfigFilePath>
357-
<_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin</_ParsedRuntimeConfigFilePath>
358-
</PropertyGroup>
359-
</Target>
360-
361350
<Target Name="_WasmResolveReferences" Condition="'$(WasmResolveAssembliesBeforeBuild)' == 'true'" Returns="@(_WasmAssembliesInternal)">
362351
<WasmLoadAssembliesAndReferences
363352
Assemblies="@(_WasmAssembliesInternal)"
@@ -380,8 +369,8 @@
380369
Text="Could not find %24(AssemblyName)=$(AssemblyName).dll in the assemblies to be bundled."
381370
Importance="Low" />
382371

383-
<Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(_WasmRuntimeConfigFilePath) != '' and !Exists($(_WasmRuntimeConfigFilePath))"
384-
Text="Could not find $(_WasmRuntimeConfigFilePath) for $(_MainAssemblyPath)."
372+
<Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(ProjectRuntimeConfigFilePath) != '' and !Exists($(ProjectRuntimeConfigFilePath))"
373+
Text="Could not find $(ProjectRuntimeConfigFilePath) for $(_MainAssemblyPath)."
385374
Importance="Low" />
386375

387376
<ItemGroup>
@@ -427,26 +416,6 @@
427416

428417
<Target Name="WasmGenerateAppBundle" DependsOnTargets="$(WasmGenerateAppBundleDependsOn)" Condition="'$(WasmGenerateAppBundle)' == 'true'" />
429418

430-
<Target Name="_WasmGenerateRuntimeConfig"
431-
Inputs="$(_WasmRuntimeConfigFilePath)"
432-
Outputs="$(_ParsedRuntimeConfigFilePath)"
433-
Condition="Exists('$(_WasmRuntimeConfigFilePath)')">
434-
<ItemGroup>
435-
<_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/>
436-
<_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/>
437-
</ItemGroup>
438-
439-
<RuntimeConfigParserTask
440-
RuntimeConfigFile="$(_WasmRuntimeConfigFilePath)"
441-
OutputFile="$(_ParsedRuntimeConfigFilePath)"
442-
RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)">
443-
</RuntimeConfigParserTask>
444-
445-
<ItemGroup>
446-
<WasmFilesToIncludeInFileSystem Condition="'$(WasmSingleFileBundle)' != 'true'" Include="$(_ParsedRuntimeConfigFilePath)" LoadingStage="Core" />
447-
</ItemGroup>
448-
</Target>
449-
450419
<Target Name="WasmTriggerPublishApp"
451420
AfterTargets="$(WasmTriggerPublishAppAfterThisTarget)"
452421
Condition="('$(IsBrowserWasmProject)' == 'true' or '$(IsWasiProject)' == 'true') and '$(WasmBuildingForNestedPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'">
@@ -482,16 +451,6 @@
482451
</ItemGroup>
483452
</Target>
484453

485-
<Target Name="_PrepareForNestedPublish" DependsOnTargets="_GetDefaultWasmAssembliesToBundle" Condition="'$(WasmBuildingForNestedPublish)' == 'true'">
486-
<PropertyGroup>
487-
<_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath>
488-
</PropertyGroup>
489-
490-
<PropertyGroup Condition="'$(_WasmRuntimeConfigFilePath)' == ''">
491-
<_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath>
492-
</PropertyGroup>
493-
</Target>
494-
495454
<Target Name="_EmitWasmAssembliesFinal" Returns="@(WasmAssembliesFinal)">
496455
<ItemGroup>
497456
<WasmAssembliesFinal Include="@(_WasmAssembliesInternal)" LlvmBitCodeFile="" />

0 commit comments

Comments
 (0)