Skip to content

Commit

Permalink
Merge pull request #308 from diadoc/fix_cake_script
Browse files Browse the repository at this point in the history
Update build.cake
  • Loading branch information
DmitriyNovikov89 authored Oct 8, 2024
2 parents 049e9a7 + f228b1d commit 80c9fb1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#addin "nuget:?package=Cake.Git&version=1.0.0"
using Cake.Common.Diagnostics;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Expand All @@ -10,7 +11,7 @@ var protocLink = "https://github.com/google/protobuf/releases/download/v2.6.1/pr
var protocArchive = buildDir.CombineWithFilePath("protoc-2.6.1-win32.zip");
var protocBinDir = buildDir.Combine("protoc");
var protocExe = protocBinDir.CombineWithFilePath("protoc.exe");
var mvnTool = new [] { "mvn.cmd", "mvn.exe" }.Select(x => Context.Tools.Resolve(x)).Where(x => x != null).FirstOrDefault();
var mvnTool = new [] { "mvn.cmd", "mvn.exe", "mvn" }.Select(x => Context.Tools.Resolve(x)).Where(x => x != null).FirstOrDefault();

//////////////////////////////////////////////////////////////////////
// TASKS
Expand Down Expand Up @@ -156,6 +157,11 @@ public void CompileProtoFiles(IEnumerable<FilePath> files, DirectoryPath sourceP
protocArguments.WithArguments(args => args.Append(file.FullPath));
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
protocExe = "protoc";
}

var exitCode = StartProcess(protocExe, protocArguments);
if (exitCode != 0)
{
Expand Down Expand Up @@ -225,4 +231,4 @@ public string GetSemanticVersionV2(string clearVersion)
var daysPart = (currentDate - new DateTime(2010, 01, 01)).Days;
var secondsPart = Math.Floor((currentDate - currentDate.Date).TotalSeconds/2);
return string.Format("{0}-dev.{1}.{2}", clearVersion, daysPart, secondsPart);
}
}

0 comments on commit 80c9fb1

Please sign in to comment.