-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[wasm] Standup EnableAgressiveTrimming for library tests #46367
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
Changes from all commits
57ef639
3436a5f
9220864
3703995
4ba287b
fcb5c37
0410010
043a0e2
f33c81b
4f88882
5f2a3ba
2c17b60
036b34c
6667907
6969b5a
79dc240
d6dfd82
9ef8529
076fc93
79274dd
c46f92b
b1130cb
72e600d
54efb29
4fa8c51
4f52ee3
4fa5e03
948ad2b
7b0d350
1b447f0
c0f503a
fd8e34c
15f7f0d
5ada1d5
a9259ec
a97fb56
316f98e
4900907
00022b5
03bb472
2d35f3a
ce113f2
28e694f
07568bb
3262912
7da7b82
d00ea59
41e177b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- xunit 2.x version is not under development. We make xunit trimming compatible in methods which ILLink cannot track by providing XML descriptor to keep the dependencies --> | ||
<linker> | ||
<assembly fullname="xunit.execution.dotnet"> | ||
<type fullname="Xunit.Sdk.ReflectionAssemblyInfo"> | ||
<method signature="System.Void .ctor(System.String)" /> | ||
</type> | ||
<type fullname="Xunit.Sdk.TestFrameworkProxy"> | ||
<method signature="System.Void .ctor(System.Object,System.Object,System.Object)" /> | ||
</type> | ||
<type fullname="Xunit.Sdk.FactDiscoverer" /> | ||
</assembly> | ||
<assembly fullname="xunit.core"> | ||
<namespace fullname="Xunit" /> | ||
</assembly> | ||
<!-- Temporary until https://github.com/mono/linker/issues/1713 is resolved --> | ||
<assembly fullname="Microsoft.DotNet.RemoteExecutor"> | ||
<type fullname="Microsoft.DotNet.RemoteExecutor.Program"> | ||
<method signature="System.Int32 Main(System.String[])" /> | ||
</type> | ||
</assembly> | ||
mdh1418 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</linker> |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,11 +6,22 @@ | |||||||||||
<RunAOTCompilation Condition="'$(TargetOS)' == 'iOS' and $(TargetArchitecture.StartsWith('arm'))">true</RunAOTCompilation> | ||||||||||||
<JSEngine Condition="'$(TargetOS)' == 'Browser' and '$(JSEngine)' == ''">V8</JSEngine> | ||||||||||||
<JSEngineArgs Condition="'$(JSEngine)' == 'V8'">$(JSEngineArgs) --engine-arg=--stack-trace-limit=1000</JSEngineArgs> | ||||||||||||
|
||||||||||||
<PublishingTestsRun>true</PublishingTestsRun> | ||||||||||||
</PropertyGroup> | ||||||||||||
|
||||||||||||
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'"> | ||||||||||||
<!-- 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 --> | ||||||||||||
<RunScriptCommand>$HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand> | ||||||||||||
<EventSourceSupport>false</EventSourceSupport> | ||||||||||||
<UseSystemResourceKeys>true</UseSystemResourceKeys> | ||||||||||||
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding> | ||||||||||||
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport> | ||||||||||||
<DebuggerSupport>false</DebuggerSupport> | ||||||||||||
</PropertyGroup> | ||||||||||||
|
||||||||||||
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'"> | ||||||||||||
<PublishTrimmed>true</PublishTrimmed> | ||||||||||||
</PropertyGroup> | ||||||||||||
|
||||||||||||
<PropertyGroup Condition="'$(TargetOS)' == 'Android'"> | ||||||||||||
|
@@ -146,6 +157,30 @@ | |||||||||||
|
||||||||||||
</Target> | ||||||||||||
|
||||||||||||
<Target Name="ConfigureTrimming" Condition="'$(EnableAggressiveTrimming)' == 'true'" BeforeTargets="PrepareForILLink"> | ||||||||||||
<PropertyGroup> | ||||||||||||
<TrimMode>link</TrimMode> | ||||||||||||
</PropertyGroup> | ||||||||||||
|
||||||||||||
<ItemGroup> | ||||||||||||
<ManagedAssemblyToLink Include="$(OutDir)\*xunit*"> | ||||||||||||
<IsTrimmable>true</IsTrimmable> | ||||||||||||
<TrimMode>link</TrimMode> | ||||||||||||
</ManagedAssemblyToLink> | ||||||||||||
<ManagedAssemblyToLink Condition="('%(ManagedAssemblyToLink.FileName).dll' != '$(MSBuildProjectName).dll')" > | ||||||||||||
<TrimMode>link</TrimMode> | ||||||||||||
</ManagedAssemblyToLink> | ||||||||||||
<ManagedAssemblyToLink Condition="('%(ManagedAssemblyToLink.FileName).dll' == '$(AssemblyName).dll')" > | ||||||||||||
<TrimMode>copy</TrimMode> | ||||||||||||
</ManagedAssemblyToLink> | ||||||||||||
Comment on lines
+166
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets#L142-L144 , I think instead of this, we should have a target that adds to This will get processed by https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets#L235-L237 and subsequently by PrepareForILLink target.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using ResolvedFileToPublish makes sense if we can hook it early enough. Though I'd keep copy setting to be explicit and maybe add a comment that we want the tested assembly to be always copied only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will address in a follow-up PR |
||||||||||||
<TrimmerRootAssembly Condition="'$(TargetOS)' == 'Android'" Include="AndroidTestRunner"/> | ||||||||||||
<TrimmerRootAssembly Condition="'$(TargetOS)' == 'Browser'" Include="WasmTestRunner"/> | ||||||||||||
<TrimmerRootAssembly Condition="'$(TargetOS)' == 'iOS'" Include="AppleTestRunner"/> | ||||||||||||
<TrimmerRootAssembly Include="$(AssemblyName)"/> | ||||||||||||
Comment on lines
+176
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These shouldn't be needed, I think, since the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are different settings. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that they might get picked up by runtime/eng/testing/tests.mobile.targets Lines 222 to 226 in 3262912
@(ResolvedFileToPublish)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried removing L181
for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will address in a follow-up PR |
||||||||||||
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptor.xunit.xml" /> | ||||||||||||
</ItemGroup> | ||||||||||||
</Target> | ||||||||||||
|
||||||||||||
<Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.targets" Condition="'$(TargetOS)' == 'Browser'" /> | ||||||||||||
<PropertyGroup> | ||||||||||||
<WasmBuildAppDependsOn>PrepareForWasmBuildApp;$(WasmBuildAppDependsOn)</WasmBuildAppDependsOn> | ||||||||||||
|
@@ -186,13 +221,14 @@ | |||||||||||
<_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'" /> | ||||||||||||
<_runnerFilesToPublish Include="$(WasmTestRunnerDir)*" Condition="'$(TargetOS)' == 'Browser'" /> | ||||||||||||
|
||||||||||||
<!-- Exclude xunit assemblies as those should be resolved by our own package references --> | ||||||||||||
<ResolvedFileToPublish Include="@(_runnerFilesToPublish)" Condition="!$([System.String]::Copy('%(Filename)').StartsWith('xunit.'))" RelativePath="%(FileName)%(Extension)" CopyToPublishDirectory="PreserveNewest" PostprocessAssembly="true" /> | ||||||||||||
<ResolvedFileToPublish Include="@(_runnerFilesToPublish)" RelativePath="%(FileName)%(Extension)" CopyToPublishDirectory="PreserveNewest" PostprocessAssembly="true" /> | ||||||||||||
</ItemGroup> | ||||||||||||
</Target> | ||||||||||||
|
||||||||||||
<Target Name="PublishTestAsSelfContained" | ||||||||||||
Condition="'$(IsCrossTargetingBuild)' != 'true'" | ||||||||||||
AfterTargets="Build" | ||||||||||||
DependsOnTargets="Publish;BundleTestAppleApp;BundleTestAndroidApp;BundleTestWasmApp;ArchiveTests" /> | ||||||||||||
|
||||||||||||
<Import Project="$(RepositoryEngineeringDir)illink.targets" /> | ||||||||||||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.