From 8f9e3fe999358c5ab5372fb33fdd9dd46fb5fff9 Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Mon, 18 Jul 2022 12:49:21 -0700 Subject: [PATCH] Add build task to create dotnet tools for SQL Tools and Kusto services. (#1582) --- azure-pipelines/build.yml | 9 ++++++++- build.cake | 15 ++++++++++++++- build.json | 4 ++++ .../Microsoft.Kusto.ServiceLayer.csproj | 1 + .../Microsoft.SqlTools.ServiceLayer.csproj | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 0c1602f0..ef415d75 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -108,7 +108,14 @@ steps: inputs: filename: build.cmd arguments: '-target=dotnetpackpublished -mono' - continueOnError: true + +- task: BatchScript@1 + displayName: "Build and Package service tool projects" + env: + BUILD_DOTNET_TOOL: "true" + inputs: + filename: build.cmd + arguments: "-target=dotnetpackservicetools -mono" - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: 'ESRP Code Signing - Nuget Package' diff --git a/build.cake b/build.cake index f1c4f161..3b15753b 100644 --- a/build.cake +++ b/build.cake @@ -52,6 +52,7 @@ public class BuildPlan public string[] PackageProjects { get; set; } // The set of projects that we want to call dotnet pack on which require publishing being done first public string[] PackagePublishedProjects { get; set; } + public string[] DotnetToolProjects { get; set; } } var buildPlan = JsonConvert.DeserializeObject( @@ -273,7 +274,19 @@ Task("DotnetPackPublished") } }); - +/// +/// Packages dotnet tool projects specified in DotnetToolProjects. +/// +Task("DotnetPackServiceTools") + .Does(() => +{ + foreach (var project in buildPlan.DotnetToolProjects) + { + var outputFolder = System.IO.Path.Combine(nugetPackageFolder); + var projectFolder = System.IO.Path.Combine(sourceFolder, project); + DotnetPack(outputFolder, projectFolder, project); + } +}); /// /// Run all tests for .NET Desktop and .NET Core diff --git a/build.json b/build.json index 7e44525f..36f60e58 100644 --- a/build.json +++ b/build.json @@ -46,5 +46,9 @@ "runtime.ubuntu.16.04-x64.native.Microsoft.SqlToolsService", "runtime.win-x64.native.Microsoft.SqlToolsService", "runtime.osx-arm64.native.Microsoft.SqlToolsService" + ], + "DotnetToolProjects": [ + "Microsoft.SqlTools.ServiceLayer", + "Microsoft.Kusto.ServiceLayer" ] } \ No newline at end of file diff --git a/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj b/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj index f34bd37f..4643b8cf 100644 --- a/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj +++ b/src/Microsoft.Kusto.ServiceLayer/Microsoft.Kusto.ServiceLayer.csproj @@ -21,6 +21,7 @@ + .NET client Kusto Service application, usable as a dotnet tool. This package is intended to be used by internal applications only and should not be referenced directly. true $(AssemblyName) ./nupkg diff --git a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj index 0e74d77e..ce535c08 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj +++ b/src/Microsoft.SqlTools.ServiceLayer/Microsoft.SqlTools.ServiceLayer.csproj @@ -22,6 +22,7 @@ + .NET client SQL Tools Service application, usable as a dotnet tool. This package is intended to be used by internal applications only and should not be referenced directly. true $(AssemblyName) ./nupkg