@@ -46,6 +46,11 @@ bool IBuildActions.FileExists(string file)
46
46
47
47
public IList < string > RunProcessIn { get ; } = new List < string > ( ) ;
48
48
public IDictionary < string , int > RunProcess { get ; } = new Dictionary < string , int > ( ) ;
49
+
50
+ /// <summary>
51
+ /// Process-exit code pairs for commands that are executed during the assembly of the autobuild script.
52
+ /// </summary>
53
+ public IDictionary < string , int > RunProcessExecuteDuring { get ; } = new Dictionary < string , int > ( ) ;
49
54
public IDictionary < string , string > RunProcessOut { get ; } = new Dictionary < string , string > ( ) ;
50
55
public IDictionary < string , string > RunProcessWorkingDirectory { get ; } = new Dictionary < string , string > ( ) ;
51
56
public HashSet < string > CreateDirectories { get ; } = new HashSet < string > ( ) ;
@@ -66,7 +71,7 @@ int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory,
66
71
if ( wd != workingDirectory )
67
72
throw new ArgumentException ( $ "Unexpected RunProcessWorkingDirectory, got { wd ?? "null" } expected { workingDirectory ?? "null" } in { pattern } ") ;
68
73
69
- if ( ! RunProcess . TryGetValue ( pattern , out var ret ) )
74
+ if ( ! RunProcess . TryGetValue ( pattern , out var ret ) && ! RunProcessExecuteDuring . TryGetValue ( pattern , out ret ) )
70
75
throw new ArgumentException ( "Missing RunProcess " + pattern ) ;
71
76
72
77
return ret ;
@@ -81,7 +86,7 @@ int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory,
81
86
if ( wd != workingDirectory )
82
87
throw new ArgumentException ( $ "Unexpected RunProcessWorkingDirectory, got { wd ?? "null" } expected { workingDirectory ?? "null" } in { pattern } ") ;
83
88
84
- if ( ! RunProcess . TryGetValue ( pattern , out var ret ) )
89
+ if ( ! RunProcess . TryGetValue ( pattern , out var ret ) && ! RunProcessExecuteDuring . TryGetValue ( pattern , out ret ) )
85
90
throw new ArgumentException ( "Missing RunProcess " + pattern ) ;
86
91
87
92
return ret ;
@@ -797,11 +802,32 @@ public void TestDirsProjWindows()
797
802
}
798
803
799
804
[ Fact ]
800
- public void TestDirsProjLinux ( )
805
+ public void TestDirsProjLinux_WithMono ( )
801
806
{
807
+ actions . RunProcessExecuteDuring [ @"mono --version" ] = 0 ;
808
+
802
809
actions . RunProcess [ @"nuget restore C:\Project/dirs.proj -DisableParallelProcessing" ] = 1 ;
803
810
actions . RunProcess [ @"mono scratch/.nuget/nuget.exe restore C:\Project/dirs.proj -DisableParallelProcessing" ] = 0 ;
804
811
actions . RunProcess [ @"msbuild C:\Project/dirs.proj /t:rebuild" ] = 0 ;
812
+
813
+ var autobuilder = TestDirsProjLinux ( ) ;
814
+ TestAutobuilderScript ( autobuilder , 0 , 3 ) ;
815
+ }
816
+
817
+ [ Fact ]
818
+ public void TestDirsProjLinux_WithoutMono ( )
819
+ {
820
+ actions . RunProcessExecuteDuring [ @"mono --version" ] = 1 ;
821
+
822
+ actions . RunProcess [ @"dotnet msbuild /t:restore C:\Project/dirs.proj" ] = 0 ;
823
+ actions . RunProcess [ @"dotnet msbuild C:\Project/dirs.proj /t:rebuild" ] = 0 ;
824
+
825
+ var autobuilder = TestDirsProjLinux ( ) ;
826
+ TestAutobuilderScript ( autobuilder , 0 , 2 ) ;
827
+ }
828
+
829
+ private CSharpAutobuilder TestDirsProjLinux ( )
830
+ {
805
831
actions . FileExists [ "csharp.log" ] = true ;
806
832
actions . FileExists [ @"C:\Project/a/test.csproj" ] = true ;
807
833
actions . FileExists [ @"C:\Project/dirs.proj" ] = true ;
@@ -830,8 +856,7 @@ public void TestDirsProjLinux()
830
856
</Project>" ) ;
831
857
actions . LoadXml [ @"C:\Project/dirs.proj" ] = dirsproj ;
832
858
833
- var autobuilder = CreateAutoBuilder ( false ) ;
834
- TestAutobuilderScript ( autobuilder , 0 , 3 ) ;
859
+ return CreateAutoBuilder ( false ) ;
835
860
}
836
861
837
862
[ Fact ]
0 commit comments