Recommit /repackdrop option support
This commit is contained in:
Родитель
279afd3579
Коммит
168e48e6a4
|
@ -0,0 +1,9 @@
|
|||
[*]
|
||||
end_of_line = crlf
|
||||
|
||||
[*.cs]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
csharp_new_line_before_open_brace = all
|
||||
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4547EE79-6D49-4318-B473-B5BBF73B434C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
build.gradle = build.gradle
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
|
@ -139,4 +140,7 @@ Global
|
|||
{6A827942-BEEF-4E49-A3A4-306E21428E85} = {04819B25-ABEA-46F7-90D5-149C8304F67F}
|
||||
{EECC6459-78C6-4A08-9039-DE37E75866E6} = {04819B25-ABEA-46F7-90D5-149C8304F67F}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {54C7CB02-6231-428F-BBD0-113CC9852908}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -121,7 +121,8 @@ namespace ILRepacking
|
|||
{
|
||||
_logger.Verbose("- Importing " + type);
|
||||
bool hasFilter = String.IsNullOrEmpty(_options.RepackDropAttribute) == false;
|
||||
if (hasFilter && ShouldDrop(type)) {
|
||||
if (hasFilter && ShouldDrop(type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -160,29 +161,39 @@ namespace ILRepacking
|
|||
_repackContext.MappingHandler.StoreRemappedType(type, nt);
|
||||
|
||||
// nested types first (are never internalized)
|
||||
foreach (TypeDefinition nested in type.NestedTypes) {
|
||||
if (hasFilter && ShouldDrop(nested) == false) {
|
||||
foreach (TypeDefinition nested in type.NestedTypes)
|
||||
{
|
||||
if (hasFilter == false || ShouldDrop(nested) == false)
|
||||
{
|
||||
Import(nested, nt.NestedTypes, false);
|
||||
}
|
||||
}
|
||||
foreach (FieldDefinition field in type.Fields) {
|
||||
if (hasFilter && ShouldDrop(field) == false) {
|
||||
foreach (FieldDefinition field in type.Fields)
|
||||
{
|
||||
if (hasFilter == false || ShouldDrop(field) == false)
|
||||
{
|
||||
CloneTo(field, nt);
|
||||
}
|
||||
}
|
||||
// methods before fields / events
|
||||
foreach (MethodDefinition meth in type.Methods) {
|
||||
if (hasFilter && ShouldDrop(meth) == false) {
|
||||
foreach (MethodDefinition meth in type.Methods)
|
||||
{
|
||||
if (hasFilter == false || ShouldDrop(meth) == false)
|
||||
{
|
||||
CloneTo(meth, nt, justCreatedType);
|
||||
}
|
||||
}
|
||||
foreach (EventDefinition evt in type.Events) {
|
||||
if (hasFilter && ShouldDrop(evt) == false) {
|
||||
foreach (EventDefinition evt in type.Events)
|
||||
{
|
||||
if (hasFilter == false || ShouldDrop(evt) == false)
|
||||
{
|
||||
CloneTo(evt, nt, nt.Events);
|
||||
}
|
||||
}
|
||||
foreach (PropertyDefinition prop in type.Properties) {
|
||||
if (hasFilter && ShouldDrop(prop) == false) {
|
||||
foreach (PropertyDefinition prop in type.Properties)
|
||||
{
|
||||
if (hasFilter == false || ShouldDrop(prop) == false)
|
||||
{
|
||||
CloneTo(prop, nt, nt.Properties);
|
||||
}
|
||||
}
|
||||
|
@ -190,12 +201,14 @@ namespace ILRepacking
|
|||
return nt;
|
||||
}
|
||||
|
||||
private bool ShouldDrop<TMember>(TMember member) where TMember : ICustomAttributeProvider, IMemberDefinition {
|
||||
private bool ShouldDrop<TMember>(TMember member) where TMember : ICustomAttributeProvider, IMemberDefinition
|
||||
{
|
||||
// skip members marked with a custom attribute named as /repackdrop:RepackDropAttribute
|
||||
var shouldDrop = member.HasCustomAttributes
|
||||
&& member.CustomAttributes.FirstOrDefault(attr => attr.AttributeType.Name == _options.RepackDropAttribute) != null;
|
||||
if (shouldDrop) {
|
||||
_logger.Log("Repack dropped " + typeof(TMember).Name + ": " + member.FullName + " as it was marked with "+ _options.RepackDropAttribute);
|
||||
if (shouldDrop)
|
||||
{
|
||||
_logger.Log("Repack dropped " + typeof(TMember).Name + ": " + member.FullName + " as it was marked with " + _options.RepackDropAttribute);
|
||||
}
|
||||
return shouldDrop;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче