From e0465e6cd380a12a23b6cf74d3b7c157e7d4e1e5 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 29 Apr 2020 04:15:41 -0700 Subject: [PATCH] Allow stripping resources with ignore-descriptors (#1146) --- .../Linker.Steps/BodySubstituterStep.cs | 9 +++-- src/linker/Linker.Steps/ResolveFromXmlStep.cs | 9 +++-- src/linker/Linker/Driver.cs | 31 +++++++++++------ src/linker/Linker/LinkContext.cs | 11 ++++-- .../Metadata/IgnoreDescriptorsAttribute.cs | 12 +++++++ .../Metadata/IgnoreSubstitutionsAttribute.cs | 12 +++++++ .../Metadata/IncludeBlacklistStepAttribute.cs | 12 ------- ...ribute.cs => StripDescriptorsAttribute.cs} | 4 +-- .../Metadata/StripSubstitutionsAttribute.cs | 14 ++++++++ ...eddedLinkXmlFromCopyAssemblyIsProcessed.cs | 2 +- ...sAdditionalAssemblyWithOverriddenMethod.cs | 2 +- ...dInNonReferencedAssemblyWithEmbeddedXml.cs | 2 +- ...dInNonReferencedAssemblyWithEmbeddedXml.cs | 2 +- ...leIsNotProcessedWithIgnoreDescriptors.xml} | 2 +- ...ocessedWithIgnoreDescriptorsAndRemoved.xml | 5 +++ ...cedAssemblyIsNotProcessedIfActionIsCopy.cs | 2 +- ...otProcessedIfNameDoesNotMatchAnAssembly.cs | 2 +- ...rencedAssemblyIsProcessedIfActionIsLink.cs | 2 +- ...otProcessedIfNameDoesNotMatchAnAssembly.cs | 2 +- ...ileIsNotProcessedWithIgnoreDescriptors.cs} | 7 ++-- ...rocessedWithIgnoreDescriptorsAndRemoved.cs | 25 ++++++++++++++ .../EmbeddedLinkXmlFileIsProcessed.cs | 2 +- .../EmbeddedLinkXmlFileIsProcessedAndKept.cs | 4 +-- .../NonLinkerEmbeddedResourceHasNoImpact.cs | 2 +- .../EmbeddedSubstitutions.xml | 0 .../EmbeddedSubstitutionsKept.xml | 7 ++++ ...onsNotProcessedWithIgnoreSubstitutions.xml | 7 ++++ ...essedWithIgnoreSubstitutionsAndRemoved.xml | 7 ++++ .../Substitutions/EmbeddedSubstitutions.cs | 5 +-- .../EmbeddedSubstitutionsKept.cs | 27 +++++++++++++++ ...ionsNotProcessedWithIgnoreSubstitutions.cs | 26 ++++++++++++++ ...cessedWithIgnoreSubstitutionsAndRemoved.cs | 26 ++++++++++++++ .../TestCasesRunner/LinkerArgumentBuilder.cs | 34 ++++++++++++++----- .../TestCasesRunner/TestCaseLinkerOptions.cs | 6 ++-- .../TestCasesRunner/TestCaseMetadaProvider.cs | 6 ++-- 35 files changed, 265 insertions(+), 63 deletions(-) create mode 100644 test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreDescriptorsAttribute.cs create mode 100644 test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreSubstitutionsAttribute.cs delete mode 100644 test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs rename test/Mono.Linker.Tests.Cases.Expectations/Metadata/{StripResourcesAttribute.cs => StripDescriptorsAttribute.cs} (54%) create mode 100644 test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripSubstitutionsAttribute.cs rename test/Mono.Linker.Tests.Cases/Resources/Dependencies/{EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml => EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.xml} (74%) create mode 100644 test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.xml rename test/Mono.Linker.Tests.Cases/Resources/{EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs => EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.cs} (75%) create mode 100644 test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.cs rename test/Mono.Linker.Tests.Cases/Substitutions/{ => Dependencies}/EmbeddedSubstitutions.xml (100%) create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsKept.xml create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.xml create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.xml create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsKept.cs create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.cs create mode 100644 test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.cs diff --git a/src/linker/Linker.Steps/BodySubstituterStep.cs b/src/linker/Linker.Steps/BodySubstituterStep.cs index 85b2ad949697..d88646acfd42 100644 --- a/src/linker/Linker.Steps/BodySubstituterStep.cs +++ b/src/linker/Linker.Steps/BodySubstituterStep.cs @@ -31,11 +31,14 @@ public BodySubstituterStep (XPathDocument document, string resourceName, Assembl protected override void Process () { + if (!string.IsNullOrEmpty (_resourceName) && Context.StripSubstitutions) + Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName); + + if (!string.IsNullOrEmpty (_resourceName) && Context.IgnoreSubstitutions) + return; + try { ReadSubstitutions (_document); - - if (!string.IsNullOrEmpty (_resourceName) && Context.StripResources) - Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName); } catch (Exception ex) when (!(ex is XmlResolutionException)) { throw new XmlResolutionException ($"Failed to process XML substitution: '{_xmlDocumentLocation}'", ex); } diff --git a/src/linker/Linker.Steps/ResolveFromXmlStep.cs b/src/linker/Linker.Steps/ResolveFromXmlStep.cs index 9e88fadfb871..9c4d70cb3e8f 100644 --- a/src/linker/Linker.Steps/ResolveFromXmlStep.cs +++ b/src/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -90,11 +90,14 @@ protected override void Process () if (!nav.MoveToChild ("linker", _ns)) return; + if (!string.IsNullOrEmpty (_resourceName) && Context.StripDescriptors) + Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName); + + if (!string.IsNullOrEmpty (_resourceName) && Context.IgnoreDescriptors) + return; + try { ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns)); - - if (!string.IsNullOrEmpty (_resourceName) && Context.StripResources) - Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName); } catch (Exception ex) when (!(ex is XmlResolutionException)) { throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex); } diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs index 22e92578da0a..6d41b770b9d7 100644 --- a/src/linker/Linker/Driver.cs +++ b/src/linker/Linker/Driver.cs @@ -190,7 +190,6 @@ protected int SetupContext (ILogger customLogger = null) var set_optimizations = new List<(CodeOptimizations, string, bool)> (); bool dumpDependencies = false; string dependenciesFileName = null; - bool ignoreDescriptors = false; bool removeCAS = true; bool new_mvid_used = false; bool deterministic_used = false; @@ -246,8 +245,14 @@ protected int SetupContext (ILogger customLogger = null) continue; - case "--strip-resources": - if (!GetBoolParam (token, l => context.StripResources = l)) + case "--strip-descriptors": + if (!GetBoolParam (token, l => context.StripDescriptors = l)) + return -1; + + continue; + + case "--strip-substitutions": + if (!GetBoolParam (token, l => context.StripSubstitutions = l)) return -1; continue; @@ -320,7 +325,13 @@ protected int SetupContext (ILogger customLogger = null) continue; case "--ignore-descriptors": - if (!GetBoolParam (token, l => ignoreDescriptors = l)) + if (!GetBoolParam (token, l => context.IgnoreDescriptors = l)) + return -1; + + continue; + + case "--ignore-substitutions": + if (!GetBoolParam (token, l => context.IgnoreSubstitutions = l)) return -1; continue; @@ -507,7 +518,7 @@ protected int SetupContext (ILogger customLogger = null) continue; case "z": - if (!GetBoolParam (token, l => ignoreDescriptors = !l)) + if (!GetBoolParam (token, l => context.IgnoreDescriptors = !l)) return -1; continue; @@ -573,9 +584,6 @@ protected int SetupContext (ILogger customLogger = null) foreach (var file in body_substituter_steps) AddBodySubstituterStep (p, file); - if (ignoreDescriptors) - p.RemoveStep (typeof (BlacklistStep)); - if (context.DeterministicOutput) p.RemoveStep (typeof (RegenerateGuidStep)); @@ -622,7 +630,7 @@ protected int SetupContext (ILogger customLogger = null) // [mono only] ResolveFromXApiStep [optional, possibly many] // LoadReferencesStep // [mono only] LoadI18nAssemblies - // BlacklistStep [optional] + // BlacklistStep // dynamically adds steps: // ResolveFromXmlStep [optional, possibly many] // BodySubstituterStep [optional, possibly many] @@ -922,7 +930,6 @@ protected virtual LinkContext GetDefaultContext (Pipeline pipeline) #endif UserAction = AssemblyAction.Link, OutputDirectory = "output", - StripResources = true }; return context; } @@ -1011,9 +1018,11 @@ static void Usage () Console.WriteLine (" --keep-dep-attributes Keep attributes used for manual dependency tracking. Defaults to false"); Console.WriteLine (" --feature FEATURE VALUE Apply any optimizations defined when this feature setting is a constant known at link time"); Console.WriteLine (" --new-mvid Generate a new guid for each linked assembly (short -g). Defaults to true"); - Console.WriteLine (" --strip-resources Remove XML descriptor resources for linked assemblies. Defaults to true"); + Console.WriteLine (" --strip-descriptors Remove XML descriptor resources for linked assemblies. Defaults to true"); Console.WriteLine (" --strip-security Remove metadata and code related to Code Access Security. Defaults to true"); Console.WriteLine (" --substitutions FILE Configuration file with field or methods substitution rules"); + Console.WriteLine (" --ignore-substitutions Skips reading embedded substitutions. Defaults to false"); + Console.WriteLine (" --strip-substitutions Remove XML substitution resources for linked assemblies. Defaults to true"); Console.WriteLine (" --used-attrs-only Attribute usage is removed if the attribute type is not used. Defaults to false"); Console.WriteLine (" --attribute-defs FILE Supplementary custom attribute definitions for attributes controlling the linker behavior."); diff --git a/src/linker/Linker/LinkContext.cs b/src/linker/Linker/LinkContext.cs index 060323ee7cc2..71afe470662e 100644 --- a/src/linker/Linker/LinkContext.cs +++ b/src/linker/Linker/LinkContext.cs @@ -116,7 +116,13 @@ public bool IgnoreUnresolved { public bool KeepDependencyAttributes { get; set; } - public bool StripResources { get; set; } + public bool IgnoreDescriptors { get; set; } + + public bool IgnoreSubstitutions { get; set; } + + public bool StripDescriptors { get; set; } + + public bool StripSubstitutions { get; set; } public Dictionary FeatureSettings { get; private set; } @@ -201,7 +207,8 @@ public LinkContext (Pipeline pipeline, AssemblyResolver resolver, ReaderParamete Tracer = factory.CreateTracer (this); ReflectionPatternRecorder = new LoggingReflectionPatternRecorder (this); MarkedKnownMembers = new KnownMembers (); - StripResources = true; + StripDescriptors = true; + StripSubstitutions = true; PInvokes = new List (); // See https://github.com/mono/linker/issues/612 diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreDescriptorsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreDescriptorsAttribute.cs new file mode 100644 index 000000000000..f3cffe2db215 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreDescriptorsAttribute.cs @@ -0,0 +1,12 @@ +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class IgnoreDescriptorsAttribute : BaseMetadataAttribute + { + public readonly bool Value; + + public IgnoreDescriptorsAttribute (bool value) + { + Value = value; + } + } +} diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreSubstitutionsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreSubstitutionsAttribute.cs new file mode 100644 index 000000000000..ab999b6dd257 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IgnoreSubstitutionsAttribute.cs @@ -0,0 +1,12 @@ +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class IgnoreSubstitutionsAttribute : BaseMetadataAttribute + { + public readonly bool Value; + + public IgnoreSubstitutionsAttribute (bool value) + { + Value = value; + } + } +} diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs deleted file mode 100644 index a70567e3b835..000000000000 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Mono.Linker.Tests.Cases.Expectations.Metadata -{ - public sealed class IncludeBlacklistStepAttribute : BaseMetadataAttribute - { - public readonly bool Value; - - public IncludeBlacklistStepAttribute (bool value) - { - Value = value; - } - } -} diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripDescriptorsAttribute.cs similarity index 54% rename from test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs rename to test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripDescriptorsAttribute.cs index 691152a071e5..de9d2bf4ebe9 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripResourcesAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripDescriptorsAttribute.cs @@ -2,11 +2,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - public sealed class StripResourcesAttribute : BaseMetadataAttribute + public sealed class StripDescriptorsAttribute : BaseMetadataAttribute { public readonly bool Value; - public StripResourcesAttribute (bool value) + public StripDescriptorsAttribute (bool value) { Value = value; } diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripSubstitutionsAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripSubstitutionsAttribute.cs new file mode 100644 index 000000000000..1222c2873872 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases.Expectations/Metadata/StripSubstitutionsAttribute.cs @@ -0,0 +1,14 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Metadata +{ + public sealed class StripSubstitutionsAttribute : BaseMetadataAttribute + { + public readonly bool Value; + + public StripSubstitutionsAttribute (bool value) + { + Value = value; + } + } +} diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs index 9a57d8bf3489..a5e3271042de 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml [SetupCompileBefore ("CopyLibrary.dll", new[] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.cs" }, resources: new[] { "Dependencies/EmbeddedLinkXmlFromCopyAssemblyIsProcessed/CopyLibrary.xml" })] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [SetupLinkerAction ("copy", "CopyLibrary")] [KeptTypeInAssembly ("CopyLibrary.dll", typeof (CopyLibrary))] diff --git a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs index 77f45d75c0dc..37a8265ea0a7 100644 --- a/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs +++ b/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod.cs @@ -14,7 +14,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml new[] { "Dependencies/EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod/Library2.cs" }, new[] { "Base.dll" }, addAsReference: false)] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [KeptMemberInAssembly ("Library1.dll", typeof (Library1), "VirtualMethodFromBase()")] [KeptMemberInAssembly ("Library1.dll", typeof (Library1Secondary), "VirtualMethodFromBase()")] diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs index 6e93a8edc837..b27d68c0ba95 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyMethodInNonReferencedAssemblyWithEmbeddedXml.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies /// /// This is an acceptable bug with the currently implementation. Embedded link xml files will not be processed /// - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ( diff --git a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs index c53d436aff38..010f200b8865 100644 --- a/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs +++ b/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyOnUnusedMethodInNonReferencedAssemblyWithEmbeddedXml.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.PreserveDependencies /// /// This test is here to ensure that link xml embedded in an assembly used by a [PreserveDependency] is not processed if the dependency is not used /// - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [SetupCompileBefore ("FakeSystemAssembly.dll", new[] { "Dependencies/PreserveDependencyAttribute.cs" })] [SetupCompileBefore ("base.dll", new[] { "Dependencies/PreserveDependencyMethodInNonReferencedAssemblyBase.cs" })] [SetupCompileBefore ( diff --git a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.xml similarity index 74% rename from test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml rename to test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.xml index 11c0c1f42aa5..eb7fc367f8b6 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml +++ b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.xml b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.xml new file mode 100644 index 000000000000..63bb47ab4b65 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs index 17b66e74b0a8..ebf100b07cc3 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.Resources new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.cs" }, resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.xml" })] [SetupLinkerAction ("copy", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1")] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [KeptResourceInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.xml")] [KeptMemberInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfActionIsCopy_Lib1), "Unused()")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs index dac7038a5e6a..1dcbe78704b1 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.Resources "library.dll", new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1.cs" }, resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1_NotMatchingName.xml" })] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [KeptResourceInAssembly ("library.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1_NotMatchingName.xml")] [RemovedMemberInAssembly ("library.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsNotProcessedIfNameDoesNotMatchAnAssembly_Lib1), "Unused()")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs index 080eb1736ebd..c8926980b39d 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink.cs @@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.Resources new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.cs" }, resources: new[] { "Dependencies/EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.xml" })] [SetupLinkerAction ("link", "EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1")] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [RemovedResourceInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.dll", "EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.xml")] [KeptMemberInAssembly ("EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1.dll", typeof (EmbeddedLinkXmlFileInReferencedAssemblyIsProcessedIfActionIsLink_Lib1), "Unused()")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs index fa9ba66a761d..6cde4fafbcd3 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs @@ -5,7 +5,7 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml", "NotMatchingAnAssemblyName.xml")] [SkipPeVerify] [KeptResource ("NotMatchingAnAssemblyName.xml")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.cs similarity index 75% rename from test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs rename to test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.cs index 2a8227c241ab..54e5ee72ac28 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.cs @@ -5,13 +5,14 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (false)] + [IgnoreDescriptors (true)] + [StripDescriptors (false)] // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step - [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml", "test.xml")] + [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors.xml", "test.xml")] [SkipPeVerify] [KeptResource ("test.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled + public class EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptors { public static void Main () { diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.cs new file mode 100644 index 000000000000..8343a31532a0 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.cs @@ -0,0 +1,25 @@ +using System; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Resources +{ + [SetupLinkerCoreAction ("link")] + [IgnoreDescriptors (true)] + [StripDescriptors (true)] + + // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step + [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved.xml", "test.xml")] + [SkipPeVerify] + [RemovedResourceInAssembly ("test.exe", "test.xml")] + public class EmbeddedLinkXmlFileIsNotProcessedWithIgnoreDescriptorsAndRemoved + { + public static void Main () + { + } + + public class Unused + { + } + } +} diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs index c49525f7791d..643fdcf2271b 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs @@ -5,7 +5,7 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsProcessed.xml", "test.xml")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs index a93db9e9c2cd..2b656f10c63f 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessedAndKept.cs @@ -5,8 +5,8 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] - [StripResources (false)] + [IgnoreDescriptors (false)] + [StripDescriptors (false)] // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsProcessedAndKept.xml", "test.xml")] diff --git a/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs b/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs index 76797b42d90e..ac6af1a7c492 100644 --- a/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs +++ b/test/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs @@ -5,7 +5,7 @@ namespace Mono.Linker.Tests.Cases.Resources { [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] + [IgnoreDescriptors (false)] // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step [SetupCompileResource ("Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml", "test.xml")] diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.xml b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutions.xml similarity index 100% rename from test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.xml rename to test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutions.xml diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsKept.xml b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsKept.xml new file mode 100644 index 000000000000..01499d5d7237 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsKept.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.xml b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.xml new file mode 100644 index 000000000000..3b321f61b46c --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.xml b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.xml new file mode 100644 index 000000000000..019028c71a89 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs index 3a3d6cef4f42..3306aee24d1b 100644 --- a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs +++ b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutions.cs @@ -3,8 +3,9 @@ namespace Mono.Linker.Tests.Cases.Substitutions { - [SetupCompileResource ("EmbeddedSubstitutions.xml", "ILLink.Substitutions.xml")] - [IncludeBlacklistStep (true)] + [SetupCompileResource ("Dependencies/EmbeddedSubstitutions.xml", "ILLink.Substitutions.xml")] + [IgnoreSubstitutions (false)] + [RemovedResourceInAssembly ("test.exe", "ILLink.Substitutions.xml")] public class EmbeddedSubstitutions { public static void Main () diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsKept.cs b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsKept.cs new file mode 100644 index 000000000000..8c25bc867a6e --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsKept.cs @@ -0,0 +1,27 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Substitutions +{ + [SetupCompileResource ("Dependencies/EmbeddedSubstitutionsKept.xml", "ILLink.Substitutions.xml")] + [IgnoreSubstitutions (false)] + [StripSubstitutions (false)] + [KeptResource ("ILLink.Substitutions.xml")] + public class EmbeddedSubstitutionsKept + { + public static void Main () + { + ConvertToThrowMethod (); + } + + [Kept] + [ExpectedInstructionSequence (new[] { + "ldstr", + "newobj", + "throw" + })] + public static void ConvertToThrowMethod () + { + } + } +} diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.cs b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.cs new file mode 100644 index 000000000000..221d7e91570f --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.cs @@ -0,0 +1,26 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Substitutions +{ + [SetupCompileResource ("Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions.xml", "ILLink.Substitutions.xml")] + [IgnoreSubstitutions (true)] + [StripSubstitutions (false)] + [KeptResource ("ILLink.Substitutions.xml")] + public class EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutions + { + public static void Main () + { + ConvertToThrowMethod (); + } + + [Kept] + [ExpectedInstructionSequence (new[] { + "nop", + "ret" + })] + public static void ConvertToThrowMethod () + { + } + } +} diff --git a/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.cs b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.cs new file mode 100644 index 000000000000..bcae631dd56b --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Substitutions/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.cs @@ -0,0 +1,26 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Substitutions +{ + [SetupCompileResource ("Dependencies/EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved.xml", "ILLink.Substitutions.xml")] + [IgnoreSubstitutions (true)] + [StripSubstitutions (true)] + [RemovedResourceInAssembly ("test.exe", "ILLink.Substitutions.xml")] + public class EmbeddedSubstitutionsNotProcessedWithIgnoreSubstitutionsAndRemoved + { + public static void Main () + { + ConvertToThrowMethod (); + } + + [Kept] + [ExpectedInstructionSequence (new[] { + "nop", + "ret" + })] + public static void ConvertToThrowMethod () + { + } + } +} diff --git a/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs b/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs index 8a3d536bc9cf..aafe67f49cef 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs @@ -60,9 +60,15 @@ public virtual void LinkFromPublicAndFamily (string fileName) Append (fileName); } - public virtual void IncludeBlacklist (bool value) + public virtual void IgnoreDescriptors (bool value) { - Append ("-z"); + Append ("--ignore-descriptors"); + Append (value ? "true" : "false"); + } + + public virtual void IgnoreSubstitutions (bool value) + { + Append ("--ignore-substitutions"); Append (value ? "true" : "false"); } @@ -105,10 +111,18 @@ public virtual void AddSkipUnresolved (bool skipUnresolved) } } - public virtual void AddStripResources (bool stripResources) + public virtual void AddStripDescriptors (bool stripDescriptors) { - if (!stripResources) { - Append ("--strip-resources"); + if (!stripDescriptors) { + Append ("--strip-descriptors"); + Append ("false"); + } + } + + public virtual void AddStripSubstitutions (bool stripSubstitutions) + { + if (!stripSubstitutions) { + Append ("--strip-substitutions"); Append ("false"); } } @@ -165,9 +179,11 @@ public virtual void ProcessOptions (TestCaseLinkerOptions options) AddAssemblyAction (entry.Key, entry.Value); } - // Running the blacklist step causes a ton of stuff to be preserved. That's good for normal use cases, but for + // Honoring descriptors causes a ton of stuff to be preserved. That's good for normal use cases, but for // our test cases that pollutes the results - IncludeBlacklist (options.IncludeBlacklistStep); + IgnoreDescriptors (options.IgnoreDescriptors); + + IgnoreSubstitutions (options.IgnoreSubstitutions); #if !NETCOREAPP if (!string.IsNullOrEmpty (options.Il8n)) @@ -185,7 +201,9 @@ public virtual void ProcessOptions (TestCaseLinkerOptions options) AddSkipUnresolved (options.SkipUnresolved); - AddStripResources (options.StripResources); + AddStripDescriptors (options.StripDescriptors); + + AddStripSubstitutions (options.StripSubstitutions); foreach (var substitutions in options.Substitutions) AddSubstitutions (substitutions); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs index 94635ba9e07b..30baec4db0f6 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs @@ -10,12 +10,14 @@ public class TestCaseLinkerOptions public List> AssembliesAction = new List> (); public string Il8n; - public bool IncludeBlacklistStep; + public bool IgnoreDescriptors; + public bool IgnoreSubstitutions; public string KeepTypeForwarderOnlyAssemblies; public string KeepDebugMembers; public string LinkSymbols; public bool SkipUnresolved; - public bool StripResources; + public bool StripDescriptors; + public bool StripSubstitutions; public List> AdditionalArguments = new List> (); diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs index 6bd6c9ed16b3..9789335f1c91 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadaProvider.cs @@ -31,14 +31,16 @@ public virtual TestCaseLinkerOptions GetLinkerOptions (NPath inputPath) { var tclo = new TestCaseLinkerOptions { Il8n = GetOptionAttributeValue (nameof (Il8nAttribute), "none"), - IncludeBlacklistStep = GetOptionAttributeValue (nameof (IncludeBlacklistStepAttribute), false), + IgnoreDescriptors = GetOptionAttributeValue (nameof (IgnoreDescriptorsAttribute), true), + IgnoreSubstitutions = GetOptionAttributeValue (nameof (IgnoreSubstitutionsAttribute), true), KeepTypeForwarderOnlyAssemblies = GetOptionAttributeValue (nameof (KeepTypeForwarderOnlyAssembliesAttribute), string.Empty), KeepDebugMembers = GetOptionAttributeValue (nameof (SetupLinkerKeepDebugMembersAttribute), string.Empty), LinkSymbols = GetOptionAttributeValue (nameof (SetupLinkerLinkSymbolsAttribute), string.Empty), CoreAssembliesAction = GetOptionAttributeValue (nameof (SetupLinkerCoreActionAttribute), null), UserAssembliesAction = GetOptionAttributeValue (nameof (SetupLinkerUserActionAttribute), null), SkipUnresolved = GetOptionAttributeValue (nameof (SkipUnresolvedAttribute), false), - StripResources = GetOptionAttributeValue (nameof (StripResourcesAttribute), true), + StripDescriptors = GetOptionAttributeValue (nameof (StripDescriptorsAttribute), true), + StripSubstitutions = GetOptionAttributeValue (nameof (StripSubstitutionsAttribute), true), }; foreach (var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerActionAttribute))) {