Skip to content

Feature/clean deps #3071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions build/Clients.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
<CurrentVersion>0.0.0-bad</CurrentVersion>
<CurrentAssemblyVersion>0.0.0</CurrentAssemblyVersion>
<CurrentAssemblyFileVersion>0.0.0.0</CurrentAssemblyFileVersion>
<!-- 'dotnet xunit' does a build but has no way to pass properties or prevent build so we snoop for TRAVIS here
Ideally we handle this in the FAKE script (which we do for 'dotnet build')
TODO too lazy to write and test a <CHOOSE>
-->
<DotNetCoreOnly Condition="'$(TRAVIS)'=='true'">1</DotNetCoreOnly>
<DotNetCoreOnly Condition="'$(TRAVIS)'==''"></DotNetCoreOnly>
<DoSourceLink></DoSourceLink>


<!-- Version and Informational reflect actual version -->
<Version>$(CurrentVersion)</Version>
<InformationalVersion>$(CurrentVersion)</InformationalVersion>
Expand All @@ -21,15 +14,17 @@
<!-- File version reflects actual version number without prelease since that not allowed in its struct -->
<FileVersion>$(CurrentAssemblyFileVersion)</FileVersion>

<SignAssembly Condition="'$(DotNetCoreOnly)'==''">true</SignAssembly>
<AssemblyOriginatorKeyFile Condition="'$(DotNetCoreOnly)'==''">$(MSBuildThisFileDirectory)\keys\keypair.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile Condition="'$(DotNetCoreOnly)'==''">true</GenerateDocumentationFile>
<SignAssembly Condition="'$(OS)' == 'Windows_NT'">true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\keys\keypair.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1591,1572,1571,1573,1587,1570</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants Condition="'$(TargetFramework)'=='netstandard1.3' OR '$(DotNetCoreOnly)'=='1'">$(DefineConstants);DOTNETCORE</DefineConstants>
<DebugType Condition="'$(DotNetCoreOnly)'==''">embedded</DebugType>
<DebugType Condition="'$(Configuration)'=='Debug'">full</DebugType>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>

<DoSourceLink></DoSourceLink>
<SourceLink Condition="'$(DoSourceLink)'!=''">$(BaseIntermediateOutputPath)\sl-$(MsBuildProjectName)-$(TargetFramework).json</SourceLink>

<RepoUri>https://raw.githubusercontent.com/elastic/elasticsearch-net</RepoUri>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Elasticsearch.Net.Connections.HttpWebRequestConnection</id>
<version>$version$</version>
<title>Elasticsearch.Net HttpWebRequestConnection - Legacy IConnection implementation</title>
<authors>Elastic and contributors</authors>
<owners>Elastic</owners>
<licenseUrl>https://github.com/elastic/elasticsearch-net/blob/master/license.txt</licenseUrl>
<projectUrl>https://github.com/elastic/elasticsearch-net</projectUrl>
<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Elasticsearch.Net</description>
<summary>An IConnection implemenation for Elasticsearch.Net and NEST that still utilizes HttpWebRequest and ServicePoints to call Elasticsearch</summary>
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
<copyright>2014-$year$ Elasticsearch BV</copyright>
<tags>elasticsearch,elastic,search,lucene,nest</tags>
<dependencies>
<group targetFramework="net46">
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
</group>
</dependencies>
</metadata>
<files>
<file src="output\Elasticsearch.Net.Connections.HttpWebRequestConnection\net46\Elasticsearch.Net.Connections.HttpWebRequestConnection.dll" target="lib\net46"/>
<file src="output\Elasticsearch.Net.Connections.HttpWebRequestConnection\net46\Elasticsearch.Net.Connections.HttpWebRequestConnection.xml" target="lib\net46"/>
</files>
</package>
8 changes: 0 additions & 8 deletions build/Elasticsearch.Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
<copyright>2014-$year$ Elasticsearch BV</copyright>
<tags>elasticsearch,elastic,search,lucene,nest</tags>
<dependencies>
<group targetFramework=".NETFramework4.5" />
<group targetFramework=".NETFramework4.6" />
<group targetFramework=".NETStandard1.3">
<dependency id="NETStandard.Library" version="[1.6.0, )" />
<dependency id="System.Collections.Specialized" version="[4.3.0, )" />
Expand All @@ -30,12 +28,6 @@
</dependencies>
</metadata>
<files>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.dll" target="lib\net45"/>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.XML" target="lib\net45"/>

<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.dll" target="lib\net46"/>
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.XML" target="lib\net46"/>

<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.xml" target="lib\netstandard1.3"/>
</files>
Expand Down
14 changes: 0 additions & 14 deletions build/NEST.JsonNetSerializer.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
<copyright>2017-$year$ Elasticsearch BV</copyright>
<tags>elasticsearch,elastic,search,lucene,nest,serializer,json</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
</group>
<group targetFramework=".NETFramework4.6">
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="NETStandard.Library" version="[1.6.0, )" />
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
Expand All @@ -32,12 +24,6 @@
</dependencies>
</metadata>
<files>
<file src="output\Nest.JsonNetSerializer\net45\Nest.JsonNetSerializer.dll" target="lib\net45"/>
<file src="output\Nest.JsonNetSerializer\net45\Nest.JsonNetSerializer.XML" target="lib\net45"/>

<file src="output\Nest.JsonNetSerializer\net46\Nest.JsonNetSerializer.dll" target="lib\net46"/>
<file src="output\Nest.JsonNetSerializer\net46\Nest.JsonNetSerializer.XML" target="lib\net46"/>

<file src="output\Nest.JsonNetSerializer\netstandard1.3\Nest.JsonNetSerializer.dll" target="lib\netstandard1.3"/>
<file src="output\Nest.JsonNetSerializer\netstandard1.3\Nest.JsonNetSerializer.xml" target="lib\netstandard1.3"/>
</files>
Expand Down
12 changes: 0 additions & 12 deletions build/NEST.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
<copyright>2014-$year$ Elasticsearch BV</copyright>
<tags>elasticsearch,elastic,search,lucene,nest</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
</group>
<group targetFramework=".NETFramework4.6">
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
<dependency id="NETStandard.Library" version="[1.6.0, )" />
Expand All @@ -38,12 +32,6 @@
</dependencies>
</metadata>
<files>
<file src="output\Nest\net45\Nest.dll" target="lib\net45"/>
<file src="output\Nest\net45\Nest.XML" target="lib\net45"/>

<file src="output\Nest\net46\Nest.dll" target="lib\net46"/>
<file src="output\Nest\net46\Nest.XML" target="lib\net46"/>

<file src="output\Nest\netstandard1.3\Nest.dll" target="lib\netstandard1.3"/>
<file src="output\Nest\netstandard1.3\Nest.xml" target="lib\netstandard1.3"/>
</files>
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions build/scripts/Benchmarking.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ module Benchmarker =
DotNetCli.RunCommand(fun p ->
{ p with
WorkingDir = testsProjectDirectory
}) "run -f net46 -c Release Benchmark"
}) "run -f netcoreapp2.0 -c Release Benchmark"
else
DotNetCli.RunCommand(fun p ->
{ p with
WorkingDir = testsProjectDirectory
}) "run -f net46 -c Release Benchmark non-interactive"
}) "run -f netcoreapp2.0 -c Release Benchmark non-interactive"
finally
// running benchmarks can timeout so clean up any generated benchmark files
let benchmarkOutputFiles =
Expand Down
9 changes: 4 additions & 5 deletions build/scripts/Building.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,23 @@ module Build =
type private GlobalJson = JsonProvider<"../../global.json">
let private pinnedSdkVersion = GlobalJson.GetSample().Sdk.Version
if isMono then setProcessEnvironVar "TRAVIS" "true"

let private buildingOnTravis = getEnvironmentVarAsBool "TRAVIS"

let private sln = sprintf "src/Elasticsearch%s.sln" (if buildingOnTravis then ".DotNetCoreOnly" else "")
let private sln = "src/Elasticsearch.sln"

let private compileCore incremental =
if not (DotNetCli.isInstalled()) then failwith "You need to install the dotnet command line SDK to build for .NET Core"
let runningSdkVersion = DotNetCli.getVersion()
if (runningSdkVersion <> pinnedSdkVersion) then failwithf "Attempting to run with dotnet.exe with %s but global.json mandates %s" runningSdkVersion pinnedSdkVersion
let incrementalFramework = DotNetFramework.Net45
let incrementalFramework = DotNetFramework.NetStandard1_3
let sourceLink = if not incremental && not isMono && runningRelease then "1" else ""
let props =
[
"CurrentVersion", (Versioning.CurrentVersion.ToString());
"CurrentAssemblyVersion", (Versioning.CurrentAssemblyVersion.ToString());
"CurrentAssemblyFileVersion", (Versioning.CurrentAssemblyFileVersion.ToString());
"DoSourceLink", sourceLink;
"DotNetCoreOnly", if buildingOnTravis then "1" else "";
"FakeBuild", "1";
"OutputPathBaseDir", Path.GetFullPath Paths.BuildOutput;
]
|> List.map (fun (p,v) -> sprintf "%s=%s" p v)
Expand Down Expand Up @@ -153,7 +152,7 @@ module Build =
trace "Finished rewriting namespaces"

let private ilRepackInternal() =
let fw = if isMono then [DotNetFramework.NetStandard1_3] else DotNetFramework.All
let fw = DotNetFramework.All
for f in fw do
let nest = Project Project.Nest
let folder = Paths.ProjectOutputFolder nest f
Expand Down
15 changes: 9 additions & 6 deletions build/scripts/Commandline.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ NOTE: both the `test` and `integrate` targets can be suffixed with `-all` to for

Execution hints can be provided anywhere on the command line
- skiptests : skip running tests as part of the target chain
- source_serialization : force tests to use a client with custom source serialization
- skipdocs : skip generating documentation
- seed:<N> : provide a seed to run the tests with.
- random:<K><:B> : sets random K to bool B if if B is ommitted will default to true
K can be: sourceserializer, typedkeys or oldconnection (only valid on windows)
"""

module Commandline =
Expand All @@ -44,7 +46,7 @@ module Commandline =
let private args = getBuildParamOrDefault "cmdline" "build" |> split ' '

let skipTests = args |> List.exists (fun x -> x = "skiptests")
let skipDocs = args |> List.exists (fun x -> x = "skipdocs") || isMono
let skipDocs = args |> List.exists (fun x -> x = "skipdocs")
let seed =
match args |> List.tryFind (fun x -> x.StartsWith("seed:")) with
| Some t -> t.Replace("seed:", "")
Expand All @@ -59,17 +61,17 @@ module Commandline =
args
|> List.filter (
fun x ->
x <> "skiptests" && x <> "skipdocs" && x <> "source_serialization" && not (x.StartsWith("seed:")) && not (x.StartsWith("random:"))
x <> "skiptests" && x <> "skipdocs" && not (x.StartsWith("seed:")) && not (x.StartsWith("random:"))
)

let multiTarget =
match (filteredArgs |> List.tryHead) with
| Some t when t.EndsWith("-all") -> MultiTarget.All
| _ -> MultiTarget.One
| Some t when t.EndsWith("-one") -> MultiTarget.One
| _ -> MultiTarget.All

let target =
match (filteredArgs |> List.tryHead) with
| Some t -> t.Replace("-all", "")
| Some t -> t.Replace("-one", "")
| _ -> "build"

let validMonoTarget =
Expand Down Expand Up @@ -203,6 +205,7 @@ module Commandline =
setBuildParam "first" firstVersionOrPath
setBuildParam "second" secondVersionOrPath

| ["touch"; ] -> ignore()
| ["temp"; ] -> ignore()
| ["canary"; ] -> ignore()
| ["canary"; apiKey ] ->
Expand Down
13 changes: 7 additions & 6 deletions build/scripts/Documentation.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ module Documentation =

let Generate() =
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 <- Paths.Source("CodeGeneration") @@ docGenerator.Name
p.FileName <- generator
) (TimeSpan.FromMinutes 3.) |> ignore
let path = Paths.ProjectOutputFolder docGenerator DotNetFramework.NetCoreApp2_0
let generator = sprintf "%s.dll" docGenerator.Name

DotNetCli.RunCommand(fun p ->
{ p with
WorkingDir = path
}) generator

// TODO: hook documentation validation into the process
let Validate() =
Expand Down
1 change: 1 addition & 0 deletions build/scripts/Paths.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module Paths =
match project with
| Project p ->
match p with
| ElasticsearchNetHttpWebRequestConnection -> sprintf "%s/Connections/%s/%s.csproj" SourceFolder project.Name project.Name
| NestJsonNetSerializer -> sprintf "%s/Serializers/%s/%s.csproj" SourceFolder project.Name project.Name
| _ -> sprintf "%s/%s/%s.csproj" SourceFolder project.Name project.Name
| PrivateProject p ->
Expand Down
23 changes: 15 additions & 8 deletions build/scripts/Projects.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@ module Projects =
type DotNetFrameworkIdentifier = { MSBuild: string; Nuget: string; DefineConstants: string; }

type DotNetFramework =
| Net45
| Net46
| NetStandard1_3
| NetCoreApp1_1
static member All = [Net45; Net46; NetStandard1_3]
| NetCoreApp2_0
static member All = [NetStandard1_3]
member this.Identifier =
match this with
| Net45 -> { MSBuild = "v4.5"; Nuget = "net45"; DefineConstants = if not isMono then "TRACE;NET45" else "NET45"; }
| Net46 -> { MSBuild = "v4.6"; Nuget = "net46"; DefineConstants = if not isMono then "TRACE;NET46" else "NET46"; }
| NetStandard1_3 -> { MSBuild = "netstandard1.3"; Nuget = "netstandard1.3"; DefineConstants = if not isMono then "TRACE;DOTNETCORE" else "DOTNETCORE"; }
| NetCoreApp1_1 -> { MSBuild = "netcoreapp1.1"; Nuget = "netcoreapp1.1"; DefineConstants = if not isMono then "TRACE;DOTNETCORE" else "DOTNETCORE"; }
| Net46 -> { MSBuild = "v4.6"; Nuget = "net46"; DefineConstants = ""; }
| NetStandard1_3 -> { MSBuild = "netstandard1.3"; Nuget = "netstandard1.3"; DefineConstants = ""; }
| NetCoreApp2_0 -> { MSBuild = "netcoreapp2.0"; Nuget = "netcoreapp2.0"; DefineConstants = ""; }

type Project =
| Nest
| ElasticsearchNet
| NestJsonNetSerializer
| ElasticsearchNetHttpWebRequestConnection

type PrivateProject =
| Tests
Expand All @@ -43,11 +42,18 @@ module Projects =
seq [
Project Project.ElasticsearchNet;
Project Project.Nest;
Project Project.NestJsonNetSerializer;
Project ElasticsearchNetHttpWebRequestConnection;
PrivateProject PrivateProject.Tests
]

static member AllPublishable =
seq [Project Project.ElasticsearchNet; Project Project.Nest; Project Project.NestJsonNetSerializer;]
seq [
Project Project.ElasticsearchNet;
Project Project.Nest;
Project Project.NestJsonNetSerializer;
Project ElasticsearchNetHttpWebRequestConnection;
]
static member Tests = seq [PrivateProject PrivateProject.Tests;]

member this.Name =
Expand All @@ -57,6 +63,7 @@ module Projects =
| Nest -> "Nest"
| ElasticsearchNet -> "Elasticsearch.Net"
| NestJsonNetSerializer -> "Nest.JsonNetSerializer"
| ElasticsearchNetHttpWebRequestConnection -> "Elasticsearch.Net.Connections.HttpWebRequestConnection"
| PrivateProject p ->
match p with
| Tests -> "Tests"
Expand Down
11 changes: 8 additions & 3 deletions build/scripts/Targets.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ open Differ.Differ

Commandline.parse()

Target "Touch" <| fun _ -> traceHeader "Touching build"
Target "Build" <| fun _ -> traceHeader "STARTING BUILD"
Target "Start" <| fun _ ->
match (isMono, Commandline.validMonoTarget) with
Expand Down Expand Up @@ -78,7 +79,10 @@ Target "Release" <| fun _ ->
StrongName.ValidateDllsInNugetPackage()

Target "TestNugetPackage" <| fun _ ->
Tests.RunReleaseUnitTests()
//RunReleaseUnitTests restores the canary nugetpackages in tests, since these end up being cached
//its too evasive to run on development machines or TC, Run only on AppVeyor containers.
if buildServer <> AppVeyor then Tests.RunUnitTests()
else Tests.RunReleaseUnitTests()

Target "Canary" <| fun _ ->
trace "Running canary build"
Expand All @@ -101,7 +105,7 @@ Target "Diff" <| fun _ ->
=?> ("Version", hasBuildParam "version")
==> "Restore"
=?> ("FullBuild", Commandline.needsFullBuild)
=?> ("Test", (not Commandline.skipTests))
=?> ("Test", (not Commandline.skipTests && Commandline.target <> "canary"))
=?> ("InternalizeDependencies", (not isMono))
==> "InheritDoc"
=?> ("Documentation", (not Commandline.skipDocs))
Expand All @@ -119,7 +123,7 @@ Target "Diff" <| fun _ ->

"Version"
==> "Release"
=?> ("TestNugetPackage", (not isMono))
=?> ("TestNugetPackage", (not isMono && not Commandline.skipTests))
==> "Canary"

"Start"
Expand All @@ -131,6 +135,7 @@ Target "Diff" <| fun _ ->
"Build"
==> "Release"

"Touch"
"Start"
==> "Clean"
==> "Diff"
Expand Down
3 changes: 2 additions & 1 deletion build/scripts/Testing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ module Tests =
let command =
let p = ["xunit"; "-parallel"; "all"; "-xml"; "../.." @@ Paths.Output("TestResults-Desktop-Clr.xml")]
match (target, buildingOnTravis) with
//make sure we don't test against net46 on mono or travis systems
| (_, true)
| (Commandline.MultiTarget.One, _) -> ["-framework"; "netcoreapp1.1"] |> List.append p
| (Commandline.MultiTarget.One, _) -> ["-framework"; "netcoreapp2.0"] |> List.append p
| _ -> p

let dotnet = Tooling.BuildTooling("dotnet")
Expand Down
Loading