Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tests.wasm.targets « testing « eng - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02af8e04189c71c5fe4ef6025c1503913c29779a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<Project>
  <!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
  <PropertyGroup>
    <IsWasmProject Condition="'$(IsWasmProject)' == ''">true</IsWasmProject>
    <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle>
    <BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets>
    <DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' == 'Debug'">true</DebuggerSupport>

    <!-- set this when provisioning emsdk on CI -->
    <EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>

    <!-- Some tests expect to load satellite assemblies by path, eg. System.Runtime.Loader.Tests,
         so, just setting it true by default -->
    <IncludeSatelliteAssembliesInVFS Condition="'$(IncludeSatelliteAssembliesInVFS)' == ''">true</IncludeSatelliteAssembliesInVFS>

    <!--
      - For regular library tests, it will use the symbols file from the runtime pack.
      - for AOT library tests, we use WasmNativeStrip=false, so we already have symbols
    -->
    <WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">false</WasmNativeStrip>
    <WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == '' and '$(RunAOTCompilation)' != 'true'">true</WasmEmitSymbolMap>

    <!-- Run only if previous command succeeded -->
    <_ShellCommandSeparator Condition="'$(OS)' == 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator>
    <_ShellCommandSeparator Condition="'$(OS)' != 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator>
    <_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName>
    <_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch>
    <XUnitUseRandomizedTestOrderer Condition="'$(XUnitUseRandomizedTestOrderer)' == '' and '$(IsTestProject)' == 'true'">true</XUnitUseRandomizedTestOrderer>
    <_UseWasmSymbolicator Condition="'$(TestTrimming)' != 'true'">true</_UseWasmSymbolicator>
  </PropertyGroup>

  <PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
    <!-- suppress warnings as these are tests, and not expected to be trim-safe -->
    <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
    <!-- This warning code isn't yet included in SuppressTrimAnalysisWarnings -->
    <NoWarn>$(NoWarn);IL2118</NoWarn>
    <!-- IL2121: Unnecessary UnconditionalSuppressMessage attribute -->
    <NoWarn>$(NoWarn);IL2121</NoWarn>
  </PropertyGroup>

  <PropertyGroup>
    <BuildAOTTestsOn Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(Scenario)' == 'BuildWasmApps'">helix</BuildAOTTestsOn>
    <BuildAOTTestsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">helix</BuildAOTTestsOn>
    <BuildAOTTestsOn Condition="'$(BuildAOTTestsOn)' == ''">local</BuildAOTTestsOn>
  </PropertyGroup>

  <ItemGroup>
    <_AOT_InternalForceInterpretAssemblies Include="@(HighAotMemoryUsageAssembly)" />
  </ItemGroup>

  <!--
    This is running during compile time and therefore $(Scenario) is empty, unless the specific project sets it.
    Any settings in the project file could be replaced on Helix.
    See also eng\testing\WasmRunnerTemplate.sh
    -->
  <ItemGroup Condition="'$(OS)' != 'Windows_NT'">
    <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="export SCENARIO=$(Scenario)" />
    <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="export JS_ENGINE=--engine=$(JSEngine)" />
    <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="export JS_ENGINE_ARGS=$(JSEngineArgs)" />
    <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="export MAIN_JS=--js-file=$(_WasmMainJSFileName)" />
  </ItemGroup>
  <ItemGroup Condition="'$(OS)' == 'Windows_NT'">
    <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="set &quot;SCENARIO=$(Scenario)&quot;" />
    <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="set &quot;JS_ENGINE=--engine^=$(JSEngine)&quot;" />
    <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="set &quot;JS_ENGINE_ARGS=$(JSEngineArgs)&quot;" />
    <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="set &quot;MAIN_JS=--js-file^=$(_WasmMainJSFileName)&quot;" />
  </ItemGroup>

  <PropertyGroup>
    <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps' and '$(WasmMainAssemblyFileName)' == ''">--run WasmTestRunner.dll $(AssemblyName).dll</_AppArgs>
    <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)</_AppArgs>
    <_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll</_AppArgs>

    <_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)</_AppArgs>

    <WasmXHarnessMonoArgs Condition="'$(XunitShowProgress)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=1</WasmXHarnessMonoArgs>
  </PropertyGroup>

  <PropertyGroup Condition="'$(RunScriptCommand)' == ''">
    <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasm $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT</_XHarnessArgs>
    <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT'">wasm %XHARNESS_COMMAND% --app=. --output-directory=%XHARNESS_OUT%</_XHarnessArgs>

    <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'"     >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs>
    <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''"         >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs>
    <_XHarnessArgs Condition="('$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true') and '$(_XHarnessArs.Contains(&quot;--web-server-use-cop&quot;)' != 'true'">$(_XHarnessArgs) --web-server-use-cop</_XHarnessArgs>
    <_XHarnessArgs                                                 >$(_XHarnessArgs) -s dotnet.js.symbols</_XHarnessArgs>
    <_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbol-patterns wasm-symbol-patterns.txt</_XHarnessArgs>
    <_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbolicator WasmSymbolicator.dll,Microsoft.WebAssembly.Internal.SymbolicatorWrapperForXHarness</_XHarnessArgs>
    <_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''"      >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs>

    <!-- There two flavors of WasmXHarnessArgs and WasmXHarnessMonoArgs, one is MSBuild property and the other is environment variable -->
    <RunScriptCommand Condition="'$(OS)' != 'Windows_NT'">$HARNESS_RUNNER $(_XHarnessArgs) %24XHARNESS_ARGS %24WasmXHarnessArgs -- $(WasmXHarnessMonoArgs) %24WasmXHarnessMonoArgs $(_AppArgs) %24WasmTestAppArgs</RunScriptCommand>
    <RunScriptCommand Condition="'$(OS)' == 'Windows_NT'">%HARNESS_RUNNER% $(_XHarnessArgs) %XHARNESS_ARGS% %WasmXHarnessArgs%  -- $(WasmXHarnessMonoArgs) %WasmXHarnessMonoArgs% $(_AppArgs) %WasmTestAppArgs%</RunScriptCommand>
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
    <_AOTBuildCommand Condition="'$(BrowserHost)' != 'windows'">_buildAOTFunc publish/ProxyProjectForAOTOnHelix.proj $XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
    <_AOTBuildCommand Condition="'$(BrowserHost)' == 'windows'">dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:%XHARNESS_OUT%/AOTBuild.binlog</_AOTBuildCommand>

    <_AOTBuildCommand  Condition="'$(BrowserHost)' == 'windows'">$(_AOTBuildCommand) &quot;/p:WasmCachePath=%USERPROFILE%\.emscripten-cache&quot;</_AOTBuildCommand>

    <!-- running aot-helix tests locally, so we can test with the same project file as CI -->
    <_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand>

    <_AOTBuildCommand>$(_AOTBuildCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</_AOTBuildCommand>
    <_AOTBuildCommand>$(_AOTBuildCommand) $(_ShellCommandSeparator) cd wasm_build/AppBundle</_AOTBuildCommand>

    <RunScriptCommand Condition="'$(RunScriptCommand)' == ''">$(_AOTBuildCommand)</RunScriptCommand>
    <RunScriptCommand Condition="'$(RunScriptCommand)' != ''">$(_AOTBuildCommand) $(_ShellCommandSeparator) $(RunScriptCommand)</RunScriptCommand>
  </PropertyGroup>

  <!-- Don't include InTree.props here, because the test projects themselves can set the target* properties -->
  <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.props"
          Condition="'$(BuildAOTTestsOn)' == 'local'" />
  <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets"
          Condition="'$(BuildAOTTestsOn)' == 'local'" />

  <PropertyGroup>
    <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOn)' == 'local'">WasmTriggerPublishApp</BundleTestWasmAppDependsOn>
    <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn>

    <RunCommand>$(WasmAppHostDir)/WasmAppHost</RunCommand>
    <!-- Use BundleDir here, since WasmAppDir is set in a target, and `dotnet run` reads
         $(Run*) without running any targets -->
    <RunArguments>--runtime-config $(BundleDir)/WasmTestRunner.runtimeconfig.json $(WasmHostArguments) $(StartArguments) $(WasmXHarnessMonoArgs) $(_AppArgs)</RunArguments>
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
    <!-- wasm targets are not imported at all, in this case, because we run the wasm build on helix -->
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' != 'true'">
    <WasmBuildOnlyAfterPublish>true</WasmBuildOnlyAfterPublish>

    <!-- wasm's publish targets will trigger publish, so we shouldn't do that -->
    <PublishTestAsSelfContainedDependsOn />
    <WasmNestedPublishAppDependsOn>PrepareForWasmBuildApp;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn>
  </PropertyGroup>

  <ItemGroup>
    <WorkloadIdForTesting Include="wasm-tools"
                          ManifestName="Microsoft.NET.Workload.Mono.ToolChain"
                          Version="$(PackageVersion)"
                          VersionBand="$(SdkBandVersion)" />
    <WorkloadIdForTesting Include="wasm-experimental"
                          ManifestName="Microsoft.NET.Workload.Mono.ToolChain"
                          Version="$(PackageVersion)"
                          VersionBand="$(SdkBandVersion)" />

    <WasmExtraFilesToDeploy Condition="'$(_UseWasmSymbolicator)' == 'true'" Include="$(MonoProjectRoot)wasm\data\wasm-symbol-patterns.txt" />
    <WasmExtraFilesToDeploy Condition="'$(_UseWasmSymbolicator)' == 'true'" Include="$(ArtifactsBinDir)WasmSymbolicator\$(Configuration)\$(NetCoreAppToolCurrent)\WasmSymbolicator.dll" />
  </ItemGroup>

  <Target Name="BundleTestWasmApp" DependsOnTargets="$(BundleTestWasmAppDependsOn)" />

  <UsingTask Condition="'$(BuildAOTTestsOnHelix)' == 'true'"
             TaskName="Microsoft.WebAssembly.Build.Tasks.GenerateAOTProps"
             AssemblyFile="$(WasmBuildTasksAssemblyPath)" />

  <Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp">
    <PropertyGroup Condition="'$(IsHighAotMemoryUsageTest)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true'">
      <DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">true</DisableParallelEmccCompile>
      <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-O2</EmccLinkOptimizationFlag>
    </PropertyGroup>

    <PropertyGroup>
      <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
      <RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
      <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl,-O0 -Wl,-lto-O0</EmccLinkOptimizationFlag>
    </PropertyGroup>

    <Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" />

    <ItemGroup>
      <BundleFiles Include="$(WasmMainJSPath)"                  TargetDir="publish" />
      <BundleFiles Include="@(WasmAssembliesToBundle)"          TargetDir="publish\%(WasmAssembliesToBundle.RecursiveDir)" />
      <BundleFiles Include="$(RuntimeConfigFilePath)"           TargetDir="publish" />

      <BundleFiles Include="$(MonoProjectRoot)\wasm\data\aot-tests\*" TargetDir="publish" />
    </ItemGroup>

    <ItemGroup Condition="'$(DebuggerSupport)' == 'true'">
      <!-- Add any pdb files, if available -->
      <_BundlePdbFiles Include="$([System.IO.Path]::ChangeExtension('%(WasmAssembliesToBundle.Identity)', '.pdb'))" />
      <BundleFiles Include="@(_BundlePdbFiles)" TargetDir="publish" Condition="Exists(%(_BundlePdbFiles.Identity))" />
    </ItemGroup>

    <!-- To recreate the original project on helix, we need to set the wasm properties also, same as the
         library test project. Eg. $(InvariantGlobalization) -->
    <ItemGroup>
      <_WasmPropertyNames Include="AOTMode" />
      <_WasmPropertyNames Include="AssemblyName" />
      <_WasmPropertyNames Include="DisableParallelAot" />
      <_WasmPropertyNames Include="DisableParallelEmccCompile" />
      <_WasmPropertyNames Include="EmccCompileOptimizationFlag" />
      <_WasmPropertyNames Include="EmccLinkOptimizationFlag" />
      <_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" />
      <_WasmPropertyNames Include="InvariantGlobalization" />
      <_WasmPropertyNames Include="WasmBuildNative" />
      <_WasmPropertyNames Include="WasmDebugLevel" />
      <_WasmPropertyNames Include="WasmDedup" />
      <_WasmPropertyNames Include="WasmLinkIcalls" />
      <_WasmPropertyNames Include="WasmNativeStrip" />
      <_WasmPropertyNames Include="_WasmDevel" />
      <_WasmPropertyNames Include="_WasmStrictVersionMatch" />
      <_WasmPropertyNames Include="WasmEmitSymbolMap" />

      <_WasmPropertiesToPass
        Include="$(%(_WasmPropertyNames.Identity))"
        Name="%(_WasmPropertyNames.Identity)"
        ConditionToUse__="%(_WasmPropertyNames.ConditionToUse__)" />

      <_WasmVFSFilesToCopy Include="@(WasmFilesToIncludeInFileSystem)" />
      <_WasmVFSFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmVFSFilesToCopy.TargetPath)' == ''" />

      <_WasmExtraFilesToCopy Include="@(WasmExtraFilesToDeploy)" />
      <_WasmExtraFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmExtraFilesToCopy.TargetPath)' == ''" />

      <!-- Example of passing items to the project

          <_WasmItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" />

      -->

      <_WasmItemsToPass Include="@(_AOT_InternalForceInterpretAssemblies)" OriginalItemName__="_AOT_InternalForceInterpretAssemblies" />

    </ItemGroup>

    <!-- This file gets imported by the project file on helix -->
    <GenerateAOTProps
        Properties="@(_WasmPropertiesToPass)"
        Items="@(_WasmItemsToPass)"
        OutputFile="$(BundleDir)publish\ProxyProjectForAOTOnHelix.props" />

    <Copy SourceFiles="@(BundleFiles)"         DestinationFolder="$(BundleDir)%(TargetDir)" />
    <Copy SourceFiles="@(_WasmVFSFilesToCopy)" DestinationFiles="$(BundleDir)\vfsFiles\%(_WasmVFSFilesToCopy.TargetPath)" />
    <Copy SourceFiles="@(_WasmExtraFilesToCopy)" DestinationFiles="$(BundleDir)\extraFiles\%(_WasmExtraFilesToCopy.TargetPath)" />
  </Target>

  <Target Name="PrepareForWasmBuildApp">
    <PropertyGroup>
      <WasmAppDir>$(BundleDir)</WasmAppDir>
      <WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">WasmTestRunner.dll</WasmMainAssemblyFileName>
      <WasmMainJSPath Condition="'$(WasmMainJSPath)' == ''">$(MonoProjectRoot)\wasm\test-main.js</WasmMainJSPath>
      <WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization>
      <WasmGenerateRunV8Script>true</WasmGenerateRunV8Script>

      <WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
      <WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel>
    </PropertyGroup>

    <ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true' and '$(BuildAOTTestsOnHelix)' != 'true'">
      <_SatelliteAssemblies Include="$(PublishDir)*\*.resources.dll" />
      <_SatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
      <_SatelliteAssemblies TargetPath="%(CultureName)\%(FileName)%(Extension)" />

      <WasmFilesToIncludeInFileSystem Include="@(_SatelliteAssemblies)" />
    </ItemGroup>

    <ItemGroup>
      <WasmAssembliesToBundle Include="$(PublishDir)\**\*.dll" Condition="'$(BuildAOTTestsOnHelix)' == 'true'" />
      <WasmFilesToIncludeInFileSystem Include="@(ContentWithTargetPath)" />

      <_CopyLocalPaths
              Include="@(PublishItemsOutputGroupOutputs)"
              Condition="'%(PublishItemsOutputGroupOutputs.BuildReference)' == 'true' and
                         !$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.resources.dll'))" />

      <_CopyLocalPaths TargetPath="%(_CopyLocalPaths.RelativePath)" Condition="'%(_CopyLocalPaths.RelativePath)' != ''" />
      <_CopyLocalPaths TargetPath="%(FileName)%(Extension)"         Condition="'%(_CopyLocalPaths.RelativePath)' == ''" />
      <WasmFilesToIncludeInFileSystem Include="@(_CopyLocalPaths)" />

      <!-- Include files specified by test projects from publish dir -->
      <WasmFilesToIncludeInFileSystem
              Include="$(PublishDir)%(WasmFilesToIncludeFromPublishDir.Identity)"
              TargetPath="%(WasmFilesToIncludeFromPublishDir.Identity)"
              Condition="'%(WasmFilesToIncludeFromPublishDir.Identity)' != ''" />
    </ItemGroup>
  </Target>

  <!-- linker automatically picks up the .pdb files, but they are not added to the publish list.
       Add them explicitly here, so they can be used with WasmAppBuilder -->
  <Target Name="AddPdbFilesToPublishList" AfterTargets="ILLink" Condition="'$(DebuggerSupport)' == 'true'">
    <ItemGroup>
      <_PdbFilesToCheck Include="$([System.IO.Path]::ChangeExtension('%(ResolvedFileToPublish.Identity)', '.pdb'))"
                        Condition="'%(ResolvedFileToPublish.Extension)' == '.dll'" />

      <ResolvedFileToPublish Include="@(_PdbFilesToCheck)"
                             Condition="Exists(%(_PdbFilesToCheck.Identity))"
                             RelativePath="%(_PdbFilesToCheck.FileName)%(_PdbFilesToCheck.Extension)" />
    </ItemGroup>
  </Target>

  <Target Name="ProvideNodeNpmRestoreScripts" BeforeTargets="GenerateRunScript">
    <!-- Combine optional alias on all NodeNpmModule and trim separator where alias is empty -->
    <ItemGroup>
      <_NodeNpmModuleString Include="%(NodeNpmModule.Identity):%(NodeNpmModule.Alias)" />
      <_NodeNpmModuleStringTrimmed Include="@(_NodeNpmModuleString->Trim(':'))" />
    </ItemGroup>
    <PropertyGroup>
      <NodeNpmModuleString>@(_NodeNpmModuleStringTrimmed, ',')</NodeNpmModuleString>
    </PropertyGroup>

    <!-- Restore NPM packages -->
    <ItemGroup Condition="'$(OS)' != 'Windows_NT'">
      <SetScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then export WasmXHarnessMonoArgs=&quot;$WasmXHarnessMonoArgs --setenv=NPM_MODULES=$(NodeNpmModuleString)&quot;; fi" />
      <RunScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then npm ci; fi" />
    </ItemGroup>
    <ItemGroup Condition="'$(OS)' == 'Windows_NT'">
      <SetScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( set &quot;WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=NPM_MODULES^=$(NodeNpmModuleString)&quot; )" />
      <RunScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( call npm ci )" />
    </ItemGroup>
  </Target>

  <Target Name="DeployHelixTargetsFile" AfterTargets="ArchiveTests" Condition="'$(HelixTargetsFile)' != ''">
    <Copy SourceFiles="$(HelixTargetsFile)" DestinationFiles="$(TestArchiveTestsDir)$(TestProjectName).helix.targets" SkipUnchangedFiles="true" />
  </Target>
</Project>