@@ -15,6 +15,18 @@ public class ApiIntersect : ToolTask
1515 [ Required ]
1616 public ITaskItem [ ] IntersectionAssembly { get ; set ; }
1717
18+ public ITaskItem [ ] ReferencePath { get ; set ; }
19+
20+ public ITaskItem [ ] ExcludeType { get ; set ; }
21+
22+ public ITaskItem [ ] RemoveAbstractTypeMembers { get ; set ; }
23+
24+ public ITaskItem [ ] ExcludeAssembly { get ; set ; }
25+
26+ public string KeepInternalConstructors { get ; set ; }
27+
28+ public string KeepMarshalling { get ; set ; }
29+
1830 [ Required ]
1931 public ITaskItem RootOutputDirectory { get ; set ; }
2032
@@ -56,6 +68,38 @@ protected override string GenerateCommandLineCommands()
5668 builder . AppendFileNameIfNotNull ( assembly . ItemSpec ) ;
5769 }
5870
71+ foreach ( var referencePath in ReferencePath . NullAsEmpty ( ) )
72+ {
73+ builder . AppendSwitch ( "-r" ) ;
74+ builder . AppendFileNameIfNotNull ( referencePath . ItemSpec ) ;
75+ }
76+
77+ foreach ( var excludeType in ExcludeType . NullAsEmpty ( ) )
78+ {
79+ builder . AppendSwitch ( "-b" ) ;
80+ builder . AppendTextUnquoted ( " \" " ) ;
81+ builder . AppendTextUnquoted ( excludeType . ItemSpec ) ;
82+ builder . AppendTextUnquoted ( "\" " ) ;
83+ }
84+
85+ foreach ( var removeAbstractType in RemoveAbstractTypeMembers . NullAsEmpty ( ) )
86+ {
87+ builder . AppendSwitch ( "-a" ) ;
88+ builder . AppendTextUnquoted ( " \" " ) ;
89+ builder . AppendTextUnquoted ( removeAbstractType . ItemSpec ) ;
90+ builder . AppendTextUnquoted ( "\" " ) ;
91+ }
92+
93+ foreach ( var assembly in ExcludeAssembly . NullAsEmpty ( ) )
94+ {
95+ builder . AppendSwitch ( "-e" ) ;
96+ builder . AppendFileNameIfNotNull ( assembly . ItemSpec ) ;
97+ }
98+
99+ AppendSwitchIfTrue ( builder , "-k" , KeepInternalConstructors ) ;
100+
101+ AppendSwitchIfTrue ( builder , "-m" , KeepMarshalling ) ;
102+
59103 return builder . ToString ( ) ;
60104 }
61105
@@ -102,5 +146,15 @@ static string GetPortableRootDirectory()
102146 Environment . GetFolderPath ( Environment . SpecialFolder . ProgramFilesX86 , Environment . SpecialFolderOption . DoNotVerify ) ,
103147 @"Reference Assemblies\Microsoft\Framework\.NETPortable" ) ;
104148 }
149+
150+ static void AppendSwitchIfTrue ( CommandLineBuilder builder , string switchName , string value )
151+ {
152+ if ( string . IsNullOrEmpty ( value ) )
153+ return ;
154+
155+ bool result ;
156+ if ( bool . TryParse ( value , out result ) )
157+ builder . AppendSwitch ( switchName ) ;
158+ }
105159 }
106160}
0 commit comments