Skip to content

Commit cd8ea82

Browse files
authored
Feature/dependencies scrub (#2906)
* fixed last remaining failing unit tests * Split serializer into request/response AND source serializer. Scrub json.net related classes from public API * Writing test for source serialization, making sure it respects the custom user serializer * formatting * validated more API's are using source serializer correctly for writing * we now randomly seed when running on the commandline and we show replay command at the end of the run always * test framework can now run with or without source serializer this is random on the commandline and pinnable on both commandline and vanilla test runners. unit tests succeeds for both with and without source serializer, onwards to integration tests * Don't bleed Union<T,T> into JoinField, since its expected to be on folks documents it does not play well with SourceSerializer's, had it working in a previous commit but this limits the ammount of places that need patching. * clearly separate Source and RequestResponse Serializers by name * We can now offer a custom json net serializer that will fallback to our serializer for known NEST types in _source e.g JoinField, or QueryContainer when indexing percolation queries * RevertBackToBuiltInConverter now works as expected * fixed failing unit test due to new property on Project * Several improvements LazyDocument is now source serializer aware. Explain() Search() MultiGet() SimulatePipeline() Get() now all have integration tests for custom source deserialization * Suggest() is now source serializer aware * fixed all unit tests, reverted changes to source converter and documentjson converter since the proposed optimization still used the internal writer and thus the internal serializer settings * ApiTestBase now uses source convverter by default as well, more like this query document now uses source converter * TopHits aggregations now support custom source serializer * Scripted metric now uses source serializer * FieldsValues is now also source serializer aware * update unit tests now that we have a non nullable int in Project * update paket targets file * ILRepack internalizes JSON.NET, Mono.Cecil rewrites its namespace * updated Mono.Cecil to the latest beta, this one does not lock the assembly file and explicitly allows overwriting existing files * Introduced new nuget package NEST.JsonNetSerializer which folks can reference should they need to customize the way their _source and field values are (de)serialized using Json.NET * added new documentation around customizing serialization' * attempt 1 * attempt 2 * All unit tests now pass when testing against local nuget package for NEST. Simplified Serialization testbase Return of Gimme.Lock started seeing Bogus blocking on Populate again. * canary builds now test the nuget package at the end of its build run. * make appveyor run the canary build and include appveyor.yml as solution item * ILRepack and mono do not mix, prevent calling canary/release on mono systems for now * move to async token read in json.net 10.0.1, idea being that its less bad to buffer in a JObject than to read the stream in a blocking fashion. cc @codebrain @russcam * Add SerializeAsync to interface * Prevent boxing on PostData<object> `PostData<object>` was was introduced as a union'esque type that `byte[]/string/object/IEnumerable<string>/<IEnumerable<object>` could all implicitly converter to automagically making the lowel client easy to use without exploding the already massive method list on ILowLevelClient. This abstraction meant that we always boxed for NEST types to object. In preparation for all the serialization/perf work we want to do in 6.x it would be great if we can take `T` that we we want to serialize all the way to the `IElasticsearchSerializer` which we can do with this PR now. We sacrifice on the implicit operators in the low level client (for the most part: byte[] and string still do). TBF most of the time I've seen people use the low level client they would instantiate `PostData<object>` directly already. Or worse see: #2656. We weren't really helping anyone here. `PostData<object>` now has a base class `PostData` that we use throughout. There is also `SerializableData<T>` subclass that we now use for anything that needs serializing. This dispatcher is now aware of what generics an `IRequest` implementation has. Because of this our hack to make `Index(document)` and `CreateIndex(document)` work when document == IIndexRequest or not no longer works. Rather than fighting C# resolution of overloads (and its lack of not constraints :() the methods are now called `IndexDocument()` and `CreateDocument()`. * update travis to dotnet 2.0.3 * walkthrough review comments from @codebrain and @russcam, updated travis.yml to support netcore 2 building netcoreapp1.x on linux * suspicion skipping first time experience on the dotnet cli breaks setting up nuget caches properly * put back DOTNET_SKIP_FIRST_EXPERIENCE, as it did not solve travis build * build.sh was alway doing an install because it was checking for add an empty paket file in src to prevent paket from adding targets to csproj file on paket install * make sure dotnet SDK 1.0.4 is available * 1.0.5 not 1.0.4
1 parent 388cc4f commit cd8ea82

File tree

264 files changed

+4590
-3816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+4590
-3816
lines changed

.paket/Paket.Restore.targets

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,24 @@
3838
<NoWarn>$(NoWarn);NU1603</NoWarn>
3939
</PropertyGroup>
4040

41+
<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
42+
<PropertyGroup>
43+
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
44+
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
45+
</PropertyGroup>
46+
47+
<!-- If shasum and awk exist get the hashes -->
48+
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
49+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
50+
</Exec>
51+
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
52+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
53+
</Exec>
54+
4155
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
42-
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
43-
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
56+
<!-- if no hash has been done yet fall back to just reading in the files and comparing them -->
57+
<PaketRestoreCachedHash Condition=" '$(PaketRestoreCachedHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
58+
<PaketRestoreLockFileHash Condition=" '$(PaketRestoreLockFileHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
4459
<PaketRestoreRequired>true</PaketRestoreRequired>
4560
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
4661
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
@@ -137,27 +152,28 @@
137152

138153
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
139154
<ItemGroup>
140-
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)/*.nuspec"/>
155+
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/>
141156
</ItemGroup>
142157

143158
<PropertyGroup>
144159
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
145160
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
146161
<UseNewPack>false</UseNewPack>
147162
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
148-
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)/</AdjustedNuspecOutputPath>
163+
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath>
149164
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath>
150165
</PropertyGroup>
151166

152167
<ItemGroup>
153-
<_NuspecFiles Include="$(AdjustedNuspecOutputPath)*.nuspec"/>
168+
<_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.nuspec"/>
154169
</ItemGroup>
155170

156171
<Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />
157172

158173
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
159174
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
160-
</ConvertToAbsolutePath>
175+
</ConvertToAbsolutePath>
176+
161177

162178
<!-- Call Pack -->
163179
<PackTask Condition="$(UseNewPack)"

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@ solution: src/Elasticsearch.sln
33
script: ./build.sh test
44
dist: trusty
55
mono: 4.6.2
6-
dotnet: 1.0.1
6+
dotnet: 2.0.3
77
env:
88
global:
9-
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
109
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
10+
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
11+
addons:
12+
apt:
13+
sources:
14+
- sourceline: 'deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main'
15+
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
16+
packages:
17+
- dotnet-sharedframework-microsoft.netcore.app-1.1.2
18+
- dotnet-sharedframework-microsoft.netcore.app-1.0.5

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 1.0.{build}
22
image: Visual Studio 2017
33
build_script:
4-
- cmd: build.bat
4+
- cmd: build.bat canary
55
test: off
66
environment:
77
DOTNET_CLI_TELEMETRY_OPTOUT: true

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ FAKE="packages/build/FAKE/tools/FAKE.exe"
33
BUILDSCRIPT="build/scripts/Targets.fsx"
44

55
mono .paket/paket.bootstrapper.exe
6-
if [[ -f .paket.lock ]]; then mono .paket/paket.exe restore; fi
7-
if [[ ! -f .paket.lock ]]; then mono .paket/paket.exe install; fi
6+
if [[ -f paket.lock ]]; then mono .paket/paket.exe restore; fi
7+
if [[ ! -f paket.lock ]]; then mono .paket/paket.exe install; fi
88
mono $FAKE $BUILDSCRIPT "cmdline=$*" --fsiargs -d:MONO

build/Clients.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<FileVersion>$(CurrentAssemblyFileVersion)</FileVersion>
2323

2424
<SignAssembly Condition="'$(DotNetCoreOnly)'==''">true</SignAssembly>
25-
<AssemblyOriginatorKeyFile Condition="'$(DotNetCoreOnly)'==''">..\..\build\keys\keypair.snk</AssemblyOriginatorKeyFile>
25+
<AssemblyOriginatorKeyFile Condition="'$(DotNetCoreOnly)'==''">$(MSBuildThisFileDirectory)\keys\keypair.snk</AssemblyOriginatorKeyFile>
2626
<GenerateDocumentationFile Condition="'$(DotNetCoreOnly)'==''">true</GenerateDocumentationFile>
2727
<NoWarn>1591,1572,1571,1573,1587,1570</NoWarn>
2828
<Prefer32Bit>false</Prefer32Bit>

build/NEST.JsonNetSerializer.nuspec

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>NEST.JsonNetSerializer</id>
5+
<version>$version$</version>
6+
<title>Hook up your own Json.Net serializer in NEST in an isolated fashion</title>
7+
<authors>Elastic and contributors</authors>
8+
<owners>Elastic</owners>
9+
<licenseUrl>https://github.com/elastic/elasticsearch-net/blob/master/license.txt</licenseUrl>
10+
<projectUrl>https://github.com/elastic/elasticsearch-net</projectUrl>
11+
<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>NEST 6.x ships with an internalized Json.NET, this package opens the (de)serialization up for your own custom Json.NET serializer</description>
14+
<summary>NEST 6.x ships with an internalized Json.NET, this package opens the (de)serialization up for your own custom Json.NET serializer</summary>
15+
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
16+
<copyright>2017-$year$ Elasticsearch BV</copyright>
17+
<tags>elasticsearch,elastic,search,lucene,nest,serializer,json</tags>
18+
<dependencies>
19+
<group targetFramework=".NETFramework4.5">
20+
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
21+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
22+
</group>
23+
<group targetFramework=".NETFramework4.6">
24+
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
25+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
26+
</group>
27+
<group targetFramework=".NETStandard1.3">
28+
<dependency id="NETStandard.Library" version="[1.6.0, )" />
29+
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
30+
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
31+
</group>
32+
</dependencies>
33+
</metadata>
34+
<files>
35+
<file src="output\Nest.JsonNetSerializer\net45\Nest.JsonNetSerializer.dll" target="lib\net45"/>
36+
<file src="output\Nest.JsonNetSerializer\net45\Nest.JsonNetSerializer.XML" target="lib\net45"/>
37+
38+
<file src="output\Nest.JsonNetSerializer\net46\Nest.JsonNetSerializer.dll" target="lib\net46"/>
39+
<file src="output\Nest.JsonNetSerializer\net46\Nest.JsonNetSerializer.XML" target="lib\net46"/>
40+
41+
<file src="output\Nest.JsonNetSerializer\netstandard1.3\Nest.JsonNetSerializer.dll" target="lib\netstandard1.3"/>
42+
<file src="output\Nest.JsonNetSerializer\netstandard1.3\Nest.JsonNetSerializer.xml" target="lib\netstandard1.3"/>
43+
</files>
44+
</package>

build/NEST.nuspec

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@
1818
<dependencies>
1919
<group targetFramework=".NETFramework4.5">
2020
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
21-
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
2221
</group>
2322
<group targetFramework=".NETFramework4.6">
2423
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
25-
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
2624
</group>
2725
<group targetFramework=".NETStandard1.3">
26+
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
2827
<dependency id="NETStandard.Library" version="[1.6.0, )" />
2928
<dependency id="System.Collections.Specialized" version="[4.3.0, )" />
3029
<dependency id="System.Reflection.TypeExtensions" version="[4.3.0, )" />
3130
<dependency id="System.Linq.Queryable" version="[4.0.1, )" />
32-
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
33-
<dependency id="Newtonsoft.Json" version="[$jsonDotNetCurrentVersion$, $jsonDotNetNextVersion$)" />
31+
32+
<!-- since we no longer reference JSON.NET (internalized) we do need to ship with its System references -->
33+
<dependency id="System.ComponentModel.TypeConverter" version="[4.3.0, )"/>
34+
<dependency id="System.Runtime.Serialization.Formatters" version="[4.3.0, )"/>
35+
<dependency id="System.Runtime.Serialization.Primitives" version="[4.3.0, )"/>
36+
<dependency id="System.Xml.XmlDocument" version="[4.3.0, )"/>
3437
</group>
3538
</dependencies>
3639
</metadata>

build/scripts/Building.fsx

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#I @"../../packages/build/FAKE/tools"
22
#I @"../../packages/build/FSharp.Data/lib/net40"
3+
#I @"../../packages/build/Mono.Cecil/lib/net40"
34
#r @"FakeLib.dll"
5+
#r @"Mono.Cecil.dll"
46
#r @"FSharp.Data.dll"
57
#nowarn "0044" //TODO sort out FAKE 5
68

@@ -10,8 +12,10 @@
1012

1113
open System
1214
open System.IO
15+
open System.Reflection
1316
open Fake
1417
open FSharp.Data
18+
open Mono.Cecil
1519

1620
open Paths
1721
open Projects
@@ -21,15 +25,15 @@ open Versioning
2125
module Build =
2226

2327
let private runningRelease = hasBuildParam "version" || hasBuildParam "apikey" || getBuildParam "target" = "canary" || getBuildParam "target" = "release"
24-
let private quickBuild = not (getBuildParam "target" = "release" || getBuildParam "target" = "canary")
2528

2629
type private GlobalJson = JsonProvider<"../../global.json">
2730
let private pinnedSdkVersion = GlobalJson.GetSample().Sdk.Version
2831
if isMono then setProcessEnvironVar "TRAVIS" "true"
32+
2933
let private buildingOnTravis = getEnvironmentVarAsBool "TRAVIS"
3034

3135
let private sln = sprintf "src/Elasticsearch%s.sln" (if buildingOnTravis then ".DotNetCoreOnly" else "")
32-
36+
3337
let private compileCore incremental =
3438
if not (DotNetCli.isInstalled()) then failwith "You need to install the dotnet command line SDK to build for .NET Core"
3539
let runningSdkVersion = DotNetCli.getVersion()
@@ -76,4 +80,76 @@ module Build =
7680
CleanDir Paths.BuildOutput
7781
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(3.) }) "clean src/Elasticsearch.sln -c Release" |> ignore
7882
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
79-
83+
84+
type CustomResolver(folder) =
85+
inherit DefaultAssemblyResolver()
86+
member this.Folder = folder;
87+
88+
override this.Resolve name =
89+
try
90+
base.Resolve name
91+
with
92+
| ex ->
93+
AssemblyDefinition.ReadAssembly(Path.Combine(folder, "Elasticsearch.Net.dll"));
94+
95+
let RewriteNamespace nest f =
96+
let folder = Paths.ProjectOutputFolder nest f
97+
let nestDll = sprintf "%s/%s.dll" folder nest.Name
98+
let nestRewrittenDll = sprintf "%s/%s-rewriten.dll" folder nest.Name
99+
use resolver = new CustomResolver(folder)
100+
let readerParams = ReaderParameters( AssemblyResolver = resolver, ReadWrite = true );
101+
use nestAssembly = AssemblyDefinition.ReadAssembly(nestDll, readerParams);
102+
103+
for item in nestAssembly.MainModule.Types do
104+
item.Namespace <-
105+
match item.Namespace.StartsWith("Newtonsoft.Json") with
106+
| false -> item.Namespace
107+
| true -> item.Namespace.Replace("Newtonsoft.Json", "Nest.Json")
108+
109+
//touch custom attribute arguments (not updated automatically)
110+
let touchAttributes (attributes :Mono.Collections.Generic.Collection<CustomAttribute>) =
111+
for attr in attributes do
112+
if attr.HasConstructorArguments then
113+
for constArg in attr.ConstructorArguments do
114+
let isType = constArg.Type.Name = "Type"
115+
ignore()
116+
117+
for t in nestAssembly.MainModule.Types do
118+
touchAttributes t.CustomAttributes
119+
for prop in t.Properties do
120+
touchAttributes prop.CustomAttributes
121+
122+
let key = File.ReadAllBytes(Paths.Keys("keypair.snk"))
123+
let kp = StrongNameKeyPair(key)
124+
let wp = WriterParameters ( StrongNameKeyPair = kp);
125+
nestAssembly.Write(wp) |> ignore;
126+
127+
let private ilRepackInternal() =
128+
let fw = if isMono then [DotNetFramework.NetStandard1_3] else DotNetFramework.All
129+
for f in fw do
130+
let nest = Project Project.Nest
131+
let folder = Paths.ProjectOutputFolder nest f
132+
let nestDll = sprintf "%s/%s.dll" folder nest.Name
133+
let nestMergedDll = sprintf "%s/%s-merged.dll" folder nest.Name
134+
let jsonDll = sprintf "%s/Newtonsoft.Json.dll" folder
135+
let keyFile = Paths.Keys("keypair.snk");
136+
let options =
137+
[
138+
"/keyfile:", keyFile;
139+
"/internalize", "";
140+
"/lib:", folder;
141+
"/out:", nestDll;
142+
]
143+
|> List.map (fun (p,v) -> sprintf "%s%s" p v)
144+
145+
let args = [nestDll; jsonDll;] |> List.append options;
146+
147+
Tooling.ILRepack.Exec args |> ignore
148+
RewriteNamespace nest f |> ignore
149+
150+
let ILRepack() =
151+
//ilrepack on mono crashes pretty hard on my machine
152+
match isMono with
153+
| true -> ignore()
154+
| false -> ilRepackInternal()
155+

build/scripts/Commandline.fsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,31 @@ Targets:
3030
also pushes to upstream (myget)
3131
3232
NOTE: both the `test` and `integrate` targets can be suffixed with `-all` to force the tests against all suported TFM's
33+
34+
Execution hints can be provided anywhere on the command line
35+
- skiptests : skip running tests as part of the target chain
36+
- source_serialization : force tests to use a client with custom source serialization
37+
- seed:<N> : provide a seed to run the tests with.
3338
"""
3439

3540
module Commandline =
3641
type MultiTarget = All | One
3742

3843
let private args = getBuildParamOrDefault "cmdline" "build" |> split ' '
44+
3945
let skipTests = args |> List.exists (fun x -> x = "skiptests")
40-
let private filteredArgs = args |> List.filter (fun x -> x <> "skiptests")
46+
let forceSourceSerialization = args |> List.exists (fun x -> x = "source_serialization")
47+
let seed =
48+
match args |> List.tryFind (fun x -> x.StartsWith("seed:")) with
49+
| Some t -> t.Replace("seed:", "")
50+
| _ -> ""
51+
52+
let private filteredArgs =
53+
args
54+
|> List.filter (
55+
fun x ->
56+
x <> "skiptests" && x <> "source_serialization" && not (x.StartsWith("seed:"))
57+
)
4158

4259
let multiTarget =
4360
match (filteredArgs |> List.tryHead) with
@@ -49,6 +66,12 @@ module Commandline =
4966
| Some t -> t.Replace("-all", "")
5067
| _ -> "build"
5168

69+
let validMonoTarget =
70+
match target with
71+
| "release"
72+
| "canary" -> false
73+
| _ -> true
74+
5275
let needsFullBuild =
5376
match (target, skipTests) with
5477
| (_, true) -> true
@@ -59,10 +82,11 @@ module Commandline =
5982

6083
let needsClean =
6184
match (target, skipTests) with
62-
| (_, true) -> true
85+
| ("release", _) -> true
6386
//dotnet-xunit needs to a build of its own anyways
6487
| ("test", _)
65-
| ("integrate", _) -> false
88+
| ("integrate", _)
89+
| ("build", _) -> false
6690
| _ -> true
6791

6892
let arguments =
@@ -134,6 +158,7 @@ module Commandline =
134158
setBuildParam "clusterfilter" "ConnectionReuse"
135159
setBuildParam "numberOfConnections" numberOfConnections
136160

161+
| ["temp"; ] -> ignore()
137162
| ["canary"; ] -> ignore()
138163
| ["canary"; apiKey ] ->
139164
setBuildParam "apiKey" apiKey

build/scripts/Paths.fsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ module Paths =
3737

3838
let ProjFile(project:DotNetProject) =
3939
match project with
40-
| Project p -> sprintf "%s/%s/%s.csproj" SourceFolder project.Name project.Name
40+
| Project p ->
41+
match p with
42+
| NestJsonNetSerializer -> sprintf "%s/Serializers/%s/%s.csproj" SourceFolder project.Name project.Name
43+
| _ -> sprintf "%s/%s/%s.csproj" SourceFolder project.Name project.Name
4144
| PrivateProject p ->
4245
match p with
4346
| Tests -> sprintf "%s/%s/%s.csproj" SourceFolder project.Name project.Name

0 commit comments

Comments
 (0)