-
Notifications
You must be signed in to change notification settings - Fork 126
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
Restrict embedded XML #1675
Merged
Merged
Restrict embedded XML #1675
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
065cedb
Restrict embedded XML
sbomer 4020a6f
Allow specifying resource name in referenced assembly
sbomer cbd01bf
Fix formatting
sbomer 159e331
PR feedback
sbomer eaade7e
Fix test on mono
sbomer 12d5f36
PR feedback
sbomer 22d14e3
PR feedback
sbomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
test/Mono.Linker.Tests.Cases/LinkAttributes/Dependencies/EmbeddedAttributeErrorCases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Mono.Linker.Tests.Cases.LinkAttributes.Dependencies | ||
{ | ||
public class EmbeddedAttributeErrorCases | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
test/Mono.Linker.Tests.Cases/LinkAttributes/Dependencies/EmbeddedAttributeErrorCases.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<linker> | ||
<!-- IL2100 --> | ||
<assembly fullname="*" /> | ||
<!-- IL2101 --> | ||
<assembly fullname="test"> | ||
<type fullname="Mono.Linker.Tests.Cases.LinkAttributes.LinkAttributeErrorCases/ReferencedFromOtherAssembly"> | ||
<attribute fullname="Mono.Linker.Tests.Cases.LinkAttributes.LinkAttributeErrorCases/FirstAttribute" /> | ||
</type> | ||
</assembly> | ||
</linker> |
14 changes: 14 additions & 0 deletions
14
test/Mono.Linker.Tests.Cases/LinkAttributes/Dependencies/MockCorelib.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#if INCLUDE_MOCK_CORELIB | ||
|
||
using System; | ||
|
||
[assembly: MockCorelibAttributeToRemove] | ||
|
||
namespace System | ||
{ | ||
public class MockCorelibAttributeToRemove : Attribute | ||
{ | ||
} | ||
} | ||
|
||
#endif |
7 changes: 7 additions & 0 deletions
7
test/Mono.Linker.Tests.Cases/LinkAttributes/Dependencies/MockCorelib.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<linker> | ||
<assembly fullname="*"> | ||
<type fullname="System.MockCorelibAttributeToRemove"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
</assembly> | ||
</linker> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fullname is now redundant for embedded XML format, should we just remove/ignore it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good to warn when it's used incorrectly in the embedded XML, otherwise people might try to embed existing XML and wonder why it doesn't work.
Since the assembly is redundant for embedded XML, I made it so that you can leave out the
assembly
entirely:I kept support for
<assembly fullname="ThisAssembly>"
since I think it will be easier to reuse existing XML this way, but I could force the embedded XML not to name the assembly if you prefer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think this is more wording issue than anything else. Your "It is invalid to use these embedded XML files to modify other assemblies." seems to suggest this will be error where in reality this is a warning. Maybe we could go with even simple mode and merge 2100 and 2101 under the simple warning that warns that
fullname
value is ignored for embedded XML files (just suggestion)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworded the warnings - hopefully this is better. I'd like to keep them separate because the wildcard can produce a warning for non-embedded XML too.