diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3d430b0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "16:00" + timezone: "Europe/Copenhagen" + + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "16:00" + timezone: "Europe/Copenhagen" + groups: + xunit: + patterns: + - "xunit*" + - "Verify*" + nuke: + patterns: + - "Nuke*" + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 428de66..7c522bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: 2.1.x 3.1.x 6.0.x - 7.0.x + 8.0.x - name: Run NUKE run: ./build.ps1 @@ -66,7 +66,7 @@ jobs: 2.1.x 3.1.x 6.0.x - 7.0.x + 8.0.x - name: Run NUKE run: ./build.sh UnitTests diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 4cb8eff..de783be 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,53 +1,70 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "ApiChecks", + "CalculateNugetVersion", + "Clean", + "CodeCoverage", + "Compile", + "Pack", + "Push", + "Restore", + "UnitTests", + "UnitTestsNetCore", + "UnitTestsNetFramework" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" }, - "GenerateBinLog": { - "type": "boolean", - "description": "Use this parameter if you encounter build problems in any way, to generate a .binlog file which holds some useful information" - }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", "description": "Disables displaying the NUKE logo" }, - "NuGetApiKey": { - "type": "string", - "description": "The key to push to Nuget", - "default": "Secrets must be entered via 'nuke :secrets [profile]'" - }, "Partition": { "type": "string", "description": "Partition to use on CI" @@ -71,57 +88,46 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "ApiChecks", - "CalculateNugetVersion", - "Clean", - "CodeCoverage", - "Compile", - "Pack", - "Push", - "Restore", - "UnitTests", - "UnitTestsNetCore", - "UnitTestsNetFramework" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "ApiChecks", - "CalculateNugetVersion", - "Clean", - "CodeCoverage", - "Compile", - "Pack", - "Push", - "Restore", - "UnitTests", - "UnitTestsNetCore", - "UnitTestsNetFramework" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "GenerateBinLog": { + "type": [ + "boolean", + "null" + ], + "description": "Use this parameter if you encounter build problems in any way, to generate a .binlog file which holds some useful information" + }, + "NuGetApiKey": { + "type": "string", + "description": "The key to push to Nuget", + "default": "Secrets must be entered via 'nuke :secrets [profile]'" + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" } } + }, + { + "$ref": "#/definitions/NukeBuild" } - } + ] } diff --git a/Build/Build.cs b/Build/Build.cs index cf566f1..7a926be 100644 --- a/Build/Build.cs +++ b/Build/Build.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using LibGit2Sharp; using Nuke.Common; using Nuke.Common.CI.GitHubActions; using Nuke.Common.Execution; @@ -12,10 +10,8 @@ using Nuke.Common.Tools.GitVersion; using Nuke.Common.Tools.ReportGenerator; using Nuke.Common.Tools.Xunit; +using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; -using Nuke.Components; -using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.IO.PathConstruction; using static Nuke.Common.Tools.DotNet.DotNetTasks; using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks; using static Nuke.Common.Tools.Xunit.XunitTasks; diff --git a/Build/_build.csproj b/Build/_build.csproj index bfe414e..bac67c7 100644 --- a/Build/_build.csproj +++ b/Build/_build.csproj @@ -1,18 +1,19 @@ Exe - net6.0 + net8.0 CS0649;CS0169 ..\ ..\ + 1 - - - + + + diff --git a/Directory.Build.props b/Directory.Build.props index 2117787..eb11633 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,15 +27,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Src/FluentAssertions.DataSets/Common/AssertionChainExtensions.cs b/Src/FluentAssertions.DataSets/Common/AssertionChainExtensions.cs index 97b756d..bf21064 100644 --- a/Src/FluentAssertions.DataSets/Common/AssertionChainExtensions.cs +++ b/Src/FluentAssertions.DataSets/Common/AssertionChainExtensions.cs @@ -11,7 +11,7 @@ internal static class AssertionChainExtensions /// public static AssertionChain For(this AssertionChain chain, IEquivalencyValidationContext context) { - chain.OverrideCallerIdentifier(() => context.CurrentNode.Description); + chain.OverrideCallerIdentifier(() => context.CurrentNode.Subject.Description); return chain .WithReportable("configuration", () => context.Options.ToString()) diff --git a/Src/FluentAssertions.DataSets/DataColumnAssertions.cs b/Src/FluentAssertions.DataSets/DataColumnAssertions.cs index 4658faf..2bd640d 100644 --- a/Src/FluentAssertions.DataSets/DataColumnAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataColumnAssertions.cs @@ -102,7 +102,7 @@ public AndConstraint BeEquivalentTo(DataColumn expectation /// A reference to the configuration object that can be used /// to influence the way the object graphs are compared. You can also provide an alternative instance of the /// class. The global defaults are determined by the - /// class. + /// class. /// /// /// A formatted phrase as is supported by explaining why the assertion @@ -118,7 +118,7 @@ public AndConstraint BeEquivalentTo(DataColumn expectation { Guard.ThrowIfArgumentIsNull(config); - var defaults = new DataEquivalencyAssertionOptions(AssertionOptions.CloneDefaults()); + var defaults = new DataEquivalencyAssertionOptions(AssertionConfiguration.Current.Equivalency.CloneDefaults()); config(defaults); ((object)Subject).Should().BeEquivalentTo(expectation, _ => defaults, because, becauseArgs); diff --git a/Src/FluentAssertions.DataSets/DataRowAssertions.cs b/Src/FluentAssertions.DataSets/DataRowAssertions.cs index d96263d..0cad324 100644 --- a/Src/FluentAssertions.DataSets/DataRowAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataRowAssertions.cs @@ -174,7 +174,7 @@ public AndConstraint> BeEquivalentTo(DataRow expecta /// A reference to the configuration object that can be used /// to influence the way the object graphs are compared. You can also provide an alternative instance of the /// class. The global defaults are determined by the - /// class. + /// class. /// /// /// A formatted phrase as is supported by explaining why the assertion @@ -190,7 +190,7 @@ public AndConstraint> BeEquivalentTo(DataRow expecta { Guard.ThrowIfArgumentIsNull(config); - var defaults = new DataEquivalencyAssertionOptions(AssertionOptions.CloneDefaults()); + var defaults = new DataEquivalencyAssertionOptions(AssertionConfiguration.Current.Equivalency.CloneDefaults()); config(defaults); ((object)Subject).Should().BeEquivalentTo(expectation, _ => defaults, because, becauseArgs); diff --git a/Src/FluentAssertions.DataSets/DataSetAssertions.cs b/Src/FluentAssertions.DataSets/DataSetAssertions.cs index 31ba8fd..fa02224 100644 --- a/Src/FluentAssertions.DataSets/DataSetAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataSetAssertions.cs @@ -228,7 +228,7 @@ public AndConstraint> BeEquivalentTo(DataSet expecta /// A reference to the configuration object that can be used /// to influence the way the object graphs are compared. You can also provide an alternative instance of the /// class. The global defaults are determined by the - /// class. + /// class. /// /// /// A formatted phrase as is supported by explaining why the assertion @@ -244,7 +244,7 @@ public AndConstraint> BeEquivalentTo(DataSet expecta { Guard.ThrowIfArgumentIsNull(config); - var defaults = new DataEquivalencyAssertionOptions(AssertionOptions.CloneDefaults()); + var defaults = new DataEquivalencyAssertionOptions(AssertionConfiguration.Current.Equivalency.CloneDefaults()); config(defaults); ((object)Subject).Should().BeEquivalentTo(expectation, _ => defaults, because, becauseArgs); diff --git a/Src/FluentAssertions.DataSets/DataTableAssertions.cs b/Src/FluentAssertions.DataSets/DataTableAssertions.cs index d64276f..8d83d75 100644 --- a/Src/FluentAssertions.DataSets/DataTableAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataTableAssertions.cs @@ -241,7 +241,7 @@ public AndConstraint> BeEquivalentTo(DataTable e /// A reference to the configuration object that can be used /// to influence the way the object graphs are compared. You can also provide an alternative instance of the /// class. The global defaults are determined by the - /// class. + /// class. /// /// /// A formatted phrase as is supported by explaining why the assertion @@ -257,7 +257,7 @@ public AndConstraint> BeEquivalentTo(DataTable e { Guard.ThrowIfArgumentIsNull(config); - var defaults = new DataEquivalencyAssertionOptions(AssertionOptions.CloneDefaults()); + var defaults = new DataEquivalencyAssertionOptions(AssertionConfiguration.Current.Equivalency.CloneDefaults()); config(defaults); ((object)Subject).Should().BeEquivalentTo(expectation, _ => defaults, because, becauseArgs); diff --git a/Src/FluentAssertions.DataSets/Equivalency/ConstraintEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/ConstraintEquivalencyStep.cs index c86df19..f701425 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/ConstraintEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/ConstraintEquivalencyStep.cs @@ -28,7 +28,7 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc var expectation = (Constraint)comparands.Expectation; var selectedMembers = GetMembersFromExpectation(comparands, context.CurrentNode, context.Options) - .ToDictionary(member => member.Name); + .ToDictionary(member => member.Expectation.Name); CompareCommonProperties(context, nestedValidator, context.Options, subject, expectation, selectedMembers, assertionChain); diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs index aa2942b..ae3034e 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs @@ -64,7 +64,7 @@ private static void CompareSubjectAndExpectationOfTypeDataColumn(Comparands comp { foreach (IMember expectationMember in GetMembersFromExpectation(context.CurrentNode, comparands, context.Options)) { - if (expectationMember.Name != nameof(subject.Table)) + if (expectationMember.Expectation.Name != nameof(subject.Table)) { CompareMember(expectationMember, comparands, parent, context, assertionChain); } @@ -139,6 +139,6 @@ private static IEnumerable GetMembersFromExpectation(INode currentNode, new MemberSelectionContext(comparands.CompileTimeType, comparands.RuntimeType, config)); } - return members.Where(member => CandidateMembers.Contains(member.Name)); + return members.Where(member => CandidateMembers.Contains(member.Expectation.Name)); } } diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs index d8d4bb1..cab4772 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs @@ -40,7 +40,7 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc else { var selectedMembers = GetMembersFromExpectation(context.CurrentNode, comparands, context.Options) - .ToDictionary(member => member.Name); + .ToDictionary(member => member.Expectation.Name); CompareScalarProperties(subject, expectation, selectedMembers, assertionChain); diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs index b03d1f4..da825cd 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs @@ -210,8 +210,8 @@ private static SelectedDataRowMembers GetMembersFromExpectation(Comparands compa selectedDataRowMembers = new SelectedDataRowMembers { - HasErrors = selectedMembers.Any(m => m.Name == nameof(DataRow.HasErrors)), - RowState = selectedMembers.Any(m => m.Name == nameof(DataRow.RowState)) + HasErrors = selectedMembers.Any(m => m.Expectation.Name == nameof(DataRow.HasErrors)), + RowState = selectedMembers.Any(m => m.Expectation.Name == nameof(DataRow.RowState)) }; SelectedMembersCache.TryAdd(cacheKey, selectedDataRowMembers); diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataSetEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataSetEquivalencyStep.cs index 65ddc3e..1a0a557 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataSetEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataSetEquivalencyStep.cs @@ -48,7 +48,7 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc } var selectedMembers = GetMembersFromExpectation(comparands, context.CurrentNode, context.Options) - .ToDictionary(member => member.Name); + .ToDictionary(member => member.Expectation.Name); CompareScalarProperties(subject, expectation, selectedMembers, assertionChain); diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs index c656dde..c6aed5f 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs @@ -52,7 +52,7 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc } var selectedMembers = GetMembersFromExpectation(context.CurrentNode, comparands, context.Options) - .ToDictionary(member => member.Name); + .ToDictionary(member => member.Expectation.Name); CompareScalarProperties(subject, expectation, selectedMembers, assertionChain); diff --git a/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs b/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs index 300707a..af55f73 100644 --- a/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs +++ b/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs @@ -1,6 +1,7 @@ using System.Data; using System.Linq; using FluentAssertions.DataSets.Equivalency; +using FluentAssertions.Equivalency; using FluentAssertions.Equivalency.Steps; namespace FluentAssertions.DataSets; diff --git a/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj b/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj index 50bb0d2..1930e9d 100644 --- a/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj +++ b/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj @@ -39,9 +39,9 @@ - - - + + + diff --git a/Src/FluentAssertions.DataSets/InitializeDataSetSupport.cs b/Src/FluentAssertions.DataSets/InitializeDataSetSupport.cs index 250e52c..93fa8e7 100644 --- a/Src/FluentAssertions.DataSets/InitializeDataSetSupport.cs +++ b/Src/FluentAssertions.DataSets/InitializeDataSetSupport.cs @@ -21,7 +21,7 @@ public static void Initialize() { lock (SyncObject) { - AssertionOptions.EquivalencyPlan.AddDataSetSupport(); + AssertionConfiguration.Current.Equivalency.Plan.AddDataSetSupport(); } } } diff --git a/Tests/Approval.Tests/Approval.Tests.csproj b/Tests/Approval.Tests/Approval.Tests.csproj index 9b1ebe8..67e9051 100644 --- a/Tests/Approval.Tests/Approval.Tests.csproj +++ b/Tests/Approval.Tests/Approval.Tests.csproj @@ -5,16 +5,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt index 226e715..be63c21 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt @@ -96,7 +96,7 @@ namespace FluentAssertions.DataSets } public static class EquivalencyAssertionOptionsExtensions { - public static void AddDataSetSupport(this FluentAssertions.EquivalencyPlan plan) { } + public static void AddDataSetSupport(this FluentAssertions.Equivalency.EquivalencyPlan plan) { } } public interface IDataEquivalencyAssertionOptions : FluentAssertions.Equivalency.IEquivalencyOptions { diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt index 226e715..be63c21 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt @@ -96,7 +96,7 @@ namespace FluentAssertions.DataSets } public static class EquivalencyAssertionOptionsExtensions { - public static void AddDataSetSupport(this FluentAssertions.EquivalencyPlan plan) { } + public static void AddDataSetSupport(this FluentAssertions.Equivalency.EquivalencyPlan plan) { } } public interface IDataEquivalencyAssertionOptions : FluentAssertions.Equivalency.IEquivalencyOptions { diff --git a/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj b/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj index f5fea20..e4e7d1f 100644 --- a/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj +++ b/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/FluentAssertions.DataSets.Specs/InitializeDataSetSupport.cs b/Tests/FluentAssertions.DataSets.Specs/InitializeDataSetSupport.cs index fe5ef16..f7b507c 100644 --- a/Tests/FluentAssertions.DataSets.Specs/InitializeDataSetSupport.cs +++ b/Tests/FluentAssertions.DataSets.Specs/InitializeDataSetSupport.cs @@ -14,6 +14,6 @@ public static class InitializeDataSetSupport public static void Initialize() #pragma warning restore CA1822 { - AssertionOptions.EquivalencyPlan.AddDataSetSupport(); + AssertionConfiguration.Current.Equivalency.Plan.AddDataSetSupport(); } } diff --git a/build.cmd b/build.cmd old mode 100644 new mode 100755 diff --git a/build.ps1 b/build.ps1 index f21bd61..4634dc0 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,18 +14,14 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent ########################################################################### $BuildProjectFile = "$PSScriptRoot\build\_build.csproj" -$TempDirectory = "$PSScriptRoot\.nuke\temp" +$TempDirectory = "$PSScriptRoot\\.nuke\temp" -$DotNetGlobalFile = "$PSScriptRoot\global.json" +$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 -$env:DOTNET_MULTILEVEL_LOOKUP = 0 -$env:DOTNET_ROLL_FORWARD = "Major" -$env:NUKE_TELEMETRY_OPTOUT = 1 -$env:DOTNET_CLI_UI_LANGUAGE = "en-US" +$env:DOTNET_NOLOGO = 1 ########################################################################### # EXECUTION @@ -36,18 +32,9 @@ function ExecSafe([scriptblock] $cmd) { if ($LASTEXITCODE) { exit $LASTEXITCODE } } -# Print environment variables -# WARNING: Make sure that secrets are actually scrambled in build log -# Get-Item -Path Env:* | Sort-Object -Property Name | ForEach-Object {"{0}={1}" -f $_.Name,$_.Value} - -# Check if any dotnet is installed -if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) { - ExecSafe { & dotnet --info } -} - # If dotnet CLI is installed globally and it matches requested version, use for execution if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` - $(dotnet --version) -and $LASTEXITCODE -eq 0) { + $(dotnet --version) -and $LASTEXITCODE -eq 0) { $env:DOTNET_EXE = (Get-Command "dotnet").Path } else { @@ -73,9 +60,15 @@ else { ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } } $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" + $env:PATH = "$DotNetDirectory;$env:PATH" } -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 } +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 } diff --git a/build.sh b/build.sh index d691404..b66bc95 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,4 @@ + #!/usr/bin/env bash bash --version 2>&1 | head -n 1 @@ -10,18 +11,14 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) ########################################################################### BUILD_PROJECT_FILE="$SCRIPT_DIR/Build/_build.csproj" -TEMP_DIRECTORY="$SCRIPT_DIR/.nuke/temp" +TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp" -DOTNET_GLOBAL_FILE="$SCRIPT_DIR/global.json" +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 -export DOTNET_MULTILEVEL_LOOKUP=0 -export DOTNET_ROLL_FORWARD="Major" -export NUKE_TELEMETRY_OPTOUT=1 -export DOTNET_CLI_UI_LANGUAGE="en-US" +export DOTNET_NOLOGO=1 ########################################################################### # EXECUTION @@ -31,15 +28,6 @@ function FirstJsonValue { perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}" } -# Print environment variables -# WARNING: Make sure that secrets are actually scrambled in build log -# env | sort - -# Check if any dotnet is installed -if [[ -x "$(command -v dotnet)" ]]; then - dotnet --info -fi - # If dotnet CLI is installed globally and it matches requested version, use for execution if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then export DOTNET_EXE="$(command -v dotnet)" @@ -66,9 +54,15 @@ else "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path fi export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet" + export PATH="$DOTNET_DIRECTORY:$PATH" 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 +"$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 -- "$@" diff --git a/global.json b/global.json index 87f1d59..96ca5e0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.101", + "version": "8.0.404", "rollForward": "latestMajor" } }