11#addin "nuget:?package=Cake.Git&version=1.0.0"
22using Cake . Common . Diagnostics ;
33using System . Text . RegularExpressions ;
4+ using System . Runtime . InteropServices ;
45
56var target = Argument ( "target" , "Default" ) ;
67var configuration = Argument ( "configuration" , "Release" ) ;
@@ -10,7 +11,7 @@ var protocLink = "https://github.com/google/protobuf/releases/download/v2.6.1/pr
1011var protocArchive = buildDir . CombineWithFilePath ( "protoc-2.6.1-win32.zip" ) ;
1112var protocBinDir = buildDir . Combine ( "protoc" ) ;
1213var protocExe = protocBinDir . CombineWithFilePath ( "protoc.exe" ) ;
13- var mvnTool = new [ ] { "mvn.cmd" , "mvn.exe" } . Select ( x => Context . Tools . Resolve ( x ) ) . Where ( x => x != null ) . FirstOrDefault ( ) ;
14+ var mvnTool = new [ ] { "mvn.cmd" , "mvn.exe" , "mvn" } . Select ( x => Context . Tools . Resolve ( x ) ) . Where ( x => x != null ) . FirstOrDefault ( ) ;
1415
1516//////////////////////////////////////////////////////////////////////
1617// TASKS
@@ -156,6 +157,11 @@ public void CompileProtoFiles(IEnumerable<FilePath> files, DirectoryPath sourceP
156157 protocArguments . WithArguments ( args => args . Append ( file . FullPath ) ) ;
157158 }
158159
160+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
161+ {
162+ protocExe = "protoc" ;
163+ }
164+
159165 var exitCode = StartProcess ( protocExe , protocArguments ) ;
160166 if ( exitCode != 0 )
161167 {
@@ -225,4 +231,4 @@ public string GetSemanticVersionV2(string clearVersion)
225231 var daysPart = ( currentDate - new DateTime ( 2010 , 01 , 01 ) ) . Days ;
226232 var secondsPart = Math . Floor ( ( currentDate - currentDate . Date ) . TotalSeconds / 2 ) ;
227233 return string . Format ( "{0}-dev.{1}.{2}" , clearVersion , daysPart , secondsPart ) ;
228- }
234+ }
0 commit comments