File tree 5 files changed +51
-4
lines changed
5 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ public ITaskItem[] EmbeddedFiles
63
63
get { return ( ITaskItem [ ] ) _store [ nameof ( EmbeddedFiles ) ] ; }
64
64
}
65
65
66
+ public bool EmbedAllSources
67
+ {
68
+ set { _store [ nameof ( EmbedAllSources ) ] = value ; }
69
+ get { return _store . GetOrDefault ( nameof ( EmbedAllSources ) , false ) ; }
70
+ }
71
+
66
72
public ITaskItem [ ] Analyzers
67
73
{
68
74
set { _store [ nameof ( Analyzers ) ] = value ; }
@@ -845,6 +851,11 @@ private void AddAdditionalFilesToCommandLine(CommandLineBuilderExtension command
845
851
/// </summary>
846
852
private void AddEmbeddedFilesToCommandLine ( CommandLineBuilderExtension commandLine )
847
853
{
854
+ if ( EmbedAllSources )
855
+ {
856
+ commandLine . AppendSwitch ( "/embed" ) ;
857
+ }
858
+
848
859
if ( EmbeddedFiles != null )
849
860
{
850
861
foreach ( ITaskItem embeddedFile in EmbeddedFiles )
Original file line number Diff line number Diff line change 98
98
DelaySign =" $(DelaySign)"
99
99
DisabledWarnings =" $(NoWarn)"
100
100
DocumentationFile =" @(DocFileItem)"
101
+ EmbedAllSources =" $(EmbedAllSources)"
101
102
EmbeddedFiles =" @(EmbeddedFiles)"
102
103
EmitDebugInformation =" $(DebugSymbols)"
103
104
EnvironmentVariables =" $(CscEnvironment)"
Original file line number Diff line number Diff line change 84
84
DelaySign =" $(DelaySign)"
85
85
DisabledWarnings =" $(NoWarn)"
86
86
DocumentationFile =" @(DocFileItem)"
87
+ EmbedAllSources =" $(EmbedAllSources)"
87
88
EmbeddedFiles =" @(EmbeddedFiles)"
88
89
EmitDebugInformation =" $(DebugSymbols)"
89
90
EnvironmentVariables =" $(VbcEnvironment)"
Original file line number Diff line number Diff line change @@ -292,9 +292,26 @@ public void Embed()
292
292
293
293
csc = new Csc ( ) ;
294
294
csc . Sources = MSBuildUtil . CreateTaskItems ( "test.cs" ) ;
295
- csc . DebugType = "portable " ;
295
+ csc . DebugType = "full " ;
296
296
csc . EmbeddedFiles = MSBuildUtil . CreateTaskItems ( ) ;
297
- Assert . Equal ( @"/debug:portable /out:test.exe test.cs" , csc . GenerateResponseFileContents ( ) ) ;
297
+ Assert . Equal ( @"/debug:full /out:test.exe test.cs" , csc . GenerateResponseFileContents ( ) ) ;
298
+ }
299
+
300
+ [ Fact ]
301
+ public void EmbedAllSources ( )
302
+ {
303
+ var csc = new Csc ( ) ;
304
+ csc . Sources = MSBuildUtil . CreateTaskItems ( "test.cs" ) ;
305
+ csc . EmbeddedFiles = MSBuildUtil . CreateTaskItems ( @"test.cs" , @"test.txt" ) ;
306
+ csc . EmbedAllSources = true ;
307
+
308
+ Assert . Equal ( @"/out:test.exe /embed /embed:test.cs /embed:test.txt test.cs" , csc . GenerateResponseFileContents ( ) ) ;
309
+
310
+ csc = new Csc ( ) ;
311
+ csc . Sources = MSBuildUtil . CreateTaskItems ( "test.cs" ) ;
312
+ csc . EmbedAllSources = true ;
313
+
314
+ Assert . Equal ( @"/out:test.exe /embed test.cs" , csc . GenerateResponseFileContents ( ) ) ;
298
315
}
299
316
300
317
[ Fact ]
Original file line number Diff line number Diff line change @@ -289,9 +289,26 @@ public void Embed()
289
289
290
290
vbc = new Vbc ( ) ;
291
291
vbc . Sources = MSBuildUtil . CreateTaskItems ( "test.vb" ) ;
292
- vbc . DebugType = "portable " ;
292
+ vbc . DebugType = "full " ;
293
293
vbc . EmbeddedFiles = MSBuildUtil . CreateTaskItems ( ) ;
294
- Assert . Equal ( @"/optionstrict:custom /debug:portable /out:test.exe test.vb" , vbc . GenerateResponseFileContents ( ) ) ;
294
+ Assert . Equal ( @"/optionstrict:custom /debug:full /out:test.exe test.vb" , vbc . GenerateResponseFileContents ( ) ) ;
295
+ }
296
+
297
+ [ Fact ]
298
+ public void EmbedAllSources ( )
299
+ {
300
+ var vbc = new Vbc ( ) ;
301
+ vbc . Sources = MSBuildUtil . CreateTaskItems ( "test.vb" ) ;
302
+ vbc . EmbeddedFiles = MSBuildUtil . CreateTaskItems ( @"test.vb" , @"test.txt" ) ;
303
+ vbc . EmbedAllSources = true ;
304
+
305
+ Assert . Equal ( @"/optionstrict:custom /out:test.exe /embed /embed:test.vb /embed:test.txt test.vb" , vbc . GenerateResponseFileContents ( ) ) ;
306
+
307
+ vbc = new Vbc ( ) ;
308
+ vbc . Sources = MSBuildUtil . CreateTaskItems ( "test.vb" ) ;
309
+ vbc . EmbedAllSources = true ;
310
+
311
+ Assert . Equal ( @"/optionstrict:custom /out:test.exe /embed test.vb" , vbc . GenerateResponseFileContents ( ) ) ;
295
312
}
296
313
297
314
[ Fact ]
You can’t perform that action at this time.
0 commit comments