From f228b1d4d9e87f1547b0c6dc140702bfa3a8ca62 Mon Sep 17 00:00:00 2001 From: "Dmitriy.Novikov" <112627421+DmitriyNovikov89@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:00:01 +0300 Subject: [PATCH] Update build.cake --- build.cake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 54301a53..987f294b 100644 --- a/build.cake +++ b/build.cake @@ -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"); @@ -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 @@ -156,6 +157,11 @@ public void CompileProtoFiles(IEnumerable 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) { @@ -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); -} \ No newline at end of file +}