From 2aff570634f1ab8d9d3969e56f7dad522ea05c2e Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Fri, 14 Jul 2017 19:18:23 +1000 Subject: [PATCH 1/2] build projects to build/output --- build/Elasticsearch.Net.nuspec | 12 ++++++------ build/NEST.nuspec | 12 ++++++------ build/scripts/Building.fsx | 4 +++- build/scripts/Documentation.fsx | 11 +++++------ build/scripts/Paths.fsx | 13 ++----------- build/scripts/Signing.fsx | 2 +- build/scripts/Versioning.fsx | 7 ++++--- src/CodeGeneration/ApiGenerator/ApiGenerator.csproj | 2 +- src/CodeGeneration/DocGenerator/DocGenerator.csproj | 3 ++- src/Elasticsearch.Net/Elasticsearch.Net.csproj | 3 ++- src/Nest/Nest.csproj | 2 +- src/Tests/Tests.csproj | 3 ++- src/outputpath.props | 2 +- 13 files changed, 36 insertions(+), 40 deletions(-) diff --git a/build/Elasticsearch.Net.nuspec b/build/Elasticsearch.Net.nuspec index 4db00fdd250..c79e36792dc 100644 --- a/build/Elasticsearch.Net.nuspec +++ b/build/Elasticsearch.Net.nuspec @@ -30,13 +30,13 @@ - - + + - - + + - - + + diff --git a/build/NEST.nuspec b/build/NEST.nuspec index 9a660a98bca..069d1d81eff 100644 --- a/build/NEST.nuspec +++ b/build/NEST.nuspec @@ -35,13 +35,13 @@ - - + + - - + + - - + + \ No newline at end of file diff --git a/build/scripts/Building.fsx b/build/scripts/Building.fsx index 60c31220cf8..eb92128f1a4 100644 --- a/build/scripts/Building.fsx +++ b/build/scripts/Building.fsx @@ -8,6 +8,7 @@ #load @"Versioning.fsx" open System +open System.IO open Fake open FSharp.Data @@ -41,6 +42,7 @@ module Build = "CurrentAssemblyFileVersion", (Versioning.CurrentAssemblyFileVersion.ToString()); "DoSourceLink", sourceLink; "DotNetCoreOnly", if buildingOnTravis then "1" else ""; + "OutputPathBaseDir", Path.GetFullPath Paths.BuildOutput; ] |> List.map (fun (p,v) -> sprintf "%s=%s" p v) |> String.concat ";" @@ -77,4 +79,4 @@ module Build = DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name)) | (_, _) -> - tracefn "Skiping clean target only run when calling 'release', 'canary', 'clean' as targets directly" + tracefn "Skipping clean target only run when calling 'release', 'canary', 'clean' as targets directly" diff --git a/build/scripts/Documentation.fsx b/build/scripts/Documentation.fsx index b4e3ab7383b..123ea0c2ec9 100644 --- a/build/scripts/Documentation.fsx +++ b/build/scripts/Documentation.fsx @@ -14,14 +14,13 @@ open Projects module Documentation = let Generate() = - let prefix = "CodeGeneration" - let generatorFolder = Paths.IncrementalOutputFolderWithPrefix prefix (PrivateProject PrivateProject.DocGenerator) DotNetFramework.Net46 - let generator = generatorFolder @@ "DocGenerator.exe" + let docGenerator = PrivateProject(DocGenerator) + let path = Paths.ProjectOutputFolder docGenerator DotNetFramework.Net46 + let generator = sprintf "%s/%s.exe" path docGenerator.Name ExecProcess (fun p -> - p.WorkingDirectory <- "src/CodeGeneration/DocGenerator" + p.WorkingDirectory <- Paths.Source("CodeGeneration") @@ docGenerator.Name p.FileName <- generator - ) - (TimeSpan.FromMinutes (1.0)) |> ignore + ) (TimeSpan.FromMinutes 1.) |> ignore // TODO: hook documentation validation into the process let Validate() = diff --git a/build/scripts/Paths.fsx b/build/scripts/Paths.fsx index 8bb06122c2e..be096f47e18 100644 --- a/build/scripts/Paths.fsx +++ b/build/scripts/Paths.fsx @@ -21,14 +21,8 @@ module Paths = let BuildOutput = sprintf "%s/output" BuildFolder let ProjectOutputFolder (project:DotNetProject) (framework:DotNetFramework) = - sprintf "%s/%s/%s" BuildOutput framework.Identifier.MSBuild project.Name - - let IncrementalOutputFolder (project:DotNetProject) (framework:DotNetFramework) = - sprintf "src/%s/bin/Release/%s" project.Name framework.Identifier.Nuget - - let IncrementalOutputFolderWithPrefix prefix (project:DotNetProject) (framework:DotNetFramework) = - sprintf "src/%s/%s/bin/Release/%s" prefix project.Name framework.Identifier.Nuget - + sprintf "%s/%s/%s" BuildOutput project.Name framework.Identifier.Nuget + let Tool tool = sprintf "packages/build/%s" tool let CheckedInToolsFolder = "build/Tools" let KeysFolder = sprintf "%s/keys" BuildFolder @@ -44,6 +38,3 @@ module Paths = let BinFolder(folder) = let f = replace @"\" "/" folder sprintf "%s/%s/bin/Release" SourceFolder f - - let ProjectJson(projectName) = - Source(sprintf "%s/project.json" projectName) diff --git a/build/scripts/Signing.fsx b/build/scripts/Signing.fsx index 6697df2be19..970edbbe760 100644 --- a/build/scripts/Signing.fsx +++ b/build/scripts/Signing.fsx @@ -42,7 +42,7 @@ module StrongName = for p in DotNetProject.AllPublishable do for f in DotNetFramework.All do let name = p.Name - let folder = Paths.IncrementalOutputFolder p f + let folder = Paths.ProjectOutputFolder p f let dll = sprintf "%s/%s.dll" folder name match fileExists dll with | true -> validate dll name diff --git a/build/scripts/Versioning.fsx b/build/scripts/Versioning.fsx index 1d76dc70075..4d0d9396693 100644 --- a/build/scripts/Versioning.fsx +++ b/build/scripts/Versioning.fsx @@ -43,12 +43,13 @@ module Versioning = let bv = getBuildParam "version" let buildVersion = if (isNullOrEmpty bv) then None else Some(parse(bv)) match (getBuildParam "target", buildVersion) with - | ("release", None) -> failwithf "can not run release because no explicit version number was passed on the command line" + | ("release", None) -> failwithf "cannot run release because no explicit version number was passed on the command line" | ("release", Some v) -> - if (currentVersion >= v) then failwithf "tried to create release %s but current version is already at %s" (v.ToString()) (currentVersion.ToString()) + // Warn if version is same as current version + if (currentVersion >= v) then traceImportant (sprintf "creating release %s when current version is already at %s" (v.ToString()) (currentVersion.ToString())) writeVersionIntoGlobalJson v v - | ("canary", Some v) -> failwithf "can not run canary release, expected no version number to specified but received %s" (v.ToString()) + | ("canary", Some v) -> failwithf "cannot run canary release, expected no version number to specified but received %s" (v.ToString()) | ("canary", None) -> let timestampedVersion = (sprintf "ci%s" (DateTime.UtcNow.ToString("MMddHHmmss"))) tracefn "Canary suffix %s " timestampedVersion diff --git a/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj b/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj index 684df9e0bf8..bd431fa07cf 100644 --- a/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj +++ b/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj @@ -6,7 +6,6 @@ alpha - @@ -17,4 +16,5 @@ + \ No newline at end of file diff --git a/src/CodeGeneration/DocGenerator/DocGenerator.csproj b/src/CodeGeneration/DocGenerator/DocGenerator.csproj index 1c56d79df07..0ba4dc625ee 100644 --- a/src/CodeGeneration/DocGenerator/DocGenerator.csproj +++ b/src/CodeGeneration/DocGenerator/DocGenerator.csproj @@ -18,4 +18,5 @@ - + + \ No newline at end of file diff --git a/src/Elasticsearch.Net/Elasticsearch.Net.csproj b/src/Elasticsearch.Net/Elasticsearch.Net.csproj index 380b8685ed1..8235ba12909 100644 --- a/src/Elasticsearch.Net/Elasticsearch.Net.csproj +++ b/src/Elasticsearch.Net/Elasticsearch.Net.csproj @@ -16,4 +16,5 @@ - + + \ No newline at end of file diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index 237086ee365..72deb39b453 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -18,5 +18,5 @@ - + \ No newline at end of file diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index e421a206053..84a03bb4e73 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -44,4 +44,5 @@ - \ No newline at end of file + + diff --git a/src/outputpath.props b/src/outputpath.props index bf850a0b52a..04e4b70743e 100644 --- a/src/outputpath.props +++ b/src/outputpath.props @@ -1,6 +1,6 @@ - $(OutputPathBaseDir)\$(TargetFrameworkVersion)\$(MSBuildProjectName)\ + $(OutputPathBaseDir)\$(MSBuildProjectName)\ \ No newline at end of file From 76b696c0e93e40352dd1a27ce8269d29570cb049 Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Fri, 14 Jul 2017 19:48:32 +1000 Subject: [PATCH 2/2] Parameterize JSON.Net dependency --- build/NEST.nuspec | 6 +++--- build/scripts/Releasing.fsx | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build/NEST.nuspec b/build/NEST.nuspec index 069d1d81eff..24287f6eea7 100644 --- a/build/NEST.nuspec +++ b/build/NEST.nuspec @@ -18,11 +18,11 @@ - + - + @@ -30,7 +30,7 @@ - + diff --git a/build/scripts/Releasing.fsx b/build/scripts/Releasing.fsx index fdf6268228e..0f347c07cf7 100644 --- a/build/scripts/Releasing.fsx +++ b/build/scripts/Releasing.fsx @@ -33,6 +33,11 @@ module Release = let year = sprintf "%i" DateTime.UtcNow.Year + let jsonDotNetVersion = 10 + + let jsonDotNetCurrentVersion = sprintf "%i" jsonDotNetVersion + let jsonDotNetNextVersion = sprintf "%i" (jsonDotNetVersion + 1) + let properties = let addKeyValue (e:Expr) (builder:StringBuilder) = // the binding for this tuple looks like key/value should @@ -46,6 +51,8 @@ module Release = new StringBuilder() |> addKeyValue <@nextMajorVersion@> |> addKeyValue <@year@> + |> addKeyValue <@jsonDotNetCurrentVersion@> + |> addKeyValue <@jsonDotNetNextVersion@> |> toText Tooling.Nuget.Exec [ "pack"; nuspec;