Skip to content

Commit 80c9fb1

Browse files
Merge pull request #308 from diadoc/fix_cake_script
Update build.cake
2 parents 049e9a7 + f228b1d commit 80c9fb1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

build.cake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#addin "nuget:?package=Cake.Git&version=1.0.0"
22
using Cake.Common.Diagnostics;
33
using System.Text.RegularExpressions;
4+
using System.Runtime.InteropServices;
45

56
var target = Argument("target", "Default");
67
var configuration = Argument("configuration", "Release");
@@ -10,7 +11,7 @@ var protocLink = "https://github.com/google/protobuf/releases/download/v2.6.1/pr
1011
var protocArchive = buildDir.CombineWithFilePath("protoc-2.6.1-win32.zip");
1112
var protocBinDir = buildDir.Combine("protoc");
1213
var 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

Comments
 (0)