Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit ee32adc

Browse files
Merge pull request #3 from thefringeninja/netstandard-2.0
Netstandard 2.0
2 parents 9d1fea0 + 40282c7 commit ee32adc

8 files changed

Lines changed: 102 additions & 97 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,4 @@ paket-files/
251251
.idea/
252252
*.sln.iml
253253
tools/**
254+
.dotnet

build.cake

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#tool "nuget:?package=xunit.runner.console&version=2.1.0"
2-
31
#addin "Cake.FileHelpers"
2+
#addin "Cake.Powershell"
43

54
var target = Argument("target", "Default");
65
var configuration = Argument("configuration", "Release");
@@ -19,8 +18,9 @@ Task("RestorePackages")
1918
.IsDependentOn("Clean")
2019
.Does(() =>
2120
{
22-
DotNetCoreRestore(solution);
23-
NuGetRestore(solution);
21+
DotNetCoreRestore(solution, new DotNetCoreRestoreSettings {
22+
EnvironmentVariables = DotNetEnvironment
23+
});
2424
});
2525

2626
Task("Build")
@@ -36,14 +36,14 @@ Task("RunTests")
3636
.IsDependentOn("Build")
3737
.Does(() =>
3838
{
39-
4039
var testProjects = new string[] { "SqlStreamStore.HAL.Tests" };
4140

4241
foreach(var testProject in testProjects) {
4342
var projectDir = srcDir + Directory(testProject);
4443
StartProcess("dotnet", new ProcessSettings {
4544
Arguments = "xunit",
46-
WorkingDirectory = projectDir
45+
WorkingDirectory = projectDir,
46+
EnvironmentVariables = DotNetEnvironment
4747
});
4848
}
4949
});
@@ -59,7 +59,8 @@ Task("NuGetPack")
5959
OutputDirectory = artifactsDir,
6060
NoBuild = true,
6161
Configuration = configuration,
62-
VersionSuffix = versionSuffix
62+
VersionSuffix = versionSuffix,
63+
EnvironmentVariables = DotNetEnvironment
6364
});
6465
});
6566

@@ -68,3 +69,80 @@ Task("Default")
6869
.IsDependentOn("NuGetPack");
6970

7071
RunTarget(target);
72+
73+
Dictionary<string, string> DotNetEnvironment => new Dictionary<string, string> {
74+
{"PATH", Path}
75+
};
76+
77+
private string _path;
78+
79+
string Path => _path ?? (_path = DownloadDotNetCoreIfNecessary());
80+
81+
string DownloadDotNetCoreIfNecessary() {
82+
var path = Context.Environment.GetEnvironmentVariable("PATH");
83+
var version = "2.0.0";
84+
85+
if (DotNetVersion == System.Version.Parse(version)) {
86+
return path;
87+
}
88+
89+
var dotnetDirectory = Directory(".dotnet");
90+
91+
EnsureDirectoryExists(dotnetDirectory);
92+
93+
if (IsRunningOnWindows()) {
94+
DownloadDotNetCoreForWindows(dotnetDirectory, version);
95+
} else {
96+
DownloadDotNetCoreForUnix(dotnetDirectory, version);
97+
}
98+
return $"{dotnetDirectory.Path.MakeAbsolute(Context.Environment)};{path}";
99+
}
100+
101+
void DownloadDotNetCoreForWindows(ConvertableDirectoryPath dotnetDirectory, string version) {
102+
var channel = "Current";
103+
var installer = "https://dot.net/dotnet-install.ps1";
104+
var installerPath = dotnetDirectory + File("dotnet-install.ps1");
105+
106+
Information(installerPath);
107+
108+
DownloadFile(installer, installerPath);
109+
110+
StartPowershellFile(installerPath, args => {
111+
args.Append("Channel", channel);
112+
args.Append("Version", version);
113+
args.Append("InstallDir", dotnetDirectory);
114+
});
115+
}
116+
117+
void DownloadDotNetCoreForUnix(DirectoryPath dotnetDirectory, string version) {
118+
var channel = "Current";
119+
var installer = "https://dot.net/dotnet-install.sh";
120+
var installerPath = dotnetDirectory + File("dotnet-install.sh");
121+
122+
DownloadFile(installer, installerPath);
123+
124+
using (var process = StartAndReturnProcess(installerPath, new ProcessSettings {
125+
Arguments = $"--channel {channel} --version {version} --install-dir {dotnetDirectory}"
126+
})) {
127+
process.WaitForExit();
128+
}
129+
}
130+
131+
Version DotNetVersion {
132+
get {
133+
using (var process = StartAndReturnProcess("dotnet", new ProcessSettings {
134+
Arguments = "--version",
135+
RedirectStandardOutput = true
136+
})) {
137+
process.WaitForExit();
138+
139+
var stdout = process.GetStandardOutput().FirstOrDefault();
140+
141+
System.Version installedVersion;
142+
143+
System.Version.TryParse(stdout, out installedVersion);
144+
145+
return installedVersion;
146+
}
147+
}
148+
}

build.ps1

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ Param(
3131
[string[]]$ScriptArgs
3232
)
3333

34-
$CakeVersion = "0.19.3"
35-
$DotNetChannel = "preview";
36-
$DotNetVersion = "1.0.3";
37-
$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
34+
$CakeVersion = "0.22.0"
3835
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
3936

4037
# Make sure tools folder exists
@@ -45,47 +42,6 @@ if (!(Test-Path $ToolPath)) {
4542
New-Item -Path $ToolPath -Type directory | out-null
4643
}
4744

48-
###########################################################################
49-
# INSTALL .NET CORE CLI
50-
###########################################################################
51-
52-
Function Remove-PathVariable([string]$VariableToRemove)
53-
{
54-
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
55-
if ($path -ne $null)
56-
{
57-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
58-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
59-
}
60-
61-
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
62-
if ($path -ne $null)
63-
{
64-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
65-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
66-
}
67-
}
68-
69-
# Get .NET Core CLI path if installed.
70-
$FoundDotNetCliVersion = $null;
71-
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
72-
$FoundDotNetCliVersion = dotnet --version;
73-
}
74-
75-
if($FoundDotNetCliVersion -ne $DotNetVersion) {
76-
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
77-
if (!(Test-Path $InstallPath)) {
78-
mkdir -Force $InstallPath | Out-Null;
79-
}
80-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
81-
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
82-
83-
Remove-PathVariable "$InstallPath"
84-
$env:PATH = "$InstallPath;$env:PATH"
85-
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
86-
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
87-
}
88-
8945
###########################################################################
9046
# INSTALL NUGET
9147
###########################################################################
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
4+
<TargetFrameworks>netstandard1.3</TargetFrameworks>
55
<AssemblyName>KestrelPureOwin</AssemblyName>
66
<PackageId>KestrelPureOwin</PackageId>
77
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@@ -10,14 +10,8 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
13+
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
1414
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
15-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="1.1.0" />
15+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="1.1.1" />
1616
</ItemGroup>
17-
18-
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
19-
<Reference Include="System" />
20-
<Reference Include="Microsoft.CSharp" />
21-
</ItemGroup>
22-
2317
</Project>

src/SqlStreamStore.HAL.DevServer/SqlStreamStore.HAL.DevServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>netcoreapp1.1</TargetFramework>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\KestrelPureOwin\KestrelPureOwin.csproj" />
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp1.0;net461</TargetFrameworks>
3+
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
44
<AssemblyName>SqlStreamStore.HAL.Tests</AssemblyName>
55
<PackageId>SqlStreamStore.HAL.Tests</PackageId>
66
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
@@ -10,9 +10,9 @@
1010
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
1111
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
1212
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
13+
<DebugType>portable</DebugType>
1314
<DebugSymbols>true</DebugSymbols>
1415
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
15-
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
1616
</PropertyGroup>
1717
<ItemGroup>
1818
<ProjectReference Include="..\SqlStreamStore.HAL\SqlStreamStore.HAL.csproj" />
@@ -26,12 +26,4 @@
2626
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
2727
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.1" />
2828
</ItemGroup>
29-
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
30-
<PackageReference Include="System.Net.Http" Version="4.3.2" />
31-
</ItemGroup>
32-
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
33-
<Reference Include="System" />
34-
<Reference Include="System.Net.Http" />
35-
<Reference Include="Microsoft.CSharp" />
36-
</ItemGroup>
3729
</Project>

src/SqlStreamStore.HAL.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<s:Boolean x:Key="/Default/CodeStyle/IntroduceVariableUseVar/UseVarForIntroduceVariableRefactoring/@EntryValue">True</s:Boolean>
4545
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" /&gt;</s:String>
4646
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb_AaBb" /&gt;</s:String>
47+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
4748
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
4849
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
4950
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,30 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard1.6;net461</TargetFrameworks>
4-
<DefineConstants>$(DefineConstants)</DefineConstants>
3+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
4+
<DefineConstants>$(DefineConstants);LIBLOG_PORTABLE</DefineConstants>
55
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
66
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
77
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
88
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
99
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
1010
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
1111
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
12-
<DebugSymbols>true</DebugSymbols>
1312
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1413
<AssemblyName>SqlStreamStore.HAL</AssemblyName>
1514
<PackageId>SqlStreamStore.HAL</PackageId>
15+
<DebugSymbols>true</DebugSymbols>
1616
<NoWarn>1701;1702;1705;1591</NoWarn>
1717
</PropertyGroup>
1818
<ItemGroup>
19-
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
19+
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
20+
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
2021
<PackageReference Include="Halcyon" Version="2.5.1" />
22+
<PackageReference Include="KatanaNetStandard" Version="3.0.7" />
2123
<PackageReference Include="LibLog" Version="4.2.6" PrivateAssets="All" />
24+
<PackageReference Include="Microsoft.CSharp" Version="4.4.0" />
2225
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.2.2" />
2326
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
24-
<PackageReference Include="SqlStreamStore" Version="1.0.0" />
27+
<PackageReference Include="SqlStreamStore" Version="1.1.0" />
2528
<PackageReference Include="Tavis.UriTemplates" Version="1.1.1" />
2629
</ItemGroup>
27-
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
28-
<Reference Include="System" />
29-
<Reference Include="System.Core" />
30-
<Reference Include="Microsoft.CSharp" />
31-
</ItemGroup>
32-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
33-
<PackageReference Include="KatanaNetStandard" Version="3.0.6" />
34-
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
35-
<PackageReference Include="System.Threading" Version="4.3.0" />
36-
</ItemGroup>
37-
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
38-
<PackageReference Include="Microsoft.Owin" Version="3.0.1" />
39-
</ItemGroup>
40-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
41-
<DefineConstants>$(DefineConstants);LIBLOG_PORTABLE</DefineConstants>
42-
<DebugType>portable</DebugType>
43-
</PropertyGroup>
44-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
45-
<DebugType>full</DebugType>
46-
</PropertyGroup>
4730
</Project>

0 commit comments

Comments
 (0)