diff --git a/Directory.Build.props b/Directory.Build.props index b486d4f4..7a5a3434 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,8 +3,26 @@ true true net6.0 - - + $(MSBuildThisFileDirectory) + + + 1 + 0 + 0.0 + false + + + $(Major).0.0.0 + + + + + $(Major).$(Minor).$(Build_BuildNumber) + $(Major).$(Minor).0 + preview + $(VersionPrefix)-$(VersionSuffix) + version=$(PackageVersion) + win-x64;win-x86;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;osx.10.11-x64;osx-x64;osx-arm64;linux-x64 true true diff --git a/Packages.props b/Packages.props index 882c9ca6..73287fa1 100644 --- a/Packages.props +++ b/Packages.props @@ -1,13 +1,10 @@ - - - @@ -20,8 +17,6 @@ - - @@ -34,6 +29,7 @@ + @@ -47,4 +43,13 @@ + + + + + + + + diff --git a/SQL2003.snk b/SQL2003.snk new file mode 100644 index 00000000..dde1f6b9 Binary files /dev/null and b/SQL2003.snk differ diff --git a/azure-pipelines/build-and-release.yml b/azure-pipelines/build-and-release.yml index 513e066a..0fbf7864 100644 --- a/azure-pipelines/build-and-release.yml +++ b/azure-pipelines/build-and-release.yml @@ -3,6 +3,18 @@ pr: none stages: - stage: Build + variables: + - name: buildConfiguration + value: 'Release' + # Major version number for the release + - name: Major + value: '3' + # Minor version number for the release (should be incremented post a stable release) + - name: Minor + value: '0' + # Set to true to build a stable release. + - name: StableRelease + value: 'false' jobs: - job: Build pool: diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 362e405f..98dc5f71 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,7 +9,7 @@ steps: inputs: filename: build.cmd arguments: '-target=all -mono' - + - task: DotNetCoreCLI@2 displayName: 'dotnet restore test/Microsoft.SqlTools.ServiceLayer.UnitTests' inputs: @@ -49,6 +49,27 @@ steps: codeCoverageTool: 'Cobertura' summaryFileLocation: '$(Agent.TempDirectory)/coverlet/reports/Cobertura.xml' +- task: PowerShell@2 + displayName: 'Generate Nuspec Version' + inputs: + targetType: 'inline' + script: | + $propsFile = '$(Build.SourcesDirectory)\Directory.Build.Props' + $props = New-Object XML + $props.Load($propsFile) + $propGroup = $props.Project.PropertyGroup; + $versionPre = $env:Major + '.' + $env:Minor + '.' + if($env:StableRelease.Equals('true')) { + $version = $versionPre + '0'; + } else { + $version = $versionPre + $(Build.BuildNumber) + '-' + $propGroup.VersionSuffix.'#text' + } + $nuspecFile = '$(Build.SourcesDirectory)\packages\Microsoft.SqlTools.ManagedBatchParser\Microsoft.SqlTools.ManagedBatchParser.nuspec' + $nuspec = New-Object XML + $nuspec.Load($nuspecFile) + $nuspec.package.metadata.version = $version; + $nuspec.Save($nuspecFile) + - task: Npm@1 displayName: 'npm install -g gulp-cli' inputs: @@ -56,6 +77,33 @@ steps: verbose: false customCommand: 'install -g gulp-cli' +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP CodeSigning - SNK only' + inputs: + ConnectedServiceName: 'Code Signing' + FolderPath: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/default/net472/' + Pattern: 'Microsoft.SqlTools.ManagedBatchParser.dll' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "KeyCode" : "CP-235847-SN", + "operationSetCode" : "StrongNameSign", + "Parameters" : [], + "ToolName" : "sign", + "ToolVersion" : "1.0" + }, + { + "KeyCode" : "CP-235847-SN", + "operationSetCode" : "StrongNameVerify", + "Parameters" : [], + "ToolName" : "sign", + "ToolVersion" : "1.0" + } + ] + SessionTimeout: 600 + MaxConcurrency: 5 + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 displayName: 'ESRP CodeSigning - sha256 only' inputs: @@ -114,7 +162,7 @@ steps: inputs: filename: build.cmd arguments: '-target=dotnetpackpublished -mono' - + - task: BatchScript@1 displayName: "Build and Package service tool projects" env: diff --git a/build.cake b/build.cake index 85d7c6c2..ba7b9ee0 100644 --- a/build.cake +++ b/build.cake @@ -17,6 +17,7 @@ using XliffParser; // Basic arguments var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); + // Optional arguments var testConfiguration = Argument("test-configuration", "Debug"); var installFolder = Argument("install-path", System.IO.Path.Combine(Environment.GetEnvironmentVariable(IsRunningOnWindows() ? "USERPROFILE" : "HOME"), @@ -36,6 +37,8 @@ var shellExtension = IsRunningOnWindows() ? "ps1" : "sh"; /// public class BuildPlan { + public string[] FxBuildProjects { get; set; } + public string[] FxFrameworks { get; set; } public IDictionary TestProjects { get; set; } public string BuildToolsFolder { get; set; } public string ArtifactsFolder { get; set; } @@ -62,6 +65,7 @@ var buildPlan = JsonConvert.DeserializeObject( var dotnetFolder = System.IO.Path.Combine(workingDirectory, buildPlan.DotNetFolder); var dotnetcli = buildPlan.UseSystemDotNetPath ? "dotnet" : System.IO.Path.Combine(System.IO.Path.GetFullPath(dotnetFolder), "dotnet"); var toolsFolder = System.IO.Path.Combine(workingDirectory, buildPlan.BuildToolsFolder); +var nugetcli = System.IO.Path.Combine(toolsFolder, "nuget.exe"); var sourceFolder = System.IO.Path.Combine(workingDirectory, "src"); var testFolder = System.IO.Path.Combine(workingDirectory, "test"); @@ -216,6 +220,7 @@ Task("Restore") Task("BuildTest") .IsDependentOn("Setup") .IsDependentOn("Restore") + .IsDependentOn("BuildFx") .Does(() => { foreach (var pair in buildPlan.TestProjects) @@ -239,6 +244,33 @@ Task("BuildTest") } }); +/// +/// Build .NET Framework projects. +/// +Task("BuildFx") + .IsDependentOn("Setup") + .IsDependentOn("Restore") + .Does(() => +{ + foreach (var project in buildPlan.FxBuildProjects) + { + foreach (var framework in buildPlan.FxFrameworks) + { + var projectFolder = System.IO.Path.Combine(sourceFolder, project); + var logPath = System.IO.Path.Combine(logFolder, $"{project}-{framework}-build.log"); + using (var logWriter = new StreamWriter(logPath)) { + Run(dotnetcli, $"build --framework {framework} --configuration {configuration} \"{projectFolder}\"", + new RunOptions + { + StandardOutputWriter = logWriter, + StandardErrorWriter = logWriter + }) + .ExceptionOnError($"Building test {project} failed for {framework}. See {logPath} for more details."); + } + } + } +}); + /// /// Packages projects specified in PackageProjects /// @@ -263,6 +295,7 @@ Task("DotnetPack") /// currently. /// Task("DotnetPackPublished") + .IsDependentOn("DotnetPackNuspec") .Does(() => { foreach (var project in buildPlan.PackagePublishedProjects) @@ -274,6 +307,23 @@ Task("DotnetPackPublished") } }); +/// +/// Packages projects specified in FxBuildProjects using available Nupecs, these projects require that publishing be done first. Note that we +/// don't do the publishing here because we need the binaries to be signed before being packaged up and that is done by the pipeline +/// currently. +/// +Task("DotnetPackNuspec") + .Does(() => +{ + foreach (var project in buildPlan.FxBuildProjects) + { + // For now, putting all nugets in the 1 directory + var outputFolder = System.IO.Path.Combine(nugetPackageFolder); + var projectFolder = System.IO.Path.Combine(packagesFolder, project); + DotnetPackNuspec(outputFolder, projectFolder, project); + } +}); + /// /// Packages dotnet tool projects specified in DotnetToolProjects. /// @@ -407,6 +457,19 @@ Task("OnlyPublish") } } + if (buildPlan.FxBuildProjects.Contains(project)) + { + foreach(var framework in buildPlan.FxFrameworks) + { + var outputFolder = System.IO.Path.Combine(publishFolder, packageName, "default", framework); + var publishArguments = "publish"; + publishArguments = $"{publishArguments} --framework {framework} --configuration {configuration}"; + publishArguments = $"{publishArguments} --output \"{outputFolder}\" \"{projectFolder}\""; + Run(dotnetcli, publishArguments) + .ExceptionOnError($"Failed to publish {project} / {framework}"); + } + } + if (requireArchive) { foreach (var framework in buildPlan.Frameworks) diff --git a/build.json b/build.json index 36f60e58..ebe1eb05 100644 --- a/build.json +++ b/build.json @@ -24,11 +24,19 @@ "Frameworks": [ "net6.0" ], + "FxFrameworks":[ + "net472", + "net6.0" + ], "MainProjects": [ "Microsoft.SqlTools.Credentials", "Microsoft.SqlTools.ResourceProvider", "Microsoft.Kusto.ServiceLayer", - "Microsoft.SqlTools.ServiceLayer" + "Microsoft.SqlTools.ServiceLayer", + "Microsoft.SqlTools.ManagedBatchParser" + ], + "FxBuildProjects": [ + "Microsoft.SqlTools.ManagedBatchParser" ], "PackageProjects": [ "Microsoft.SqlTools.Hosting" diff --git a/packages/Directory.Build.props b/packages/Directory.Build.props index 4b7afc25..06169e9a 100644 --- a/packages/Directory.Build.props +++ b/packages/Directory.Build.props @@ -9,12 +9,6 @@ $(MSBuildThisFileDirectory) - - - 3.0.0-release.200 MIT images\sqlserver.png diff --git a/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec b/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec new file mode 100644 index 00000000..32bb2d46 --- /dev/null +++ b/packages/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.nuspec @@ -0,0 +1,60 @@ + + + + Microsoft.SqlTools.ManagedBatchParser + 1.0.0 + Microsoft + https://github.com/Microsoft/sqltoolsservice/ + MIT + http://s.gravatar.com/avatar/6f39d8562df0a3509a8240fb281bc5bd?s=80 + false + Managed Batch parser for Sql Tools Services. + © Microsoft Corporation. All rights reserved. + SQL Tools XPLAT Managed Batch Parser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/runhelpers.cake b/scripts/runhelpers.cake index 37682fc8..4b9d4d52 100644 --- a/scripts/runhelpers.cake +++ b/scripts/runhelpers.cake @@ -232,5 +232,19 @@ public void DotnetPack(string outputFolder, string projectFolder, string project }) .ExceptionOnError($"Packaging {project} failed. See {logPath} for details."); } +} + +public void DotnetPackNuspec(string outputFolder, string projectFolder, string project) { + var logPath = System.IO.Path.Combine(logFolder, $"{project}-pack.log"); + using (var logWriter = new StreamWriter(logPath)) { + Information($"Packaging {projectFolder}"); + Run(nugetcli, $"pack {projectFolder}\\{project}.nuspec -OutputDirectory {outputFolder}", + new RunOptions + { + StandardOutputWriter = logWriter, + StandardErrorWriter = logWriter + }) + .ExceptionOnError($"Packaging {project} failed. See {logPath} for details."); + } } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 82e9d387..60d009bb 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,17 +2,15 @@ Microsoft Corporation - Microsoft SQL Server - - - 1.1.2 - + Microsoft Sql Tools Microsoft + true + true false - © Microsoft Corporation. All rights reserved. - https://github.com/Microsoft/sqltoolsservice/blob/master/license.txt + Copyright © Microsoft Corporation. All rights reserved. + https://github.com/Microsoft/sqltoolsservice/blob/main/license.txt http://s.gravatar.com/avatar/6f39d8562df0a3509a8240fb281bc5bd?s=80 https://github.com/Microsoft/sqltoolsservice/ SQL XPLAT diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj b/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj index 7a086312..3bcd270d 100644 --- a/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj +++ b/src/Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj @@ -4,9 +4,15 @@ net6.0;net472 9.0 disable - false + Microsoft.SqlTools.ManagedBatchParser + 82dd9738-2ad3-4eb3-9f80-18b594e03621 + True + + True + $(RootDir)\SQL2003.snk false false + Microsoft SqlTools Managed batch parser @@ -14,6 +20,7 @@ + @@ -21,4 +28,12 @@ + + + + + + + + diff --git a/src/Microsoft.SqlTools.ManagedBatchParser/Properties/AssemblyInfo.cs b/src/Microsoft.SqlTools.ManagedBatchParser/Properties/AssemblyInfo.cs deleted file mode 100644 index 6e3b8ed3..00000000 --- a/src/Microsoft.SqlTools.ManagedBatchParser/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Microsoft.SqlTools.ManagedBatchParser")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Microsoft.SqlTools.ManagedBatchParser")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("82dd9738-2ad3-4eb3-9f80-18b594e03621")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: InternalsVisibleTo("Microsoft.SqlTools.ServiceLayer.UnitTests")] -[assembly: InternalsVisibleTo("Microsoft.SqlTools.ServiceLayer.IntegrationTests")] -[assembly: InternalsVisibleTo("Microsoft.SqlTools.ServiceLayer.Test.Common")] -[assembly: InternalsVisibleTo("MicrosoftSqlToolsServiceLayer")] -[assembly: InternalsVisibleTo("MicrosoftKustoServiceLayer")] -[assembly: InternalsVisibleTo("Microsoft.SqlTools.ManagedBatchParser.IntegrationTests")] \ No newline at end of file