Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgDangl committed Feb 21, 2024
2 parents d5e64e2 + adf1ed5 commit 057decb
Show file tree
Hide file tree
Showing 26 changed files with 491 additions and 365 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to **LightQuery** are documented here.

## v2.4.0:
- Added a dedicated target for .NET 8
- Added tests for .NET 8
- `forceRefresh` on the Angular client no longer causes a request if no base url for the service is configured
- Dropped tests and dedicated targets for .NET Framework 4.6.1, .NET Core 3.1 and .NET 5.0

## v2.3.0:
- Added a dedicated target for .NET 7
- Added tests for .NET 7
Expand Down
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pipeline {
KeyVaultBaseUrl = credentials('AzureCiKeyVaultBaseUrl')
KeyVaultClientId = credentials('AzureCiKeyVaultClientId')
KeyVaultClientSecret = credentials('AzureCiKeyVaultClientSecret')
KeyVaultTenantId = credentials('AzureKeyVaultTenantId')
}
stages {
stage ('Test') {
Expand Down
9 changes: 7 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$DotNetChannel = "STS"

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
Expand Down Expand Up @@ -63,7 +63,12 @@ else {
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="Current"
DOTNET_CHANNEL="STS"

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Expand Down Expand Up @@ -56,7 +56,12 @@ else
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
fi

echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
12 changes: 6 additions & 6 deletions build/.build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
Expand All @@ -11,11 +11,11 @@
</PropertyGroup>

<ItemGroup>
<PackageDownload Include="GitVersion.Tool" Version="[5.11.1]" />
<PackageReference Include="Nuke.Common" Version="6.2.1" />
<PackageReference Include="Nuke.WebDocu" Version="4.0.1" />
<PackageReference Include="Nuke.GitHub" Version="3.0.0" />
<PackageReference Include="ReportGenerator" Version="5.1.12" />
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
<PackageReference Include="Nuke.WebDocu" Version="5.0.1" />
<PackageReference Include="Nuke.GitHub" Version="5.0.1" />
<PackageReference Include="ReportGenerator" Version="5.2.1" />
<PackageReference Include="docfx.console" Version="2.59.4">
<ExcludeAssets>build</ExcludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
80 changes: 40 additions & 40 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.AzureKeyVault;
using Nuke.Common.Tools.AzureKeyVault.Attributes;
using Nuke.Common.Tools.Coverlet;
using Nuke.Common.Tools.DocFX;
using Nuke.Common.Tools.DotNet;
Expand All @@ -24,8 +23,6 @@
using System.Xml.Linq;
using System.Xml.XPath;
using static Nuke.Common.ChangeLog.ChangelogTasks;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.IO.XmlTasks;
using static Nuke.Common.Tools.DocFX.DocFXTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
Expand All @@ -34,34 +31,35 @@
using static Nuke.GitHub.ChangeLogExtensions;
using static Nuke.GitHub.GitHubTasks;
using static Nuke.WebDocu.WebDocuTasks;
using static Nuke.Common.IO.TextTasks;

class Build : NukeBuild
{
public static int Main () => Execute<Build>(x => x.Compile);

[KeyVaultSettings(
BaseUrlParameterName = nameof(KeyVaultBaseUrl),
ClientIdParameterName = nameof(KeyVaultClientId),
ClientSecretParameterName = nameof(KeyVaultClientSecret))]
readonly KeyVaultSettings KeyVaultSettings;
[AzureKeyVaultConfiguration(
BaseUrlParameterName = nameof(KeyVaultBaseUrl),
ClientIdParameterName = nameof(KeyVaultClientId),
ClientSecretParameterName = nameof(KeyVaultClientSecret),
TenantIdParameterName = nameof(KeyVaultTenantId))]
readonly AzureKeyVaultConfiguration KeyVaultSettings;

[KeyVault] readonly KeyVault KeyVault;
[AzureKeyVault] readonly AzureKeyVault KeyVault;

[Parameter] readonly string KeyVaultBaseUrl;
[Parameter] readonly string KeyVaultClientId;
[Parameter] readonly string KeyVaultClientSecret;
[Parameter] readonly string KeyVaultTenantId;

[GitVersion(Framework = "net6.0")] readonly GitVersion GitVersion;
[GitRepository] readonly GitRepository GitRepository;

[KeyVaultSecret] readonly string DocuBaseUrl;
[KeyVaultSecret] readonly string PublicMyGetSource;
[KeyVaultSecret] readonly string PublicMyGetApiKey;
[KeyVaultSecret] readonly string NuGetApiKey;
[KeyVaultSecret("LightQuery-DocuApiKey")] readonly string DocuApiKey;
[KeyVaultSecret] readonly string GitHubAuthenticationToken;
[KeyVaultSecret] readonly string DanglCiCdTeamsWebhookUrl;
[AzureKeyVaultSecret] readonly string DocuBaseUrl;
[AzureKeyVaultSecret] readonly string DanglPublicFeedSource;
[AzureKeyVaultSecret] readonly string FeedzAccessToken;
[AzureKeyVaultSecret] readonly string NuGetApiKey;
[AzureKeyVaultSecret("LightQuery-DocuApiKey")] readonly string DocuApiKey;
[AzureKeyVaultSecret] readonly string GitHubAuthenticationToken;
[AzureKeyVaultSecret] readonly string DanglCiCdTeamsWebhookUrl;

[Parameter] readonly string Configuration = IsLocalBuild ? "Debug" : "Release";

Expand Down Expand Up @@ -100,14 +98,14 @@ void SendTeamsMessage(string title, string message, bool isError)
Target Clean => _ => _
.Executes(() =>
{
GlobDirectories(SourceDirectory / "LightQuery", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(SourceDirectory / "LightQuery.Client", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(SourceDirectory / "LightQuery.EntityFrameworkCore", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(SourceDirectory / "LightQuery.Shared", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(SourceDirectory / "LightQuery.NSwag", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(SourceDirectory / "LightQuery.Swashbuckle", "**/bin", "**/obj").ForEach(DeleteDirectory);
GlobDirectories(RootDirectory / "test", "**/bin", "**/obj").ForEach(DeleteDirectory);
EnsureCleanDirectory(OutputDirectory);
(SourceDirectory / "LightQuery").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(SourceDirectory / "LightQuery.Client").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(SourceDirectory / "LightQuery.EntityFrameworkCore").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(SourceDirectory / "LightQuery.Shared").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(SourceDirectory / "LightQuery.NSwag").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(SourceDirectory / "LightQuery.Swashbuckle").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
(RootDirectory / "test").GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
OutputDirectory.CreateOrCleanDirectory();
});

Target Restore => _ => _
Expand Down Expand Up @@ -149,7 +147,8 @@ void SendTeamsMessage(string title, string message, bool isError)
.DependsOn(Compile)
.Executes(() =>
{
var testProjects = GlobFiles(SolutionDirectory / "test", "**/*.csproj")
var testProjects = (SolutionDirectory / "test").GlobFiles("**/*.csproj")
.Select(t => t.ToString())
.Where(t => !t.EndsWith("LightQuery.IntegrationTestsServer.csproj"))
.ToList();
Expand Down Expand Up @@ -211,9 +210,9 @@ void SendTeamsMessage(string title, string message, bool isError)
}
});

private void MakeSourceEntriesRelativeInCoberturaFormat(string coberturaReportPath)
private void MakeSourceEntriesRelativeInCoberturaFormat(AbsolutePath coberturaReportPath)
{
var originalText = ReadAllText(coberturaReportPath);
var originalText = coberturaReportPath.ReadAllText();
var xml = XDocument.Parse(originalText);

var xDoc = XDocument.Load(coberturaReportPath);
Expand Down Expand Up @@ -275,15 +274,16 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)

Target Push => _ => _
.DependsOn(Pack)
.Requires(() => PublicMyGetSource)
.Requires(() => PublicMyGetApiKey)
.Requires(() => DanglPublicFeedSource)
.Requires(() => FeedzAccessToken)
.Requires(() => NuGetApiKey)
.Requires(() => Configuration.EqualsOrdinalIgnoreCase("Release"))
.OnlyWhenDynamic(() => Jenkins.Instance == null
|| Jenkins.Instance.ChangeId == null)
.Executes(() =>
{
var packages = GlobFiles(OutputDirectory, "*.nupkg")
var packages = OutputDirectory.GlobFiles("*.nupkg")
.Select(p => p.ToString())
.Where(x => !x.EndsWith("symbols.nupkg"))
.ToList();
Assert.NotEmpty(packages);
Expand All @@ -292,8 +292,8 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)
{
DotNetNuGetPush(s => s
.SetTargetPath(x)
.SetSource(PublicMyGetSource)
.SetApiKey(PublicMyGetApiKey));
.SetSource(DanglPublicFeedSource)
.SetApiKey(FeedzAccessToken));
if (GitVersion.BranchName.Equals("master") || GitVersion.BranchName.Equals("origin/master"))
{
Expand Down Expand Up @@ -376,7 +376,7 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)
var completeChangeLog = $"## {releaseTag}" + Environment.NewLine + latestChangeLog;
var repositoryInfo = GetGitHubRepositoryInfo(GitRepository);
var nuGetPackages = GlobFiles(OutputDirectory, "*.nupkg").ToArray();
var nuGetPackages = OutputDirectory.GlobFiles("*.nupkg").Select(f => f.ToString()).ToArray();
Assert.NotEmpty(nuGetPackages);
await PublishRelease(x => x
Expand All @@ -391,7 +391,7 @@ await PublishRelease(x => x

void PrependFrameworkToTestresults()
{
var testResults = GlobFiles(OutputDirectory, "*testresults*.xml").ToList();
var testResults = OutputDirectory.GlobFiles("*testresults*.xml").ToList();
Serilog.Log.Debug($"Found {testResults.Count} test result files on which to append the framework.");
foreach (var testResultFile in testResults)
{
Expand Down Expand Up @@ -438,7 +438,7 @@ void PrependFrameworkToTestresults()
}

firstXdoc.Save(OutputDirectory / "testresults.xml");
testResults.ForEach(DeleteFile);
testResults.ForEach(d => d.DeleteFile());
}

string GetFrameworkNameFromFilename(string filename)
Expand All @@ -454,9 +454,9 @@ string GetFrameworkNameFromFilename(string filename)
.Executes(() =>
{
var ngAppDir = SourceDirectory / "ng-lightquery";
DeleteDirectory(ngAppDir / "dist");
DeleteDirectory(ngAppDir / "coverage");
DeleteFile(ngAppDir / "karma-results.xml");
(ngAppDir / "dist").DeleteDirectory();
(ngAppDir / "coverage").DeleteDirectory();
(ngAppDir / "karma-results.xml").DeleteFile();
Npm("ci", ngAppDir);
Npm("run test:ci", ngAppDir);
Expand All @@ -469,7 +469,7 @@ string GetFrameworkNameFromFilename(string filename)
{
var ngAppDir = SourceDirectory / "ng-lightquery";
var ngLibraryDir = ngAppDir / "dist" / "ng-lightquery";
DeleteDirectory(ngAppDir / "dist");
(ngAppDir / "dist").DeleteDirectory();
Npm("ci", ngAppDir);
Expand Down
10 changes: 3 additions & 7 deletions src/LightQuery.Client/LightQuery.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl</Authors>
<Company />
Expand All @@ -20,12 +20,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Reactive" Version="4.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;net5.0;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl</Authors>
<Company />
Expand All @@ -20,11 +20,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)'=='netstandard2.0' Or '$(TargetFramework)'=='net461'" Include="Microsoft.EntityFrameworkCore" Version="2.1.3" />
<PackageReference Condition="'$(TargetFramework)'=='netcoreapp3.1'" Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Condition="'$(TargetFramework)'=='net5.0'" Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Condition="'$(TargetFramework)'=='netstandard2.0'" Include="Microsoft.EntityFrameworkCore" Version="2.1.3" />
<PackageReference Condition="'$(TargetFramework)'=='net6.0'" Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Condition="'$(TargetFramework)'=='net7.0'" Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Condition="'$(TargetFramework)'=='net8.0'" Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/LightQuery.NSwag/LightQuery.NSwag.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl</Authors>
<Company />
Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NSwag.AspNetCore" Version="13.18.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/LightQuery.Shared/LightQuery.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl</Authors>
<Company />
Expand All @@ -19,11 +19,11 @@
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' Or '$(TargetFramework)'=='net5.0' Or '$(TargetFramework)'=='net7.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net7.0' Or '$(TargetFramework)'=='net8.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0' Or '$(TargetFramework)'=='net461'">
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/LightQuery.Swashbuckle/LightQuery.Swashbuckle.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl, Berkay AKÇAY</Authors>
<Company />
Expand All @@ -23,7 +23,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/LightQuery/LightQuery.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Georg Dangl</Authors>
<Company />
Expand Down
Loading

0 comments on commit 057decb

Please sign in to comment.