Add project files.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[*.cs]
|
||||
dotnet_style_qualification_for_field = false:warning
|
||||
dotnet_style_qualification_for_property = false:warning
|
||||
dotnet_style_qualification_for_method = false:warning
|
||||
dotnet_style_qualification_for_event = false:warning
|
||||
dotnet_style_require_accessibility_modifiers = never:warning
|
||||
|
||||
csharp_style_expression_bodied_methods = true:silent
|
||||
csharp_style_expression_bodied_properties = true:warning
|
||||
csharp_style_expression_bodied_indexers = true:warning
|
||||
csharp_style_expression_bodied_accessors = true:warning
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using Nuke.Common.CI.GitHubActions;
|
||||
using Nuke.Common.CI.GitHubActions.Configuration;
|
||||
using Nuke.Common.Execution;
|
||||
using Nuke.Common.Utilities;
|
||||
using Nuke.Components;
|
||||
|
||||
[CustomGitHubActions(
|
||||
"pr",
|
||||
GitHubActionsImage.UbuntuLatest,
|
||||
OnPullRequestBranches = ["main"],
|
||||
OnPullRequestIncludePaths = ["**/*"],
|
||||
PublishArtifacts = false,
|
||||
InvokedTargets = [nameof(ICompile.Compile), nameof(ITest.Test), nameof(IPack.Pack)],
|
||||
CacheKeyFiles = [],
|
||||
ConcurrencyCancelInProgress = true
|
||||
)
|
||||
]
|
||||
public partial class Build;
|
||||
|
||||
class CustomGitHubActionsAttribute : GitHubActionsAttribute
|
||||
{
|
||||
public CustomGitHubActionsAttribute(string name, GitHubActionsImage image, params GitHubActionsImage[] images) : base(name, image, images)
|
||||
{
|
||||
}
|
||||
|
||||
protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyCollection<ExecutableTarget> relevantTargets)
|
||||
{
|
||||
var job = base.GetJobs(image, relevantTargets);
|
||||
|
||||
var newSteps = new List<GitHubActionsStep>(job.Steps);
|
||||
|
||||
// only need to list the ones that are missing from default image
|
||||
newSteps.Insert(0, new GitHubActionsSetupDotNetStep(["9.x"]));
|
||||
|
||||
job.Steps = newSteps.ToArray();
|
||||
return job;
|
||||
}
|
||||
}
|
||||
|
||||
class GitHubActionsSetupDotNetStep : GitHubActionsStep
|
||||
{
|
||||
public GitHubActionsSetupDotNetStep(string[] versions)
|
||||
{
|
||||
Versions = versions;
|
||||
}
|
||||
|
||||
string[] Versions { get; }
|
||||
|
||||
public override void Write(CustomFileWriter writer)
|
||||
{
|
||||
writer.WriteLine("- uses: actions/setup-dotnet@v4");
|
||||
|
||||
using (writer.Indent())
|
||||
{
|
||||
writer.WriteLine("with:");
|
||||
using (writer.Indent())
|
||||
{
|
||||
writer.WriteLine("dotnet-version: |");
|
||||
using (writer.Indent())
|
||||
{
|
||||
foreach (var version in Versions)
|
||||
{
|
||||
writer.WriteLine(version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.CI;
|
||||
using Nuke.Common.CI.GitHubActions;
|
||||
using Nuke.Common.Git;
|
||||
using Nuke.Common.IO;
|
||||
using Nuke.Common.ProjectModel;
|
||||
using Nuke.Common.Tooling;
|
||||
using Nuke.Common.Tools.Coverlet;
|
||||
using Nuke.Common.Tools.DotNet;
|
||||
using Nuke.Common.Utilities.Collections;
|
||||
using Nuke.Components;
|
||||
using Serilog;
|
||||
|
||||
[ShutdownDotNetAfterServerBuild]
|
||||
partial class Build : NukeBuild, ITest, IPack
|
||||
{
|
||||
public static int Main() => Execute<Build>(x => ((ICompile)x).Compile);
|
||||
|
||||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
||||
|
||||
[GitRepository] readonly GitRepository GitRepository;
|
||||
|
||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||
|
||||
public AbsolutePath PackagesDirectory => RootDirectory / "packages";
|
||||
public AbsolutePath TestResultDirectory => RootDirectory / "testresults";
|
||||
|
||||
string TagVersion => GitRepository.Tags.SingleOrDefault(x => "v".StartsWith(x))?[1..];
|
||||
bool IsTaggedBuild => !string.IsNullOrWhiteSpace(TagVersion);
|
||||
|
||||
string VersionSuffix;
|
||||
|
||||
[Parameter] string Version;
|
||||
|
||||
[Parameter] bool AnalyseCode;
|
||||
|
||||
protected override void OnBuildInitialized()
|
||||
{
|
||||
VersionSuffix = !IsTaggedBuild
|
||||
? $"preview-{DateTime.UtcNow:yyyyMMdd-HHmm}"
|
||||
: "";
|
||||
|
||||
if (IsLocalBuild)
|
||||
{
|
||||
VersionSuffix = $"dev-{DateTime.UtcNow:yyyyMMdd-HHmm}";
|
||||
}
|
||||
|
||||
Log.Information("BUILD SETUP:\nConfiguration: {Configuration}\nVersion Suffix: {VersionSuffix}\nVersion: {Version}\nTagged Build: {IsTaggedBuild}\nAnalyse Code: {AnalyseCode}",
|
||||
Configuration, VersionSuffix, Version, IsTaggedBuild, AnalyseCode);
|
||||
}
|
||||
|
||||
Target Clean => _ => _
|
||||
.Before<IRestore>(x => x.Restore)
|
||||
.Executes(() =>
|
||||
{
|
||||
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory());
|
||||
((IHazArtifacts)this).ArtifactsDirectory.CreateOrCleanDirectory();
|
||||
|
||||
TestResultDirectory.CreateOrCleanDirectory();
|
||||
});
|
||||
|
||||
public Configure<DotNetRestoreSettings> RestoreSettings => _ => _
|
||||
.SetVerbosity(DotNetVerbosity.quiet);
|
||||
|
||||
public Configure<DotNetBuildSettings> CompileSettings => _ => _
|
||||
// ensure we don't generate too much output in CI run
|
||||
// 0 Turns off emission of all warning messages
|
||||
// 1 Displays severe warning messages
|
||||
.SetWarningLevel(IsServerBuild ? 0 : 1);
|
||||
|
||||
public IEnumerable<Project> TestProjects =>
|
||||
((IHazSolution)this).Solution.AllProjects.Where(x => x.Name.EndsWith("Tests"));
|
||||
|
||||
public Configure<DotNetTestSettings, Project> TestProjectSettings => (testSettings, project) => testSettings
|
||||
.When(_ => GitHubActions.Instance is not null, settings => settings.AddLoggers("GitHubActions;report-warnings=false"))
|
||||
.When(_ => AnalyseCode, settings => settings
|
||||
.SetCoverletOutputFormat(CoverletOutputFormat.opencover)
|
||||
.EnableCollectCoverage()
|
||||
.SetResultsDirectory(TestResultDirectory)
|
||||
.SetCoverletOutput($"{TestResultDirectory}/opencoverCoverage.xml")
|
||||
.AddProcessAdditionalArguments("--collect:\"XPlat Code Coverage;Format=opencover\"")
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<UseArtifactsOutput>false</UseArtifactsOutput>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||
<!-- Uncomment to include parent Directory.Build.targets file -->
|
||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace/>
|
||||
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
|
||||
<NukeRootDirectory>..</NukeRootDirectory>
|
||||
<NukeScriptDirectory>..</NukeScriptDirectory>
|
||||
<NukeTelemetryVersion>1</NukeTelemetryVersion>
|
||||
<NukeExcludeLogs>true</NukeExcludeLogs>
|
||||
<NukeExcludeDirectoryBuild>true</NukeExcludeDirectoryBuild>
|
||||
<IsPackable>false</IsPackable>
|
||||
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
||||
<NuGetAudit>enable</NuGetAudit>
|
||||
<NuGetAuditMode>all</NuGetAuditMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nuke.Components" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--Overridden for vulnerability reasons with dependencies referencing older versions.-->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Formats.Asn1" Version="9.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,31 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=HeapView_002EDelegateAllocation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InterpolatedStringExpressionIsNotIFormattable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue"><Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue"><Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
Reference in New Issue
Block a user