Skip to content

Commit

Permalink
Upgrade to net6.0 (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
lecaillon committed Dec 9, 2021
1 parent 8d38968 commit 074b629
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 66 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
version: 2.0.0.{build}
skip_tags: true
skip_non_tags: false
image: Visual Studio 2019
image: Visual Studio 2022
configuration: Release

# enable service required for build/tests
Expand Down
51 changes: 20 additions & 31 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#tool nuget:?package=ReportGenerator&version=4.8.6
#tool nuget:?package=NuGet.CommandLine
#tool nuget:?package=NuGet.CommandLine&version=5.11.0
#tool dotnet:?package=dotnet-reportgenerator-globaltool&version=5.0.0

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -9,9 +9,7 @@ var target = Argument("target", "default");
var configuration = Argument("configuration", "Release");
var version = XmlPeek(File("./build/common.props"), "/Project/PropertyGroup/Version/text()");

var framework = "net5.0";
var sln = "./Evolve.sln";
var reportGeneratorPath = $"./tools/ReportGenerator.4.8.6/tools/{framework}/" + (IsRunningOnUnix() ? "ReportGenerator.dll" : "ReportGenerator.exe");
var distDir = "./dist";
var distDirFullPath = MakeAbsolute(Directory($"{distDir}")).FullPath;
var publishDir = "./publish";
Expand Down Expand Up @@ -39,46 +37,38 @@ Task("clean").Does(() =>
CleanDirectories(distDir);
CleanDirectories(publishDir);
CleanDirectories($"./**/obj/{framework}");
CleanDirectories(string.Format("./**/obj/{0}", configuration));
CleanDirectories(string.Format("./**/bin/{0}", configuration));
});
Task("win-build").WithCriteria(() => IsRunningOnWindows()).Does(() =>
{
MSBuild(sln, new MSBuildSettings
DotNetClean(sln, new DotNetCleanSettings
{
Configuration = configuration,
Verbosity = Verbosity.Minimal,
Restore = true
Verbosity = DotNetVerbosity.Minimal
});
});

Task("linux-build").WithCriteria(() => IsRunningOnUnix()).Does(() =>
Task("build").Does(() =>
{
DotNetCoreBuild("./test/Evolve.Tests", new DotNetCoreBuildSettings
DotNetBuild(sln, new DotNetBuildSettings
{
Configuration = configuration,
Verbosity = DotNetCoreVerbosity.Minimal
Verbosity = DotNetVerbosity.Minimal
});
});

Task("test").Does(() =>
{
var pathFilter = Environment.GetEnvironmentVariable("APPVEYOR") == "True" ? "\\SCassandra" : "";
DotNetCoreTest("./test/Evolve.Tests", new DotNetCoreTestSettings
DotNetTest("./test/Evolve.Tests", new DotNetTestSettings
{
Configuration = configuration,
ArgumentCustomization = args => args.AppendSwitchQuoted("--filter", "Category!=Cli")
.Append(logger)
.Append("/p:AltCover=true")
.Append("/p:AltCoverForce=true")
.Append("/p:AltCoverCallContext=[Fact]|[Theory]")
.Append("/p:AltCoverAssemblyFilter=Evolve.Tests|xunit.runner|MySqlConnector|xunit.assert|xunit.core|xunit.execution.dotnet")
.Append("/p:AltCoverAssemblyFilter=Evolve.Tests|xunit.runner|MySqlConnector|xunit.assert|xunit.core|xunit.execution.dotnet|AltCover.Monitor")
.Append($"/p:AltCoverPathFilter={pathFilter}")
.Append("/p:AltCoverTypeFilter=Evolve.Utilities.Check|SimpleJSON.JSON|SimpleJSON.JSONArray|SimpleJSON.JSONBool|SimpleJSON.JSONLazyCreator|SimpleJSON.JSONNode|SimpleJSON.JSONNull|SimpleJSON.JSONNumber|SimpleJSON.JSONObject|SimpleJSON.JSONString|ConsoleTables.ConsoleTable|ConsoleTables.ConsoleTableOptions")
.Append($"/p:AltCoverXmlReport={publishDirFullPath}/coverage.xml")
.Append($"/p:AltCoverReport={publishDirFullPath}/coverage.xml")
});
});

Expand All @@ -87,14 +77,13 @@ Task("report-coverage").Does(() =>
ReportGenerator(report: $"{publishDir}/coverage.xml", targetDir: $"{publishDir}/coverage", new ReportGeneratorSettings
{
ReportTypes = new[] { ReportGeneratorReportType.Badges, ReportGeneratorReportType.Cobertura, ReportGeneratorReportType.HtmlInline_AzurePipelines_Dark },
Verbosity = ReportGeneratorVerbosity.Info,
ToolPath = reportGeneratorPath
Verbosity = ReportGeneratorVerbosity.Info
});
});

Task("test-cli").Does(() =>
{
DotNetCoreTest("./test/Evolve.Tests", new DotNetCoreTestSettings
DotNetTest("./test/Evolve.Tests", new DotNetTestSettings
{
Configuration = configuration,
ArgumentCustomization = args => args.AppendSwitchQuoted("--filter", "Category=Cli")
Expand All @@ -104,21 +93,23 @@ Task("test-cli").Does(() =>

Task("win-publish-cli").WithCriteria(() => IsRunningOnWindows()).Does(() =>
{
DotNetCorePublish("./src/Evolve.Cli", new DotNetCorePublishSettings
DotNetPublish("./src/Evolve.Cli", new DotNetPublishSettings
{
Configuration = configuration,
OutputDirectory = publishDir + "/cli/win-x64",
Runtime = "win-x64"
Runtime = "win-x64",
SelfContained = true
});
});

Task("linux-publish-cli").WithCriteria(() => IsRunningOnUnix()).Does(() =>
{
DotNetCorePublish("./src/Evolve.Cli", new DotNetCorePublishSettings
DotNetPublish("./src/Evolve.Cli", new DotNetPublishSettings
{
Configuration = configuration,
OutputDirectory = publishDir + "/cli/linux-x64",
Runtime = "linux-x64"
Runtime = "linux-x64",
SelfContained = true
});
});

Expand Down Expand Up @@ -155,19 +146,17 @@ Task("pack-evolve").WithCriteria(() => IsRunningOnWindows()).Does(() =>

Task("pack-evolve-tool").WithCriteria(() => IsRunningOnWindows()).Does(() =>
{
DotNetCorePack("./src/Evolve.Tool/", new DotNetCorePackSettings
DotNetPack("./src/Evolve.Tool/", new DotNetPackSettings
{
OutputDirectory = distDir,
Configuration = configuration,
NoRestore = false,
NoBuild = false
});
});

Task("default")
.IsDependentOn("clean")
.IsDependentOn("win-build")
.IsDependentOn("linux-build")
.IsDependentOn("build")
.IsDependentOn("test")
.IsDependentOn("report-coverage")
.IsDependentOn("win-publish-cli")
Expand Down
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>3.1.0-alpha3</Version>
<Version>3.1.0-alpha4</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/AspNetCoreSample_Evolve/AspNetCoreSample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Evolve" Version="2.3.0" />
Expand Down
12 changes: 6 additions & 6 deletions src/Evolve.Cli/Evolve.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PublishTrimmed>true</PublishTrimmed>
<RootNamespace>EvolveDb.Cli</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CassandraCSharpDriver" Version="3.16.2" />
<PackageReference Include="CassandraCSharpDriver" Version="3.17.1" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" />
<PackageReference Include="MySqlConnector" Version="1.2.1" />
<PackageReference Include="Npgsql" Version="5.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.7" />
<PackageReference Include="MySqlConnector" Version="2.1.0" />
<PackageReference Include="Npgsql" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Evolve.Tool/Evolve.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>
<ToolCommandName>evolve</ToolCommandName>
<RootNamespace>EvolveDb.Tool</RootNamespace>
Expand Down Expand Up @@ -36,12 +36,12 @@ Every time you build your project, it will automatically ensure that your databa
</ItemGroup>

<ItemGroup>
<PackageReference Include="CassandraCSharpDriver" Version="3.16.2" />
<PackageReference Include="CassandraCSharpDriver" Version="3.17.1" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" />
<PackageReference Include="MySqlConnector" Version="1.2.1" />
<PackageReference Include="Npgsql" Version="5.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.7" />
<PackageReference Include="MySqlConnector" Version="2.1.0" />
<PackageReference Include="Npgsql" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Evolve/Dialect/Cassandra/CassandraCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ public override string GetCurrentSchemaName()
new CassandraMetadataTable(schema, tableName, this);

/// <summary>
/// Will chekc for a predefined keyspace and table to see if there is a lock.
/// Will check for a predefined keyspace and table to see if there is a lock.
/// Otherwise, always returns true, because the lock is granted at table level.
/// <see cref="CassandraMetadataTable.TryLock"/>
/// </summary>
public override bool TryAcquireApplicationLock()
{
Expand Down Expand Up @@ -71,7 +70,6 @@ public override bool TryAcquireApplicationLock()

/// <summary>
/// Returns always true, because the lock is released at table level.
/// <see cref="CassandraMetadataTable.ReleaseLock"/>
/// </summary>
public override bool ReleaseApplicationLock() => true;

Expand Down
5 changes: 4 additions & 1 deletion src/Evolve/Dialect/SqlStatementBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal abstract class SqlStatementBuilderBase
/// </summary>
/// <remarks>
/// Placeholders are replaced by their values in the migration script.
/// The result is then parsed in sql statements: <see cref="Parse(string)"/>.
/// The result is then parsed in sql statements: <see cref="Parse(string, bool)"/>.
/// </remarks>
/// <param name="migrationScript"> The sql script to parse. </param>
/// <param name="placeholders"> The placeholders to replace. </param>
Expand All @@ -39,6 +39,9 @@ public virtual IEnumerable<SqlStatement> LoadSqlStatements(MigrationScript migra
return Parse(sql, migrationScript.IsTransactionEnabled);
}

/// <summary>
/// Parse a SQL script into a list of SQL statement to execute.
/// </summary>
protected abstract IEnumerable<SqlStatement> Parse(string sqlScript, bool transactionEnabled);
}
}
4 changes: 2 additions & 2 deletions src/Evolve/Evolve.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<LangVersion>latest</LangVersion>
Expand All @@ -24,6 +24,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Evolve/Metadata/IEvolveMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal interface IEvolveMetadata
/// <summary>
/// Update the checksum of a migration given its Id.
/// </summary>
/// <param name="id"> Id of the migration metadata to update. </param>
/// <param name="migrationId"> Id of the migration metadata to update. </param>
/// <param name="checksum"> The new checksum. </param>
void UpdateChecksum(int migrationId, string checksum);

Expand Down
3 changes: 2 additions & 1 deletion src/Evolve/Utilities/ConsoleTable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#pragma warning disable 1587
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
3 changes: 2 additions & 1 deletion src/Evolve/Utilities/SimpleJSON.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable disable
#pragma warning disable 1587
#nullable disable
/* * * * *
* A simple JSON Parser / builder
* ------------------------------
Expand Down
18 changes: 9 additions & 9 deletions test/Evolve.Tests/Evolve.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<RootNamespace>EvolveDb.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="altcover" Version="7.6.812" />
<PackageReference Include="CassandraCSharpDriver" Version="3.16.2" />
<PackageReference Include="Docker.DotNet" Version="3.125.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="MySqlConnector" Version="1.2.1" />
<PackageReference Include="Npgsql" Version="5.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.7" />
<PackageReference Include="altcover" Version="8.2.831" />
<PackageReference Include="CassandraCSharpDriver" Version="3.17.1" />
<PackageReference Include="Docker.DotNet" Version="3.125.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="MySqlConnector" Version="2.1.0" />
<PackageReference Include="Npgsql" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SQLServerContainer : IDbContainer
private bool _disposedValue = false;

public string Id => _container?.Id;
public string CnxStr => $"Server=127.0.0.1;Database={DbName};User Id={DbUser};Password={DbPwd};";
public string CnxStr => $"Server=127.0.0.1;Database={DbName};User Id={DbUser};Password={DbPwd};TrustServerCertificate=True";
public int TimeOutInSec => 60;

public bool Start(bool fromScratch = false)
Expand Down

0 comments on commit 074b629

Please sign in to comment.