Skip to content

Commit bc48aa0

Browse files
committed
Fix/old connection random (#3391)
* FEATURE_HTTP_WEB_REQUEST is outdated both netstandard2x and net4x support it, rely on DOTNETCORE pragma only * update .editorconfig to make sure props and targets are formatted like xml and csproj * Move away from Directory.build.props for a more explicit inclusion approach, reformatted Solution items and moved scripts out of Solution items * Remove random old connection usage and add explict net461 testing back * Remove Tests\Directory.build.props it set a TESTINGNUGETPACKAGE pragma which was never used * cleanup namespaces on full .net HttpConnection alias class * Obsolete HttpWebRequestConnection on CoreFX since it does not reuse HttpClient instances * Revert "Remove Tests\Directory.build.props it set a TESTINGNUGETPACKAGE pragma which was never used" This reverts commit da2d826. * Remove setting of the TESTINGNUGETPACKAGE constant, not used anywher * Comment looping up for Directory.build.props for now * Add root Directory.build.props (for now only sets LangVersion to latest) (cherry picked from commit 8ca1e0b)
1 parent b2fedda commit bc48aa0

39 files changed

+151
-420
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ indent_size = 4
1616
indent_style = space
1717
indent_size = 4
1818

19-
[*.{md,markdown,json,js,csproj,fsproj,targets}]
19+
[*.{md,markdown,json,js,csproj,fsproj,targets,targets,props}]
2020
indent_style = space
2121
indent_size = 2
2222

build/scripts/Paths.fsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ module Paths =
4242
match project with
4343
| Project p ->
4444
match p with
45-
| ElasticsearchNetHttpWebRequestConnection -> sprintf "%s/Connections/%s/%s.csproj" SourceFolder project.Name project.Name
4645
| NestJsonNetSerializer -> sprintf "%s/Serializers/%s/%s.csproj" SourceFolder project.Name project.Name
4746
| _ -> sprintf "%s/%s/%s.csproj" SourceFolder project.Name project.Name
4847
| PrivateProject p ->

build/scripts/Projects.fsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module Projects =
2626
| Nest
2727
| ElasticsearchNet
2828
| NestJsonNetSerializer
29-
| ElasticsearchNetHttpWebRequestConnection
3029

3130
type PrivateProject =
3231
| Tests
@@ -41,7 +40,6 @@ module Projects =
4140
Project Project.ElasticsearchNet;
4241
Project Project.Nest;
4342
Project Project.NestJsonNetSerializer;
44-
Project ElasticsearchNetHttpWebRequestConnection;
4543
PrivateProject PrivateProject.Tests
4644
]
4745

@@ -50,7 +48,6 @@ module Projects =
5048
Project Project.ElasticsearchNet;
5149
Project Project.Nest;
5250
Project Project.NestJsonNetSerializer;
53-
Project ElasticsearchNetHttpWebRequestConnection;
5451
]
5552
static member Tests = seq [PrivateProject PrivateProject.Tests;]
5653

@@ -61,7 +58,6 @@ module Projects =
6158
| Nest -> "Nest"
6259
| ElasticsearchNet -> "Elasticsearch.Net"
6360
| NestJsonNetSerializer -> "Nest.JsonNetSerializer"
64-
| ElasticsearchNetHttpWebRequestConnection -> "Elasticsearch.Net.Connections.HttpWebRequestConnection"
6561
| PrivateProject p ->
6662
match p with
6763
| Tests -> "Tests"

build/scripts/scripts.fsproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
<None Include="Commandline.fsx" />
6262
<None Include="Targets.fsx" />
6363
</ItemGroup>
64+
<ItemGroup>
65+
<Content Include="..\..\paket.bat"><Link>paket.bat</Link></Content>
66+
<Content Include="..\..\paket.dependencies"><Link>paket.bat</Link></Content>
67+
<Content Include="..\..\build.sh"><Link>paket.bat</Link></Content>
68+
<Content Include="..\..\build.bat"><Link>paket.bat</Link></Content>
69+
</ItemGroup>
6470
<PropertyGroup>
6571
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
6672
</PropertyGroup>

src/Artifacts.build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))\src\Library.build.props" />
4+
<!--
5+
Sets up the properties for assemblies we want to publish to a separate output folder (outside of src) during our build process.
6+
e.g ApiGenerator we'd like to keep private but we do want to publish it to build/_output during our FAKE build
7+
-->
8+
<PropertyGroup>
9+
<OutputPath Condition="'$(OutputPathBaseDir)' != ''">$(OutputPathBaseDir)\$(MSBuildProjectName)\</OutputPath>
10+
</PropertyGroup>
11+
</Project>

src/CodeGeneration/ApiGenerator/ApiGenerator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))\src\Artifacts.build.props" />
34
<PropertyGroup>
45
<OutputType>Exe</OutputType>
56
<TargetFramework>netcoreapp2.1</TargetFramework>
@@ -16,5 +17,4 @@
1617
<PackageReference Include="RazorLight.Unofficial" Version="2.0.0-beta1.1" />
1718
<!--<PackageReference Include="RazorLight" Version="2.0.0-beta1" />-->
1819
</ItemGroup>
19-
<Import Project="..\..\outputpath.props" />
2020
</Project>

src/CodeGeneration/DocGenerator/Buildalyzer/ProjectAnalyzer.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public Project Load()
119119
}
120120
}
121121

122+
123+
122124
// Tweaks the project file a bit to ensure a succesfull build
123125
private static XDocument TweakProjectDocument(XDocument projectDocument, string projectFolder)
124126
{
@@ -128,10 +130,12 @@ private static XDocument TweakProjectDocument(XDocument projectDocument, string
128130
if (att == null) continue;
129131

130132
var project = att.Value;
131-
if (project.EndsWith("Clients.Common.targets"))
132-
att.Value = Path.GetFullPath(Path.Combine(projectFolder, att.Value));
133-
else if (project.EndsWith("outputpath.props"))
134-
att.Value = Path.GetFullPath(Path.Combine(projectFolder, att.Value));
133+
134+
if (!ResolveKnownPropsPath(projectFolder, project, att, "PublishArtifacts.build.props"))
135+
{
136+
ResolveKnownPropsPath(projectFolder, project, att, "Artifacts.build.props");
137+
}
138+
ResolveKnownPropsPath(projectFolder, project, att, "Library.build.props");
135139
}
136140
// Add SkipGetTargetFrameworkProperties to every ProjectReference
137141
foreach (var projectReference in projectDocument.GetDescendants("ProjectReference").ToArray())
@@ -149,6 +153,17 @@ private static XDocument TweakProjectDocument(XDocument projectDocument, string
149153
return projectDocument;
150154
}
151155

156+
private static bool ResolveKnownPropsPath(string projectFolder, string project, XAttribute att, string buildPropFile)
157+
{
158+
if (!project.Contains(buildPropFile)) return false;
159+
var dir = new DirectoryInfo(projectFolder).Parent;
160+
while (dir != null && dir.Name != "src")
161+
dir = dir.Parent;
162+
if (dir == null) return true;
163+
att.Value = Path.GetFullPath(Path.Combine(dir.FullName, buildPropFile));
164+
return false;
165+
}
166+
152167
private ProjectCollection CreateProjectCollection()
153168
{
154169
var projectCollection = new ProjectCollection(_globalProperties);

src/CodeGeneration/DocGenerator/DocGenerator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))\src\Artifacts.build.props" />
34
<PropertyGroup>
45
<OutputType>Exe</OutputType>
56
<TargetFramework>netcoreapp2.1</TargetFramework>
@@ -17,5 +18,4 @@
1718
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.3.2" />
1819
<PackageReference Include="NuDoq" Version="1.2.5" />
1920
</ItemGroup>
20-
<Import Project="..\..\outputpath.props" />
2121
</Project>

src/Connections/Elasticsearch.Net.Connections.HttpWebRequestConnection/Elasticsearch.Net.Connections.HttpWebRequestConnection.csproj

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)