diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json new file mode 100644 index 0000000..b0eae76 --- /dev/null +++ b/.nuke/build.schema.json @@ -0,0 +1,251 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/build", + "title": "Build Schema", + "definitions": { + "build": { + "type": "object", + "properties": { + "AdditionalBuildMetadata": { + "type": "string", + "description": "Additional build metadata that is attached to the assembly informational version" + }, + "AssemblySigningKeyFile": { + "type": "string", + "description": "Path to the key file containing the signing key" + }, + "Configurations": { + "type": "array", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "items": { + "type": "string" + } + }, + "Continue": { + "type": "boolean", + "description": "Indicates to continue a previously failed build attempt" + }, + "DependDBNugetConfig": { + "type": "string" + }, + "DependDBNuGetSources": { + "type": "string" + }, + "DependDBProjectBranch": { + "type": "string" + }, + "DependDBProjectImportNotificationMailAddress": { + "type": "string" + }, + "DependDBProjectImportNotificationMailAddressCc": { + "type": "string" + }, + "DependDBProjectName": { + "type": "string" + }, + "DependDBProjectVersion": { + "type": "string" + }, + "DependDBRetentionTime": { + "type": "string" + }, + "DependDBTargetFramework": { + "type": "string" + }, + "DependDBTrackedReferences": { + "type": "string" + }, + "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", + "TestHost", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "LogFolder": { + "type": "string", + "description": "Path to the log folder where log files are put" + }, + "NoLogo": { + "type": "boolean", + "description": "Disables displaying the NUKE logo" + }, + "OutputFolder": { + "type": "string", + "description": "Path to the output folder where build artifacts are put" + }, + "Partition": { + "type": "string", + "description": "Partition to use on CI" + }, + "Plan": { + "type": "boolean", + "description": "Shows the execution plan (HTML)" + }, + "Profile": { + "type": "array", + "description": "Defines the profiles to load", + "items": { + "type": "string" + } + }, + "Root": { + "type": "string", + "description": "Root directory during build execution" + }, + "Skip": { + "type": "array", + "description": "List of targets to be skipped. Empty list skips all dependencies", + "items": { + "type": "string", + "enum": [ + "AddRemotionPackagingArtefacts", + "Build", + "CIBuild", + "Clean", + "CreateTestMatrix", + "CreateTestPlan", + "DetermineBuildMetadata", + "DetermineProjectMetadata", + "DetermineTestResources", + "FullBuild", + "GenerateDependDBOutput", + "GenerateSbom", + "NightlyBuild", + "Pack", + "Restore", + "Test", + "VerifyTestParameters" + ] + } + }, + "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": [ + "AddRemotionPackagingArtefacts", + "Build", + "CIBuild", + "Clean", + "CreateTestMatrix", + "CreateTestPlan", + "DetermineBuildMetadata", + "DetermineProjectMetadata", + "DetermineTestResources", + "FullBuild", + "GenerateDependDBOutput", + "GenerateSbom", + "NightlyBuild", + "Pack", + "Restore", + "Test", + "VerifyTestParameters" + ] + } + }, + "TempFolder": { + "type": "string", + "description": "Path to the temp folder where temporary build files are put" + }, + "TestConfigurations": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Debug", + "Release" + ] + } + }, + "TestExecutionRuntimes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Docker_Win_NET462", + "Docker_Win_NET472", + "Docker_Win_NET48", + "EnforcedLocalMachine", + "LocalMachine" + ] + } + }, + "TestFilter": { + "type": "string", + "description": "Executes only tests that match the specified test filter" + }, + "TestPlatforms": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "x64", + "x86" + ] + } + }, + "TestSqlServers": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "NoDB" + ] + } + }, + "TestTargetRuntimes": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "NET462", + "NET472" + ] + } + }, + "UseReleaseVersioning": { + "type": "boolean", + "description": "Uses release instead of debug versioning when determining the build versions" + }, + "VcsUrlTemplate": { + "type": "string" + }, + "Verbosity": { + "type": "string", + "description": "Logging verbosity during build execution. Default is 'Normal'", + "enum": [ + "Minimal", + "Normal", + "Quiet", + "Verbose" + ] + } + } + } + } +} diff --git a/.nuke/parameters.ci.json b/.nuke/parameters.ci.json new file mode 100644 index 0000000..a687509 --- /dev/null +++ b/.nuke/parameters.ci.json @@ -0,0 +1,17 @@ +{ + "$schema": "./build.schema.json", + "Target": [ "CIBuild" ], + "TestConfigurations": [ "Debug" ], + "TestExecutionRuntimes": [ "Docker_Win_NET462", "Docker_Win_NET472", "Docker_Win_NET48" ], + "TestPlatforms": [ "x86" ], + "TestTargetRuntimes": [ "NET472", "NET462" ], + "TestBrowsers": [ "NoBrowser" ], + "TestSqlServers": [ "NoDB" ], + "SkipCleanProjects": "False", + "SkipTests": "False", + "SkipDocumentation": "True", + "SkipNuGetOrg": "True", + "SkipSourceLinks": "True", + "SkipNuGet": "True", + "SkipDependDB": "True" +} \ No newline at end of file diff --git a/.nuke/parameters.full.json b/.nuke/parameters.full.json new file mode 100644 index 0000000..d1c40eb --- /dev/null +++ b/.nuke/parameters.full.json @@ -0,0 +1,17 @@ +{ + "$schema": "./build.schema.json", + "Target": [ "FullBuild" ], + "TestConfigurations": [ "Debug", "Release" ], + "TestExecutionRuntimes": [ "Docker_Win_NET462", "Docker_Win_NET472", "Docker_Win_NET48" ], + "TestPlatforms": [ "x86", "x64" ], + "TestTargetRuntimes": ["NET472", "NET462" ], + "TestBrowsers": [ "NoBrowser" ], + "TestSqlServers": [ "NoDB" ], + "SkipCleanProjects": "False", + "SkipTests": "False", + "SkipDocumentation": "False", + "SkipNuGetOrg": "False", + "SkipSourceLinks": "False", + "SkipNuGet": "False", + "SkipDependDB": "False" +} \ No newline at end of file diff --git a/.nuke/parameters.json b/.nuke/parameters.json new file mode 100644 index 0000000..c9a6334 --- /dev/null +++ b/.nuke/parameters.json @@ -0,0 +1,13 @@ +{ + "$schema": "./build.schema.json", + "Solution": "Remotion-IO.sln", + "DependDBProjectName": "re-motion Framework (www.re-motion.org)", + "DependDBRetentionTime": "30", + "DependDBProjectBranch": "Main", + "DependDBProjectImportNotificationMailAddress": "nonexistent@nonexistent.nonexistent", + "DependDBProjectImportNotificationMailAddressCc": "nonexistent@nonexistent.nonexistent", + "DependDBTrackedReferences": "Remotion.*", + "DependDBNugetConfig": "~/nuget.config", + "DependDBTargetFramework": "net462", + "VcsUrlTemplate": "example.com" +} diff --git a/.nuke/parameters.local.json b/.nuke/parameters.local.json new file mode 100644 index 0000000..30764fa --- /dev/null +++ b/.nuke/parameters.local.json @@ -0,0 +1,17 @@ +{ + "$schema": "./build.schema.json", + "Target": [ "CIBuild" ], + "TestConfigurations": [ "Debug" ], + "TestExecutionRuntimes": [ "LocalMachine" ], + "TestPlatforms": [ "x86" ], + "TestTargetRuntimes": [ "NET462" ], + "TestBrowsers": [ "NoBrowser" ], + "TestSqlServers": [ "NoDB" ], + "SkipCleanProjects": "False", + "SkipTests": "False", + "SkipDocumentation": "True", + "SkipNuGetOrg": "True", + "SkipSourceLinks": "True", + "SkipNuGet": "True", + "SkipDependDB": "True" +} \ No newline at end of file diff --git a/.nuke/parameters.nightly.json b/.nuke/parameters.nightly.json new file mode 100644 index 0000000..851b629 --- /dev/null +++ b/.nuke/parameters.nightly.json @@ -0,0 +1,17 @@ +{ + "$schema": "./build.schema.json", + "Target": [ "NightlyBuild" ], + "TestConfigurations": [ "Debug", "Release" ], + "TestExecutionRuntimes": [ "Docker_Win_NET462", "Docker_Win_NET472", "Docker_Win_NET48" ], + "TestPlatforms": [ "x86", "x64" ], + "TestTargetRuntimes": [ "NET472", "NET462" ], + "TestBrowsers": [ "NoBrowser" ], + "TestSqlServers": [ "NoDB" ], + "SkipCleanProjects": "False", + "SkipTests": "False", + "SkipDocumentation": "False", + "SkipNuGetOrg": "False", + "SkipSourceLinks": "False", + "SkipNuGet": "False", + "SkipDependDB": "False" +} \ No newline at end of file diff --git a/Build.cmd b/Build.cmd index 4289909..b08cc59 100644 --- a/Build.cmd +++ b/Build.cmd @@ -1,124 +1,7 @@ -@echo off -pushd %~dp0 +:; set -eo pipefail +:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +:; ${SCRIPT_DIR}/build.sh "$@" +:; exit $? -set program-path=%ProgramFiles% -set program-pathX86=%ProgramFiles(x86)% -if not exist "%program-pathX86%" set program-pathX86=%program-path% -set msbuild="%program-pathX86%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" -if not exist %msbuild% set msbuild="%program-path%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" -if not exist %msbuild% set msbuild="%program-path%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" -if not exist %msbuild% set msbuild="%program-path%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" - -set log-dir=build\BuildOutput\log -set nuget-bin=build\BuildOutput\temp\nuget-bin -set nuget=%nuget-bin%\nuget.exe -set nuget-download=powershell.exe -NoProfile -Command "& {(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','%nuget%')}" -set solutionFile=Remotion-IO.sln - -if not exist remotion.snk goto nosnk - -if not [%1]==[] goto %1 - -echo Welcome to the re-motion build tool! -echo. -echo Using %msbuild% -echo. -echo Choose your desired build: -echo [1] ... Test build ^(x86-debug^) -echo [2] ... Full build ^(x86-debug/release, x64-debug/release^) -rem echo [3] ... Quick build ^(x86-debug, no tests are run^) -echo [4] ... Docs build ^(x86-debug if not present, docs^) -echo Requires Sandcastle Help File Builder to be installed! -echo [5] ... Package ^(create zip package from pre-existent build^) -echo [6] ... Run DependDB -echo [7] ... Oops, nothing please - exit. -echo. - -choice /c:1234567 /n /m "Your choice: " - -if %ERRORLEVEL%==1 goto run_test_build -if %ERRORLEVEL%==2 goto run_full_build -if %ERRORLEVEL%==3 goto run_quick_build -if %ERRORLEVEL%==4 goto run_docs_build -if %ERRORLEVEL%==5 goto run_pkg_build -if %ERRORLEVEL%==6 goto run_dependdb -if %ERRORLEVEL%==7 goto run_exit -goto build_succeeded - -:run_test_build -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:TestBuild /maxcpucount /verbosity:normal /flp:verbosity=normal;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_full_build -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:FullBuildWithoutDocumentation /maxcpucount /verbosity:normal /flp:verbosity=normal;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_quick_build -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:QuickBuild /maxcpucount /verbosity:normal /flp:verbosity=normal;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_docs_build -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:DocumentationBuild /maxcpucount /verbosity:minimal /flp:verbosity=normal;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_pkg_build -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:PackageBuild /maxcpucount /verbosity:minimal /flp:verbosity=normal;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_dependdb -mkdir %log-dir% -mkdir %nuget-bin% -%nuget-download% -%nuget% restore %solutionFile% -NonInteractive -%msbuild% build\Remotion.Local.build /t:DependDBBuild /maxcpucount /verbosity:normal /flp:verbosity=detailed;logfile=build\BuildOutput\log\build.log -if not %ERRORLEVEL%==0 goto build_failed -goto build_succeeded - -:run_exit -exit /b 0 - - -:build_failed -echo. -echo Building re-motion has failed. -start build\BuildOutput\log\build.log -pause -popd -exit /b 1 - -:build_succeeded -echo. -pause -popd -exit /b 0 - -:nosnk -echo remotion.snk does not exist. Please run Generate-Snk.cmd from a Visual Studio Command Prompt. -pause -popd -exit /b 2 +@ECHO OFF +powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* diff --git a/Build/Build.cs b/Build/Build.cs new file mode 100644 index 0000000..ea2beeb --- /dev/null +++ b/Build/Build.cs @@ -0,0 +1,158 @@ +// This file is part of the re-motion Core Framework (www.re-motion.org) +// Copyright (c) rubicon IT GmbH, www.rubicon.eu +// +// The re-motion Core Framework is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// re-motion is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with re-motion; if not, see http://www.gnu.org/licenses. +// +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using Customizations; +using JetBrains.Annotations; +using NuGet.Versioning; +using Nuke.Common; +using Nuke.Common.IO; +using Nuke.Common.ProjectModel; +using Remotion.BuildScript; +using Remotion.BuildScript.Components; +using Remotion.BuildScript.GenerateSbom; +using Remotion.BuildScript.Test; +using Remotion.BuildScript.Test.Dimensions; +using Remotion.BuildScript.Test.Runtimes; +using static Customizations.Databases; +using static Remotion.BuildScript.Test.Dimensions.Configurations; +using static Remotion.BuildScript.Test.Dimensions.ExecutionRuntimes; +using static Remotion.BuildScript.Test.Dimensions.OperatingSystems; +using static Remotion.BuildScript.Test.Dimensions.Platforms; +using static Remotion.BuildScript.Test.Dimensions.TargetFrameworks; + +// ReSharper disable RedundantTypeArgumentsOfMethod + +class Build : RemotionBuild, IDependDB, ITest +{ + + [Parameter(ValueProviderMember = nameof(SupportedTestSqlServers), Separator = "+")] + public string[] TestSqlServers { get; set; } = []; + + [CanBeNull] private TestMatrix _databaseTestMatrix; + [CanBeNull] private TestMatrix _normalTestMatrix; + + + public static int Main () => Execute(); + + [UsedImplicitly] + public Target AddRemotionPackagingArtefacts => _ => _ + .TriggeredBy() + .Executes (() => { }); + + public override void ConfigureProjects (ProjectsBuilder projects) + { + [CanBeNull] + static TestConfiguration CreateTestConfiguration ( + [CanBeNull] TestMatrix testMatrix, + ITestExecutionRuntimeFactory testExecutionRuntimeFactory, + ImmutableArray testExecutionWrappers) + { + return testMatrix != null + ? new TestConfiguration(testExecutionRuntimeFactory, testMatrix, testExecutionWrappers) + : null; + } + + var testExecutionRuntimeFactory = new DefaultTestExecutionRuntimeFactory(NullDockerRunSettingsCustomizer.Instance); + + // NOTE: Test matrices might be null if the CreateTestMatrix step was not called. + // This is intended behavior as we want to support partial builds. + // If there is no test matrix, the test configuration will be null as well. + + var normalTestConfiguration = CreateTestConfiguration( + _normalTestMatrix, + testExecutionRuntimeFactory, + ImmutableArray.Empty); + + projects.AddReleaseProject("Core"); + projects.AddReleaseProject("Archive.Zip"); + + projects.AddUnitTestProject("Archive.Zip.UnitTests", normalTestConfiguration); + projects.AddUnitTestProject("UnitTests", normalTestConfiguration); + } + + public override void ConfigureSupportedTestDimensions (SupportedTestDimensionsBuilder supportedTestDimensions) + { + supportedTestDimensions.AddOperatingSystemsDimension(); + supportedTestDimensions.AddSupportedDimension(LocalMachine, EnforcedLocalMachine, Docker_Win_NET48, Docker_Win_NET472, Docker_Win_NET462); + supportedTestDimensions.AddSupportedDimension(NET472, NET462); + supportedTestDimensions.AddSupportedDimension(Debug, Release); + supportedTestDimensions.AddSupportedDimension(x64, x86); + supportedTestDimensions.AddSupportedDimension(NoDB); + } + + public override void ConfigureEnabledTestDimensions (EnabledTestDimensionsBuilder enabledTestDimensions) + { + base.ConfigureEnabledTestDimensions(enabledTestDimensions); + + enabledTestDimensions.AddEnabledOperatingSystems(); + + if (SupportedTestDimensions.IsSupported()) + { + var testSqlServers = SupportedTestDimensions.ParseTestDimensionValuesOrDefault(TestSqlServers) + ?? throw CreateConfigurationException(); + + enabledTestDimensions.AddEnabledDimension(testSqlServers); + } + + return; + + static InvalidOperationException CreateConfigurationException () + where T : TestDimension + { + return new InvalidOperationException($"The configuration for test dimension '{typeof(T).Name}' cannot be empty."); + } + } + + public override void ConfigureTestMatrix (TestMatricesBuilder builder) + { + + _normalTestMatrix = builder.AddTestMatrix ( + "NormalTestMatrix", + new TestDimension[,] + { + { Windows, Docker_Win_NET48, NET462, NoDB, Debug, x86 }, + { Windows, Docker_Win_NET48, NET462, NoDB, Release, x86 }, + { Windows, Docker_Win_NET48, NET462, NoDB, Debug, x64 }, + { Windows, Docker_Win_NET48, NET462, NoDB, Release, x64 }, + + // Local--> + { Windows, LocalMachine, NET462, NoDB, Debug, x86 }, + { Windows, LocalMachine, NET462, NoDB, Release, x86 }, + { Windows, LocalMachine, NET462, NoDB, Debug, x64 }, + { Windows, LocalMachine, NET462, NoDB, Release, x64 }, + + // Exercise compatibility between installed .NET version, target framework and SQL Server + { Windows, Docker_Win_NET48, NET462, NoDB, Release, x64 }, + { Windows, Docker_Win_NET472, NET462, NoDB, Release, x64 }, + { Windows, Docker_Win_NET462, NET462, NoDB, Release, x64 }, + }, + allowEmpty: true); + } + + + protected IEnumerable SupportedTestSqlServers => GetTestDimensionValueList(); + + private void AddVersionToPackageJson (AbsolutePath packageJsonPath, AbsolutePath duplicatedPackageJsonPath, string version) + { + var packageJsonContent = packageJsonPath.ReadAllText().Replace("$version$", version); + + duplicatedPackageJsonPath.WriteAllText(packageJsonContent); + } +} diff --git a/Build/Build.csproj b/Build/Build.csproj index d81ab6b..7147907 100644 --- a/Build/Build.csproj +++ b/Build/Build.csproj @@ -1,139 +1,29 @@ - - - + + - Debug - AnyCPU - {5952119C-365A-4614-BD29-58EAB1139438} - Library - Properties - Build - Build - v4.7.2 - 512 - c909e6d8 - + Exe + net8.0 + + CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006 + true + .. + .. + 1 + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - .BuildProject - - - - - - - - - - - - - - - - - - - - + - + + + - - ..\packages\JetBrains.Annotations.2019.1.3\lib\net20\JetBrains.Annotations.dll - - - ..\packages\Microsoft.Build.Framework.17.2.0\lib\net472\Microsoft.Build.Framework.dll - - - ..\packages\Microsoft.Build.Utilities.Core.17.2.0\lib\net472\Microsoft.Build.Utilities.Core.dll - - - ..\packages\Microsoft.IO.Redist.6.0.0\lib\net472\Microsoft.IO.Redist.dll - - - ..\packages\Microsoft.NET.StringTools.1.0.0\lib\net472\Microsoft.NET.StringTools.dll - - - ..\packages\Remotion.BuildScript.3.0.0-alpha.5\lib\net472\Remotion.BuildScript.dll - - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll - - - - ..\packages\System.Configuration.ConfigurationManager.4.7.0\lib\net461\System.Configuration.ConfigurationManager.dll - - - - - - ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll - - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - - ..\packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll - - - ..\packages\System.Security.Permissions.4.7.0\lib\net461\System.Security.Permissions.dll - - - ..\packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll - - - - - - + + + - + - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + \ No newline at end of file diff --git a/Build/Customizations/Configuration.props b/Build/Customizations/Configuration.props deleted file mode 100644 index 34f8d86..0000000 --- a/Build/Customizations/Configuration.props +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/Customizations/Databases.cs b/Build/Customizations/Databases.cs new file mode 100644 index 0000000..b3d5b8e --- /dev/null +++ b/Build/Customizations/Databases.cs @@ -0,0 +1,41 @@ +// This file is part of the re-motion Core Framework (www.re-motion.org) +// Copyright (c) rubicon IT GmbH, www.rubicon.eu +// +// The re-motion Core Framework is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// re-motion is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with re-motion; if not, see http://www.gnu.org/licenses. +// +using Remotion.BuildScript.Test; + +namespace Customizations; + +public class Databases : TestDimension +{ + public static readonly Databases NoDB = new(nameof(NoDB)); + + public bool HasSpecificVersion { get; } + + public int Version { get; } + + public Databases (string value) + : base(nameof(Databases), value) + { + HasSpecificVersion = false; + } + + public Databases (string value, int version) + : base(nameof(Databases), value) + { + HasSpecificVersion = true; + Version = version; + } +} diff --git a/Build/Customizations/Local/Configuration.props b/Build/Customizations/Local/Configuration.props deleted file mode 100644 index 46d8579..0000000 --- a/Build/Customizations/Local/Configuration.props +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Unavailable - Unavailable - Unavailable - - - \ No newline at end of file diff --git a/Build/Customizations/Local/Configuration.targets b/Build/Customizations/Local/Configuration.targets deleted file mode 100644 index 568ac0b..0000000 --- a/Build/Customizations/Local/Configuration.targets +++ /dev/null @@ -1,31 +0,0 @@ - - - - - LocalMachine - NET48 - - - - - - - - - LocalMachine - NET48 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/Customizations/Overrides.targets b/Build/Customizations/Overrides.targets deleted file mode 100644 index 3aa6b28..0000000 --- a/Build/Customizations/Overrides.targets +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - <_nunitRunnerFolderPath>$(TempDirectory)SharedSourceBuildNunitCopy\ - - - - - - <_filesToBeCopied Include="$(NUnitToolPath)**\*.*" /> - <_filesToBeCopied Include="%(NUnitExtensionsPaths.Identity)**\*.*" /> - - - - - - \ No newline at end of file diff --git a/Build/Customizations/Projects.props b/Build/Customizations/Projects.props deleted file mode 100644 index 8bd667a..0000000 --- a/Build/Customizations/Projects.props +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Win_NET48 + NET48 + NoBrowser + NoDB + Debug + x86; - Win_NET48 + NET48 + NoBrowser + NoDB + Release + x86; - Win_NET48 + NET48 + NoBrowser + NoDB + Debug + x64; - Win_NET48 + NET48 + NoBrowser + NoDB + Release + x64; - - - LocalMachine + NET48 + NoBrowser + NoDB + Debug + x86; - LocalMachine + NET48 + NoBrowser + NoDB + Release + x86; - LocalMachine + NET48 + NoBrowser + NoDB + Debug + x64; - LocalMachine + NET48 + NoBrowser + NoDB + Release + x64; - - - Win_NET48 + NET472 + NoBrowser + NoDB + Release + x64; - Win_NET48 + NET462 + NoBrowser + NoDB + Release + x64; - Win_NET472 + NET472 + NoBrowser + NoDB + Release + x64; - Win_NET472 + NET462 + NoBrowser + NoDB + Release + x64; - Win_NET462 + NET462 + NoBrowser + NoDB + Release + x64; - - - - - False - - - $(NormalTestConfiguration) - - - False - - - $(NormalTestConfiguration) - - - - \ No newline at end of file diff --git a/Build/Customizations/Server/Configuration.targets b/Build/Customizations/Server/Configuration.targets deleted file mode 100644 index 4c533c7..0000000 --- a/Build/Customizations/Server/Configuration.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Win_NET48 - NET48 - - - - - - - - - Win_NET48+Win_NET472+Win_NET462 - NET48+NET472+NET462 - - True - - - - - - - \ No newline at end of file diff --git a/Build/Customizations/releaseProcessScript.config b/Build/Customizations/releaseProcessScript.config deleted file mode 100644 index 7fe7133..0000000 --- a/Build/Customizations/releaseProcessScript.config +++ /dev/null @@ -1,44 +0,0 @@ - - - - https://jira.rubicon.eu/ - RMIO - yes - - - origin - BitBucket - - - Build/Customizations/Version.props - - - - - C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\msbuild.exe - - - - - Build\Remotion.Local.build - /t:UpdateAssemblyInfosForRelease - /property:Version={version} - - Update metadata to version '{version}'. - - - - - - Build\Remotion.Local.build - /t:UpdateAssemblyInfosForDevelopment - /property:Version={version} - - Update metadata to version '{version}'. - - - - - - - \ No newline at end of file diff --git a/Build/How-to-Release.md b/Build/How-to-Release.md deleted file mode 100644 index 308e607..0000000 --- a/Build/How-to-Release.md +++ /dev/null @@ -1,14 +0,0 @@ -# Install Release Process Automation Tool - -`dotnet tool install Remotion.ReleaseProcessAutomation -g --add-source https://nuget.re-motion.org/nuget/re-motion-infrastructure/ --prerelease` - -# Perform a Release - -On the commandline, use `releasetool` to start the process. - -# Reference Section - -`.BuildProject`: located in the solution root. Indicates the location of the configuration file. - -`Build/Customizations/releaseProcessScript.config`: The release tool configuration file. -Contains the MSBuild version and other solution specific details relevant for releasing a new version. \ No newline at end of file diff --git a/Build/NuSpec/TemplateShared.nuspec b/Build/NuSpec/TemplateShared.nuspec deleted file mode 100644 index e5c5b24..0000000 --- a/Build/NuSpec/TemplateShared.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - $id$ - $version$ - $id$ - $author$ - $author$ - http://opensource.org/licenses/LGPL-2.1 - http://www.re-motion.org - $description$ - $copyright$ - $tags$ $extraTags$ - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuSpec/bin/Debug/.gitmarker b/Build/NuSpec/bin/Debug/.gitmarker deleted file mode 100644 index e69de29..0000000 diff --git a/Build/NuSpec/bin/Release/.gitmarker b/Build/NuSpec/bin/Release/.gitmarker deleted file mode 100644 index e69de29..0000000 diff --git a/Build/Remotion.Local.build b/Build/Remotion.Local.build deleted file mode 100644 index ad4d2cc..0000000 --- a/Build/Remotion.Local.build +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - noreply@localhost.net - http://localhost/{0} - - - - Unavailable - - - - - Debug - x86 - NoDB - NoBrowser - LocalMachine - NET48 - - False - False - True - True - True - True - True - - - - - - Debug+Release - x64 - NoDB - NoBrowser - LocalMachine - NET48 - - False - False - True - True - True - False - False - - - - - - Debug - False - - - - - - Debug+Release - False - - - - - - Debug - False - False - - - - - - False - True - True - True - True - True - True - - - - - - - - <_formattedDateTime>$([System.DateTime]::Now.ToString("yyMMdd-HHmmss")) - <_version>$(Version.Split('-')[0]) - $(_version)-x.9.$(_formattedDateTime) - True - - - - - - - - <_version>$(Version.Split('-')[0]) - - $(_version)-x.9 - - False - - - - - - - - - - - - - - diff --git a/Build/Remotion.Server.build b/Build/Remotion.Server.build deleted file mode 100644 index 5bc9c57..0000000 --- a/Build/Remotion.Server.build +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - $(teamcity_build_checkoutdir)\ - $(build_vcs_number) - $(build_number) - - $(BuildRootDirectory)log\ - $(BuildRootDirectory)working\ - $(BuildRootDirectory)output\ - $(BuildRootDirectory)temp\ - - $(SecureNetworkShare)\remotion.snk - - - - - - - - Commit-$(CommitID) - - - - - - Debug - x86 - NoDB - NoBrowser - Win_NET48+EnforcedLocalMachine - NET48 - - False - False - True - True - True - True - True - - - - - - - Debug+Release - x86+x64 - NoDB - NoBrowser - Win_NET48+EnforcedLocalMachine - NET48 - - False - False - False - False - False - False - False - - - - - - - - - - - - - - - - - - - - - - <_version>$(Version.Split('-')[0]) - $(_version)-x.1.$(BuildNumber) - True - - - - - - - - - - - - - - - - - - diff --git a/Build/Remotion.build b/Build/Remotion.build deleted file mode 100644 index c31c804..0000000 --- a/Build/Remotion.build +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - $(MSBuildProjectDirectory)\..\packages\ - $(PackagesDirectory)DependDB.BuildProcessor.2.0.0\tools\ - $(PackagesDirectory)DependDB.BuildProcessor.NuGetPreProcessor.2.0.0\tools\ - $(PackagesDirectory)NUnit.ConsoleRunner.3.15.5\tools\ - $(PackagesDirectory)NuGet.CommandLine.3.5.0\tools\ - $(PackagesDirectory)NuGet.for.MSBuild.1.4.3\build\ - $(PackagesDirectory)Remotion.BuildScript.3.0.0-alpha.5\BuildTargets\ - $(RemotionBuildScriptTasksPath)..\lib\net472\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(MSBuildProjectDirectory)\Customizations\ - - - - - - - - - - - - $(MSBuildProjectDirectory)\..\ - $(MSBuildProjectDirectory)\BuildOutput\ - $(OutputDirectory)log\ - $(OutputDirectory)temp\ - - $(SolutionDirectory)remotion.snk - - - False - - - - - - SolutionKeyFile=$(SolutionKeyFile); - SolutionDirectory=$(SolutionDirectory); - OutputDirectory=$(OutputDirectory); - TempDirectory=$(TempDirectory); - LogDirectory=$(LogDirectory); - Version=$(Version); - AdditionalBuildMetadata=$(AdditionalBuildMetadata); - VcsUrlTemplate=$(VcsUrlTemplate); - VcsUrlRequiresWindowsCredentials=$(VcsUrlRequiresWindowsCredentials); - Platforms=$(Platforms); - DatabaseSystems=$(DatabaseSystems); - Browsers=$(Browsers); - ExecutionRuntimes=$(ExecutionRuntimes); - TargetRuntimes=$(TargetRuntimes); - TestCategoriesToExclude=$(TestCategoriesToExclude); - - - - - - - - - - CleanProjects - - RunTests - - GenerateDocumentation - - CreateNuGetPackagesWithSymbolServerSupport - - InsertSourceLinks - - CreateNuGetPackagesWithDebugSymbols - - ProcessForDependDB - - - - - LogConfiguration; - $(CleanProjectsTarget); - BuildReleaseProjects; - BuildTestProjects; - $(RunTestsTarget); - $(GenerateDocumentationTarget); - $(PackageNuGetOrgTarget); - $(SourceLinkTarget); - $(PackageNuGetTarget); - $(DependDBTarget); - RestoreBackupFiles; - - - - - - - - - - - <_configurations>$([MSBuild]::Unescape($(Configurations.Replace('+',';')))) - - - - <_configurationIDs Remove="@(_configurationIDs)" /> - <_configurationIDs Include="$(_configurations)" /> - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/app.config b/Build/app.config deleted file mode 100644 index 1696df6..0000000 --- a/Build/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Build/packages.config b/Build/packages.config deleted file mode 100644 index 7e178c5..0000000 --- a/Build/packages.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/teamcity.properties b/Build/teamcity.properties deleted file mode 100644 index eddad5e..0000000 --- a/Build/teamcity.properties +++ /dev/null @@ -1 +0,0 @@ -MSBuildVersion=17.0 \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 54c8d0b..307ec6d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,10 +6,11 @@ - + - + + \ No newline at end of file diff --git a/Remotion-IO.sln b/Remotion-IO.sln index c0f6146..81ab153 100644 --- a/Remotion-IO.sln +++ b/Remotion-IO.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0 @@ -25,9 +24,7 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5952119C-365A-4614-BD29-58EAB1139438}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5952119C-365A-4614-BD29-58EAB1139438}.Debug|Any CPU.Build.0 = Debug|Any CPU {5952119C-365A-4614-BD29-58EAB1139438}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5952119C-365A-4614-BD29-58EAB1139438}.Release|Any CPU.Build.0 = Release|Any CPU {B79940B8-1949-406D-9CCA-E6349898E11A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B79940B8-1949-406D-9CCA-E6349898E11A}.Debug|Any CPU.Build.0 = Debug|Any CPU {B79940B8-1949-406D-9CCA-E6349898E11A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -51,4 +48,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B1918D90-ED2B-4A61-A748-8433B4F56C7C} EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/Remotion-IO.sln.DotSettings b/Remotion-IO.sln.DotSettings index 4770e2a..66abd02 100644 --- a/Remotion-IO.sln.DotSettings +++ b/Remotion-IO.sln.DotSettings @@ -117,6 +117,21 @@ <Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="s_" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="c_" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Type parameters"><ElementKinds><Kind Name="TYPE_PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="T" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="_" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Instance fields (not private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local variables"><ElementKinds><Kind Name="LOCAL_VARIABLE" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static fields (not private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Parameters"><ElementKinds><Kind Name="PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"><ElementKinds><Kind Name="NAMESPACE" /><Kind Name="CLASS" /><Kind Name="STRUCT" /><Kind Name="ENUM" /><Kind Name="DELEGATE" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"><ElementKinds><Kind Name="LOCAL_CONSTANT" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Interfaces"><ElementKinds><Kind Name="INTERFACE" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="I" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="s_" Suffix="" Style="aaBb" /></Policy> @@ -159,6 +174,7 @@ True True True + True True True True diff --git a/Shared.build.props b/Shared.build.props index bc312a2..eca2be6 100644 --- a/Shared.build.props +++ b/Shared.build.props @@ -38,6 +38,7 @@ False False net6.0;net7.0;net8.0;net462 + true diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..e6339c0 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,74 @@ +[CmdletBinding()] +Param( + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$BuildArguments +) + +Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" + +Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 } +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent + +########################################################################### +# CONFIGURATION +########################################################################### + +$BuildProjectFile = "$PSScriptRoot\build\Build.csproj" +$TempDirectory = "$PSScriptRoot\\.nuke\temp" + +$DotNetGlobalFile = "$PSScriptRoot\\global.json" +$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" +$DotNetChannel = "STS" + +$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 +$env:DOTNET_NOLOGO = 1 + +########################################################################### +# EXECUTION +########################################################################### + +function ExecSafe([scriptblock] $cmd) { + & $cmd + if ($LASTEXITCODE) { exit $LASTEXITCODE } +} + +# 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) { + $env:DOTNET_EXE = (Get-Command "dotnet").Path +} +else { + # Download install script + $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" + New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) + + # If global.json exists, load expected version + if (Test-Path $DotNetGlobalFile) { + $DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) + if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { + $DotNetVersion = $DotNetGlobal.sdk.version + } + } + + # Install by channel or version + $DotNetDirectory = "$TempDirectory\dotnet-win" + if (!(Test-Path variable:DotNetVersion)) { + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } + } 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 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 --no-cache --force $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 new file mode 100644 index 0000000..259142b --- /dev/null +++ b/build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +bash --version 2>&1 | head -n 1 + +set -eo pipefail +SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) + +########################################################################### +# CONFIGURATION +########################################################################### + +BUILD_PROJECT_FILE="$SCRIPT_DIR/Build/Build.csproj" +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="STS" + +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_NOLOGO=1 + +########################################################################### +# EXECUTION +########################################################################### + +function FirstJsonValue { + perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}" +} + +# 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)" +else + # Download install script + DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh" + mkdir -p "$TEMP_DIRECTORY" + curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL" + chmod +x "$DOTNET_INSTALL_FILE" + + # If global.json exists, load expected version + if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then + DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")") + if [[ "$DOTNET_VERSION" == "" ]]; then + unset DOTNET_VERSION + fi + fi + + # Install by channel or version + DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix" + if [[ -z ${DOTNET_VERSION+x} ]]; then + "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path + 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 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 -- "$@"