Skip to content

Commit

Permalink
Disable feature descriptors for mono
Browse files Browse the repository at this point in the history
Since they conflict with the --exclude-feature "feature" attributes in
the descriptor XML.
  • Loading branch information
sbomer committed Jun 17, 2020
1 parent ae977ed commit 78c2f52
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/linker/Linker.Steps/ResolveFromXmlStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ protected override void Process ()
return;
}

#if FEATURE_ILLINK
if (!ShouldProcessElement (nav))
return;
#endif

try {
ProcessAssemblies (nav.SelectChildren ("assembly", _ns));
Expand All @@ -105,8 +107,10 @@ protected virtual void ProcessAssemblies (XPathNodeIterator iterator)
while (iterator.MoveNext ()) {
var name = GetAssemblyName (iterator.Current);

#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif

AssemblyDefinition assembly = GetAssembly (Context, name);
if (assembly != null)
Expand All @@ -133,8 +137,10 @@ protected virtual void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIt
void ProcessNamespaces (AssemblyDefinition assembly, XPathNodeIterator iterator)
{
while (iterator.MoveNext ()) {
#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif

string fullname = GetFullName (iterator.Current);
foreach (TypeDefinition type in assembly.MainModule.Types) {
Expand Down Expand Up @@ -163,8 +169,10 @@ void ProcessTypes (AssemblyDefinition assembly, XPathNodeIterator iterator)
while (iterator.MoveNext ()) {
XPathNavigator nav = iterator.Current;

#if FEATURE_ILLINK
if (!ShouldProcessElement (nav))
continue;
#endif

string fullname = GetFullName (nav);

Expand Down Expand Up @@ -248,9 +256,9 @@ void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavi

protected virtual void ProcessType (TypeDefinition type, XPathNavigator nav)
{
#if FEATURE_ILLINK
Debug.Assert (ShouldProcessElement (nav));

#if !FEATURE_ILLINK
#else
if (IsExcluded (nav))
return;
#endif
Expand Down Expand Up @@ -342,8 +350,10 @@ static TypePreserve GetTypePreserve (XPathNavigator nav)
void ProcessFields (TypeDefinition type, XPathNodeIterator iterator)
{
while (iterator.MoveNext ()) {
#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif
ProcessField (type, iterator.Current);
}
}
Expand Down Expand Up @@ -413,8 +423,10 @@ static string GetFieldSignature (FieldDefinition field)
void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator, bool required)
{
while (iterator.MoveNext ()) {
#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif
ProcessMethod (type, iterator.Current, required);
}
}
Expand Down Expand Up @@ -514,8 +526,10 @@ public static string GetMethodSignature (MethodDefinition meth, bool includeGene
void ProcessEvents (TypeDefinition type, XPathNodeIterator iterator, bool required)
{
while (iterator.MoveNext ()) {
#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif
ProcessEvent (type, iterator.Current, required);
}
}
Expand Down Expand Up @@ -589,8 +603,10 @@ static string GetEventSignature (EventDefinition @event)
void ProcessProperties (TypeDefinition type, XPathNodeIterator iterator, bool required)
{
while (iterator.MoveNext ()) {
#if FEATURE_ILLINK
if (!ShouldProcessElement (iterator.Current))
continue;
#endif
ProcessProperty (type, iterator.Current, required);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Mono.Linker.Tests.Cases.FeatureSettings
{
#if !NETCOREAPP
[IgnoreTestCase ("Feature settings in descriptors are not supported on Mono.")]
#endif
[SetupLinkerDescriptorFile ("FeatureDescriptorsGlobalTrue.xml")]
[SetupLinkerDescriptorFile ("FeatureDescriptorsGlobalFalse.xml")]
[SetupLinkerDescriptorFile ("FeatureDescriptors.xml")]
Expand Down

0 comments on commit 78c2f52

Please sign in to comment.