Skip to content

Commit 98ae32b

Browse files
authored
Build projects to build/output dir (#2806)
* build projects to build/output * Parameterize JSON.Net dependency
1 parent 67f7761 commit 98ae32b

14 files changed

+46
-43
lines changed

build/Elasticsearch.Net.nuspec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
</dependencies>
3131
</metadata>
3232
<files>
33-
<file src="..\src\Elasticsearch.Net\bin\Release\net45\Elasticsearch.Net.dll" target="lib\net45"/>
34-
<file src="..\src\Elasticsearch.Net\bin\Release\net45\Elasticsearch.Net.XML" target="lib\net45"/>
33+
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.dll" target="lib\net45"/>
34+
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.XML" target="lib\net45"/>
3535

36-
<file src="..\src\Elasticsearch.Net\bin\Release\net46\Elasticsearch.Net.dll" target="lib\net46"/>
37-
<file src="..\src\Elasticsearch.Net\bin\Release\net46\Elasticsearch.Net.XML" target="lib\net46"/>
36+
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.dll" target="lib\net46"/>
37+
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.XML" target="lib\net46"/>
3838

39-
<file src="..\src\Elasticsearch.Net\bin\Release\netstandard1.3\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
40-
<file src="..\src\Elasticsearch.Net\bin\Release\netstandard1.3\Elasticsearch.Net.xml" target="lib\netstandard1.3"/>
39+
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
40+
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.xml" target="lib\netstandard1.3"/>
4141
</files>
4242
</package>

build/NEST.nuspec

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,30 @@
1818
<dependencies>
1919
<group targetFramework=".NETFramework4.5">
2020
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
21-
<dependency id="Newtonsoft.Json" version="[10,11)" />
21+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
2222
</group>
2323
<group targetFramework=".NETFramework4.6">
2424
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
25-
<dependency id="Newtonsoft.Json" version="[10,11)" />
25+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
2626
</group>
2727
<group targetFramework=".NETStandard1.3">
2828
<dependency id="NETStandard.Library" version="[1.6.0, )" />
2929
<dependency id="System.Collections.Specialized" version="[4.3.0, )" />
3030
<dependency id="System.Reflection.TypeExtensions" version="[4.3.0, )" />
3131
<dependency id="System.Linq.Queryable" version="[4.0.1, )" />
3232
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
33-
<dependency id="Newtonsoft.Json" version="[10,11)" />
33+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
3434
</group>
3535
</dependencies>
3636
</metadata>
3737
<files>
38-
<file src="..\src\Nest\bin\Release\net45\Nest.dll" target="lib\net45"/>
39-
<file src="..\src\Nest\bin\Release\net45\Nest.XML" target="lib\net45"/>
38+
<file src="output\Nest\net45\Nest.dll" target="lib\net45"/>
39+
<file src="output\Nest\net45\Nest.XML" target="lib\net45"/>
4040

41-
<file src="..\src\Nest\bin\Release\net46\Nest.dll" target="lib\net46"/>
42-
<file src="..\src\Nest\bin\Release\net46\Nest.XML" target="lib\net46"/>
41+
<file src="output\Nest\net46\Nest.dll" target="lib\net46"/>
42+
<file src="output\Nest\net46\Nest.XML" target="lib\net46"/>
4343

44-
<file src="..\src\Nest\bin\Release\netstandard1.3\Nest.dll" target="lib\netstandard1.3"/>
45-
<file src="..\src\Nest\bin\Release\netstandard1.3\Nest.xml" target="lib\netstandard1.3"/>
44+
<file src="output\Nest\netstandard1.3\Nest.dll" target="lib\netstandard1.3"/>
45+
<file src="output\Nest\netstandard1.3\Nest.xml" target="lib\netstandard1.3"/>
4646
</files>
4747
</package>

build/scripts/Building.fsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#load @"Versioning.fsx"
99

1010
open System
11+
open System.IO
1112
open Fake
1213
open FSharp.Data
1314

@@ -41,6 +42,7 @@ module Build =
4142
"CurrentAssemblyFileVersion", (Versioning.CurrentAssemblyFileVersion.ToString());
4243
"DoSourceLink", sourceLink;
4344
"DotNetCoreOnly", if buildingOnTravis then "1" else "";
45+
"OutputPathBaseDir", Path.GetFullPath Paths.BuildOutput;
4446
]
4547
|> List.map (fun (p,v) -> sprintf "%s=%s" p v)
4648
|> String.concat ";"
@@ -77,4 +79,4 @@ module Build =
7779
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore
7880
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
7981
| (_, _) ->
80-
tracefn "Skiping clean target only run when calling 'release', 'canary', 'clean' as targets directly"
82+
tracefn "Skipping clean target only run when calling 'release', 'canary', 'clean' as targets directly"

build/scripts/Documentation.fsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ open Projects
1414
module Documentation =
1515

1616
let Generate() =
17-
let prefix = "CodeGeneration"
18-
let generatorFolder = Paths.IncrementalOutputFolderWithPrefix prefix (PrivateProject PrivateProject.DocGenerator) DotNetFramework.Net46
19-
let generator = generatorFolder @@ "DocGenerator.exe"
17+
let docGenerator = PrivateProject(DocGenerator)
18+
let path = Paths.ProjectOutputFolder docGenerator DotNetFramework.Net46
19+
let generator = sprintf "%s/%s.exe" path docGenerator.Name
2020
ExecProcess (fun p ->
21-
p.WorkingDirectory <- "src/CodeGeneration/DocGenerator"
21+
p.WorkingDirectory <- Paths.Source("CodeGeneration") @@ docGenerator.Name
2222
p.FileName <- generator
23-
)
24-
(TimeSpan.FromMinutes (1.0)) |> ignore
23+
) (TimeSpan.FromMinutes 1.) |> ignore
2524

2625
// TODO: hook documentation validation into the process
2726
let Validate() =

build/scripts/Paths.fsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@ module Paths =
2121
let BuildOutput = sprintf "%s/output" BuildFolder
2222

2323
let ProjectOutputFolder (project:DotNetProject) (framework:DotNetFramework) =
24-
sprintf "%s/%s/%s" BuildOutput framework.Identifier.MSBuild project.Name
25-
26-
let IncrementalOutputFolder (project:DotNetProject) (framework:DotNetFramework) =
27-
sprintf "src/%s/bin/Release/%s" project.Name framework.Identifier.Nuget
28-
29-
let IncrementalOutputFolderWithPrefix prefix (project:DotNetProject) (framework:DotNetFramework) =
30-
sprintf "src/%s/%s/bin/Release/%s" prefix project.Name framework.Identifier.Nuget
31-
24+
sprintf "%s/%s/%s" BuildOutput project.Name framework.Identifier.Nuget
25+
3226
let Tool tool = sprintf "packages/build/%s" tool
3327
let CheckedInToolsFolder = "build/Tools"
3428
let KeysFolder = sprintf "%s/keys" BuildFolder
@@ -44,6 +38,3 @@ module Paths =
4438
let BinFolder(folder) =
4539
let f = replace @"\" "/" folder
4640
sprintf "%s/%s/bin/Release" SourceFolder f
47-
48-
let ProjectJson(projectName) =
49-
Source(sprintf "%s/project.json" projectName)

build/scripts/Releasing.fsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module Release =
3333

3434
let year = sprintf "%i" DateTime.UtcNow.Year
3535

36+
let jsonDotNetVersion = 10
37+
38+
let jsonDotNetCurrentVersion = sprintf "%i" jsonDotNetVersion
39+
let jsonDotNetNextVersion = sprintf "%i" (jsonDotNetVersion + 1)
40+
3641
let properties =
3742
let addKeyValue (e:Expr<string>) (builder:StringBuilder) =
3843
// the binding for this tuple looks like key/value should
@@ -46,6 +51,8 @@ module Release =
4651
new StringBuilder()
4752
|> addKeyValue <@nextMajorVersion@>
4853
|> addKeyValue <@year@>
54+
|> addKeyValue <@jsonDotNetCurrentVersion@>
55+
|> addKeyValue <@jsonDotNetNextVersion@>
4956
|> toText
5057

5158
Tooling.Nuget.Exec [ "pack"; nuspec;

build/scripts/Signing.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module StrongName =
4242
for p in DotNetProject.AllPublishable do
4343
for f in DotNetFramework.All do
4444
let name = p.Name
45-
let folder = Paths.IncrementalOutputFolder p f
45+
let folder = Paths.ProjectOutputFolder p f
4646
let dll = sprintf "%s/%s.dll" folder name
4747
match fileExists dll with
4848
| true -> validate dll name

build/scripts/Versioning.fsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ module Versioning =
4343
let bv = getBuildParam "version"
4444
let buildVersion = if (isNullOrEmpty bv) then None else Some(parse(bv))
4545
match (getBuildParam "target", buildVersion) with
46-
| ("release", None) -> failwithf "can not run release because no explicit version number was passed on the command line"
46+
| ("release", None) -> failwithf "cannot run release because no explicit version number was passed on the command line"
4747
| ("release", Some v) ->
48-
if (currentVersion >= v) then failwithf "tried to create release %s but current version is already at %s" (v.ToString()) (currentVersion.ToString())
48+
// Warn if version is same as current version
49+
if (currentVersion >= v) then traceImportant (sprintf "creating release %s when current version is already at %s" (v.ToString()) (currentVersion.ToString()))
4950
writeVersionIntoGlobalJson v
5051
v
51-
| ("canary", Some v) -> failwithf "can not run canary release, expected no version number to specified but received %s" (v.ToString())
52+
| ("canary", Some v) -> failwithf "cannot run canary release, expected no version number to specified but received %s" (v.ToString())
5253
| ("canary", None) ->
5354
let timestampedVersion = (sprintf "ci%s" (DateTime.UtcNow.ToString("MMddHHmmss")))
5455
tracefn "Canary suffix %s " timestampedVersion

src/CodeGeneration/ApiGenerator/ApiGenerator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<VersionSuffix>alpha</VersionSuffix>
77
</PropertyGroup>
88
<ItemGroup>
9-
<ProjectReference Include="..\..\Nest\Nest.csproj" />
109
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
1110
<PackageReference Include="RazorMachine" Version="2.6.1" />
1211
<!-- TODO the following packages prevent us to jump to netcoreapp1.0 -->
@@ -17,4 +16,5 @@
1716
<Folder Include="RestSpecification\XPack\Info" />
1817
<Folder Include="RestSpecification\XPack\MachineLearning" />
1918
</ItemGroup>
19+
<Import Project="..\..\outputpath.props" />
2020
</Project>

src/CodeGeneration/DocGenerator/DocGenerator.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
1919
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
2020
</ItemGroup>
21-
</Project>
21+
<Import Project="..\..\outputpath.props" />
22+
</Project>

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
1717
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
1818
</ItemGroup>
19-
</Project>
19+
<Import Project="..\outputpath.props" />
20+
</Project>

src/Nest/Nest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
1919
<PackageReference Include="System.Linq.Queryable" Version="4.0.1" />
2020
</ItemGroup>
21-
<!--<Import Project="..\..\.paket\Paket.Restore.targets" />-->
21+
<Import Project="..\outputpath.props" />
2222
</Project>

src/Tests/Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
<ItemGroup>
4545
<EmbeddedResource Include="Document\Single\Attachment\Attachment_Test_Document.pdf" />
4646
</ItemGroup>
47-
</Project>
47+
<Import Project="..\outputpath.props" />
48+
</Project>

src/outputpath.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<OutputPath Condition="'$(OutputPathBaseDir)' != ''">$(OutputPathBaseDir)\$(TargetFrameworkVersion)\$(MSBuildProjectName)\</OutputPath>
4+
<OutputPath Condition="'$(OutputPathBaseDir)' != ''">$(OutputPathBaseDir)\$(MSBuildProjectName)\</OutputPath>
55
</PropertyGroup>
66
</Project>

0 commit comments

Comments
 (0)