diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml
new file mode 100644
index 00000000..718a864b
--- /dev/null
+++ b/.github/workflows/build-publish.yml
@@ -0,0 +1,21 @@
+name: Build and publish
+
+on:
+ push:
+ branches:
+ - master
+ - main
+ - release/**
+ paths:
+ - Material.**
+ tags:
+ - v**
+
+jobs:
+ build-and-test:
+ uses: SKProCH/CommonWorkflows/.github/workflows/build-publish.yml@main
+ secrets:
+ NUGET_KEY: ${{ secrets.NUGET_KEY }}
+ with:
+ publish-nightly: ${{ github.ref_type != 'tag' && (github.ref == 'master' || github.ref == 'main') }}
+ dotnet-version: 8
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..2e994bb9
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,17 @@
+name: Build and publish
+
+on:
+ push:
+ branches:
+ - !master
+ - !main
+ - !release/**
+
+jobs:
+ build-and-test:
+ uses: SKProCH/CommonWorkflows/.github/workflows/build-publish.yml@main
+ secrets:
+ NUGET_KEY: "NONE"
+ with:
+ only-build: true
+ dotnet-version: 8
\ No newline at end of file
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index b8e06fdc..00000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-# ------------------------------------------------------------------------------
-#
-#
-# This code was generated.
-#
-# - To turn off auto-generation set:
-#
-# [GitHubActions (AutoGenerate = false)]
-#
-# - To trigger manual generation invoke:
-#
-# nuke --generate-configuration GitHubActions_main --host GitHubActions
-#
-#
-# ------------------------------------------------------------------------------
-
-name: main
-
-on:
- push:
- branches:
- - master
- - 'release/*'
- tags-ignore:
- - "*"
- paths:
- - "Material.**"
-
-jobs:
- ubuntu-latest:
- name: ubuntu-latest
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- filter: tree:0
- - uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 8
- - name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
- with:
- path: |
- .nuke/temp
- ~/.nuget/packages
- key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- - name: 'Install workload: wasm-tools'
- run: dotnet workload install wasm-tools
- - name: 'Run: PublishNugetPackages'
- run: ./build.cmd PublishNugetPackages
- env:
- NuGetApiKey: ${{ secrets.NUGET_API_KEY }}
- - name: 'Publish: nuget'
- uses: actions/upload-artifact@v3
- with:
- name: nuget
- path: artifacts/nuget
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 1957bfe5..00000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# ------------------------------------------------------------------------------
-#
-#
-# This code was generated.
-#
-# - To turn off auto-generation set:
-#
-# [GitHubActions (AutoGenerate = false)]
-#
-# - To trigger manual generation invoke:
-#
-# nuke --generate-configuration GitHubActions_release --host GitHubActions
-#
-#
-# ------------------------------------------------------------------------------
-
-name: release
-
-on:
- push:
- tags:
- - '*'
-
-permissions:
- contents: write
-
-jobs:
- ubuntu-latest:
- name: ubuntu-latest
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- filter: tree:0
- - name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
- with:
- path: |
- .nuke/temp
- ~/.nuget/packages
- key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- - name: 'Install workload: wasm-tools'
- run: dotnet workload install wasm-tools
- - name: 'Run: PublishRelease'
- run: ./build.cmd PublishRelease
- env:
- NuGetApiKey: ${{ secrets.NUGET_API_KEY }}
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: 'Publish: nuget'
- uses: actions/upload-artifact@v3
- with:
- name: nuget
- path: artifacts/nuget
- - name: 'Publish: demo'
- uses: actions/upload-artifact@v3
- with:
- name: demo
- path: artifacts/demo
diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json
deleted file mode 100644
index d839b1ca..00000000
--- a/.nuke/build.schema.json
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "$ref": "#/definitions/build",
- "title": "Build Schema",
- "definitions": {
- "build": {
- "type": "object",
- "properties": {
- "Configuration": {
- "type": "string",
- "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
- "enum": [
- "Debug",
- "Release"
- ]
- },
- "Continue": {
- "type": "boolean",
- "description": "Indicates to continue a previously failed build attempt"
- },
- "force-version": {
- "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",
- "TravisCI",
- "VisualStudio",
- "VSCode"
- ]
- },
- "NoLogo": {
- "type": "boolean",
- "description": "Disables displaying the NUKE logo"
- },
- "nuget-api-key": {
- "type": "string",
- "default": "Secrets must be entered via 'nuke :secrets [profile]'"
- },
- "nuget-feed-url": {
- "type": "string"
- },
- "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": [
- "Clean",
- "Compile",
- "CreateIntermediateNugetPackages",
- "PackDemoApp",
- "PackNugetPackages",
- "PublishNugetPackages",
- "PublishRelease"
- ]
- }
- },
- "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": [
- "Clean",
- "Compile",
- "CreateIntermediateNugetPackages",
- "PackDemoApp",
- "PackNugetPackages",
- "PublishNugetPackages",
- "PublishRelease"
- ]
- }
- },
- "Verbosity": {
- "type": "string",
- "description": "Logging verbosity during build execution. Default is 'Normal'",
- "enum": [
- "Minimal",
- "Normal",
- "Quiet",
- "Verbose"
- ]
- }
- }
- }
- }
-}
diff --git a/.nuke/parameters.json b/.nuke/parameters.json
deleted file mode 100644
index 7e329809..00000000
--- a/.nuke/parameters.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "$schema": "./build.schema.json",
- "Solution": "Material.Avalonia.sln"
-}
\ No newline at end of file
diff --git a/Directory.Packages.props b/Directory.Packages.props
index c5b4294a..47d82d33 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -17,6 +17,7 @@
+
diff --git a/Material.Avalonia.sln b/Material.Avalonia.sln
index e7c4f023..ddadb459 100644
--- a/Material.Avalonia.sln
+++ b/Material.Avalonia.sln
@@ -25,8 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "!Solution Items", "Solution
.gitignore = .gitignore
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{32F02580-2829-46FF-A2BE-2E5A6683627E}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Material.Avalonia.Demo.Browser", "Material.Avalonia.Demo.Browser\Material.Avalonia.Demo.Browser.csproj", "{CDFD165F-BF7F-4323-9F59-454289F90186}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Material.Avalonia.Demo.Desktop", "Material.Avalonia.Demo.Desktop\Material.Avalonia.Demo.Desktop.csproj", "{F5C9683F-D808-496F-AC76-D677FADFA40E}"
@@ -41,8 +39,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {32F02580-2829-46FF-A2BE-2E5A6683627E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {32F02580-2829-46FF-A2BE-2E5A6683627E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECBAA8F5-8837-4F09-A33E-9157EF1C3FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECBAA8F5-8837-4F09-A33E-9157EF1C3FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECBAA8F5-8837-4F09-A33E-9157EF1C3FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/Material.Avalonia/Material.Avalonia.csproj b/Material.Avalonia/Material.Avalonia.csproj
index c64b37a1..68661ab9 100644
--- a/Material.Avalonia/Material.Avalonia.csproj
+++ b/Material.Avalonia/Material.Avalonia.csproj
@@ -17,4 +17,8 @@
+
+
+
+
diff --git a/build/numerge.config.json b/Material.Avalonia/numerge.config.json
similarity index 100%
rename from build/numerge.config.json
rename to Material.Avalonia/numerge.config.json
diff --git a/build/.editorconfig b/build/.editorconfig
deleted file mode 100644
index 31e43dcd..00000000
--- a/build/.editorconfig
+++ /dev/null
@@ -1,11 +0,0 @@
-[*.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
diff --git a/build/Build.cs b/build/Build.cs
deleted file mode 100644
index 24ff025a..00000000
--- a/build/Build.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-using System;
-using System.Linq;
-using Nuke.Common;
-using Nuke.Common.Git;
-using Nuke.Common.IO;
-using Nuke.Common.ProjectModel;
-using Nuke.Common.Tooling;
-using Nuke.Common.Tools.DotNet;
-using Nuke.Common.Tools.Git;
-using Nuke.Common.Tools.MinVer;
-using Nuke.Common.Utilities;
-using Numerge;
-using Serilog;
-// ReSharper disable AllUnderscoreLocalParameterName
-// ReSharper disable InconsistentNaming
-
-partial class Build : NukeBuild {
- [GitRepository] readonly GitRepository Repository = null!;
- [Solution] readonly Solution Solution = null!;
- [MinVer] MinVer MinVer = null!;
- BuildParameters Parameters { get; set; } = null!;
-
- AbsolutePath ArtifactsDir => RootDirectory / "artifacts";
- AbsolutePath DemoDir => ArtifactsDir / "demo";
- AbsolutePath NugetIntermediateRoot => ArtifactsDir / "build-intermediate" / "nuget";
- AbsolutePath NugetRoot => ArtifactsDir / "nuget";
-
- Target Clean => _ => _
- .Executes(() => {
- DemoDir.CreateOrCleanDirectory();
- NugetIntermediateRoot.DeleteDirectory();
- NugetRoot.CreateOrCleanDirectory();
- });
-
- Target Compile => _ => _
- .DependsOn(Clean)
- .Executes(() => {
- DotNetTasks.DotNetBuild(_ => _
- .SetProjectFile(Solution)
- .SetConfiguration(Configuration)
- .SetVersion(Parameters.Version.ToString()));
- });
-
- Target CreateIntermediateNugetPackages => _ => _
- .DependsOn(Compile)
- .Executes(() => {
- DotNetTasks.DotNetPack(s => {
- s = s
- .SetProject(Solution)
- .SetConfiguration(Configuration)
- .SetVersion(Parameters.Version.ToString())
- .SetOutputDirectory(NugetIntermediateRoot)
- .EnableDeterministic()
- .EnableDeterministicSourcePaths();
-
- if (Parameters.Version.IsNightly()) {
- var commitMessage = GitTasks.Git("show -s --format=%s")
- .Select(o => o.Text)
- .Join("\n");
-
- s = s.SetPackageReleaseNotes($"Nightly version for commit {Repository.Commit}.\n{commitMessage}");
- }
-
- return s;
- });
- });
-
- Target PackNugetPackages => _ => _
- .DependsOn(CreateIntermediateNugetPackages)
- .Produces(NugetRoot / "*.nupkg")
- .Executes(() => {
- var config = MergeConfiguration.LoadFile(RootDirectory / "build" / "numerge.config.json");
- NugetRoot.CreateOrCleanDirectory();
- if (!NugetPackageMerger.Merge(NugetIntermediateRoot, NugetRoot, config,
- new NumergeNukeLogger()))
- throw new Exception("Package merge failed");
- });
-
- Target PackDemoApp => _ => _
- .DependsOn(Clean)
- .Produces(DemoDir)
- .Executes(() => {
- PublishFor("win-x64", ".exe");
- PublishFor("linux-x64");
-
- void PublishFor(string rid, string fileExtension = "") {
- DotNetTasks.DotNetPublish(s => s
- .SetProject(Solution.GetProject("Material.Avalonia.Demo.Desktop"))
- .SetConfiguration("Release")
- .SetVersion(Parameters.Version.ToString())
- .SetOutput(DemoDir)
- .SetProperty("IncludeNativeLibrariesForSelfExtract", "true")
- .SetProperty("IncludeAllContentForSelfExtract", "true")
- .SetProperty("DebugSymbols", false)
- .SetProperty("DebugType", "none")
- .EnableSelfContained()
- .EnablePublishSingleFile()
- .SetProperty("PublishAot", false)
- .SetRuntime(rid));
-
- var binaryFile = (DemoDir / "Material.Avalonia.Demo.Desktop" + fileExtension).ToFileInfo();
- binaryFile.MoveTo(DemoDir / $"Material.Demo_{rid}{fileExtension}");
- }
- });
-
- /// Support plugins are available for:
- /// - JetBrains ReSharper https://nuke.build/resharper
- /// - JetBrains Rider https://nuke.build/rider
- /// - Microsoft VisualStudio https://nuke.build/visualstudio
- /// - Microsoft VSCode https://nuke.build/vscode
- public static int Main() => Execute(x => x.Compile);
-
- ///
- protected override void OnBuildInitialized() {
- MinVer = MinVerTasks.MinVer(s => s
- .DisableProcessLogOutput()
- .SetTagPrefix("v")
- .SetDefaultPreReleasePhase("nightly"))
- .Result;
-
- Parameters = new BuildParameters(this);
-
- Log.Information("Building version {Version} of Material.Avalonia ({Configuration}) using version {NukeVersion} of Nuke",
- Parameters.Version, Parameters.Configuration, typeof(NukeBuild).Assembly.GetName().Version!.ToString());
- }
-}
\ No newline at end of file
diff --git a/build/BuildExtensions.cs b/build/BuildExtensions.cs
deleted file mode 100644
index 93069f4b..00000000
--- a/build/BuildExtensions.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Immutable;
-using System.Linq;
-using NuGet.Versioning;
-public static class BuildExtensions {
- public static bool IsNightly(this NuGetVersion version) {
- if (version.ToString().Contains("nightly")) {
- return true;
- }
-
- // 3.2.5-nightly.0.1
- // If x.y on the end - this is nightly
- var lastLabels = version.ReleaseLabels.TakeLast(2).ToImmutableArray();
- return lastLabels.Length == 2 && lastLabels.All(s => int.TryParse(s, out _));
- }
-}
\ No newline at end of file
diff --git a/build/BuildOnPipelines.cs b/build/BuildOnPipelines.cs
deleted file mode 100644
index 4c555f95..00000000
--- a/build/BuildOnPipelines.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Collections.Immutable;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using NuGet.Protocol;
-using NuGet.Protocol.Core.Types;
-using NuGet.Versioning;
-using Nuke.Common;
-using Nuke.Common.CI.GitHubActions;
-using Nuke.Common.IO;
-using Nuke.Common.Tools.DotNet;
-using Nuke.Common.Tools.GitHub;
-using Octokit;
-using Octokit.Internal;
-using Serilog;
-
-[GitHubActions("main", GitHubActionsImage.UbuntuLatest, AutoGenerate = false,
- OnPushBranches = ["master", "release/*"],
- InvokedTargets = [nameof(PublishNugetPackages)],
- ImportSecrets = [nameof(NuGetApiKey)])]
-[GitHubActions("release", GitHubActionsImage.UbuntuLatest, AutoGenerate = false,
- OnPushTags = ["*"],
- WritePermissions = [GitHubActionsPermissions.Contents],
- InvokedTargets = [nameof(PublishRelease)],
- ImportSecrets = [nameof(NuGetApiKey)],
- EnableGitHubToken = true)]
-partial class Build {
- Target PublishNugetPackages => _ => _
- .OnlyWhenDynamic(() => Parameters.NugetApiKey is not null)
- .OnlyWhenDynamic(() => Parameters.ShouldPublishNugetPackages)
- .DependsOn(PackNugetPackages)
- .Executes(() => {
- DotNetTasks.DotNetNuGetPush(s => s
- .SetSource(Parameters.NugetFeedUrl)
- .SetApiKey(Parameters.NugetApiKey)
- .SetTargetPath(NugetRoot / "*.nupkg")
- .EnableSkipDuplicate());
- });
-
- Target PublishRelease => _ => _
- .Unlisted()
- .OnlyWhenDynamic(() => Parameters.NugetApiKey is not null)
- .OnlyWhenDynamic(() => Parameters.ShouldPublishNugetPackages)
- .DependsOn(PublishNugetPackages)
- .Executes(async () => {
- var tagName = $"v{Parameters.Version}";
-
- var (owner, name) = (Repository.GetGitHubOwner(), Repository.GetGitHubName());
- var credentials = new Credentials(GitHubActions.Instance.Token);
- GitHubTasks.GitHubClient = new GitHubClient(
- new ProductHeaderValue(nameof(NukeBuild)),
- new InMemoryCredentialStore(credentials));
-
- try {
- Log.Information("Deleting old release {TagName}", tagName);
- var oldRelease = await GitHubTasks.GitHubClient.Repository.Release.Get(owner, name, tagName);
- await GitHubTasks.GitHubClient.Repository.Release.Delete(owner, name, oldRelease.Id);
- }
- catch (Exception) {
- // ignored
- }
-
- Log.Information("Creating new release {TagName}", tagName);
- var newRelease = new NewRelease(tagName) {
- Name = tagName,
- GenerateReleaseNotes = true
- };
- var release = await GitHubTasks.GitHubClient.Repository.Release.Create(owner, name, newRelease);
- var nugetArtifacts = NugetRoot.GetFiles("*.nupkg").ToImmutableArray();
- foreach (var artifactPath in nugetArtifacts) {
- Log.Information("Uploading new release {TagName} asset: {AssetName}", tagName, artifactPath.Name);
- await using var fileStream = File.OpenRead(artifactPath);
- var releaseAssetUpload = new ReleaseAssetUpload(artifactPath.Name, "application/octet-stream", fileStream, null);
- await GitHubTasks.GitHubClient.Repository.Release.UploadAsset(release, releaseAssetUpload);
- }
-
- var nuget = NuGet.Protocol.Core.Types.Repository.Factory.GetCoreV3(Parameters.NugetFeedUrl);
- foreach (var nugetArtifact in nugetArtifacts) {
- var packageName = nugetArtifact.Name.Split(Parameters.Version.ToString())[0].TrimEnd('.');
- await HideOutdatedPackages(nuget, Parameters.Version, packageName);
- }
- return;
-
- async Task HideOutdatedPackages(SourceRepository sourceRepository, NuGetVersion nuGetVersion, string packageName) {
- Log.Information("Retrieving nightly packages version for {PackageName} to hide", packageName);
- var resource = await sourceRepository.GetResourceAsync();
- var parametersNugetPackages = await resource.GetMetadataAsync(
- packageName,
- true,
- false,
- new SourceCacheContext(),
- NugetLogger.Instance,
- CancellationToken.None);
-
- var outdatedVersions = parametersNugetPackages
- .Where(metadata => metadata.Identity.HasVersion)
- .Where(metadata => metadata.Identity.Version.IsNightly())
- .Where(metadata => metadata.Identity.Version < nuGetVersion);
- foreach (var outdatedVersion in outdatedVersions) {
- Log.Information("Hiding previous nightly version {Version}", outdatedVersion.Identity.Version.ToString());
- var packageUpdateResource = await sourceRepository.GetResourceAsync();
- await packageUpdateResource.Delete(packageName, outdatedVersion.Identity.Version.ToString(),
- _ => Parameters.NugetApiKey, _ => true, false, NugetLogger.Instance);
- }
-
- Log.Information("All previous nightly version for {PackageName} was hidden", packageName);
- }
- });
-}
\ No newline at end of file
diff --git a/build/BuildParameters.cs b/build/BuildParameters.cs
deleted file mode 100644
index c3629e59..00000000
--- a/build/BuildParameters.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using NuGet.Versioning;
-using Nuke.Common;
-using Nuke.Common.CI.GitHubActions;
-public partial class Build {
- [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
- readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
-
- [Parameter(Name = "force-version")]
- public string? ForceVersion { get; set; }
-
- [Parameter(Name = "nuget-feed-url")]
- public string NuGetFeedUrl { get; set; } = "https://api.nuget.org/v3/index.json";
-
- [Secret]
- [Parameter(Name = "nuget-api-key")]
- public string? NuGetApiKey { get; set; }
-
- public sealed class BuildParameters {
- public BuildParameters(Build b) {
- // ARGUMENTS
- Configuration = b.Configuration;
-
- // CONFIGURATION
- MainRepo = "https://github.com/AvaloniaCommunity/Material.Avalonia";
- MasterBranch = "refs/heads/master";
-
- // PARAMETERS
- NugetFeedUrl = b.NuGetFeedUrl;
- NugetApiKey = b.NuGetApiKey;
-
- IsRunningOnGitHubActions = Host is GitHubActions;
- if (IsRunningOnGitHubActions) {
- RepositoryName = $"{GitHubActions.Instance.ServerUrl}/{GitHubActions.Instance.Repository}";
- RepositoryBranch = GitHubActions.Instance.Ref;
- IsReleasableBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, RepositoryBranch)
- || GitHubActions.Instance.Ref.StartsWith("refs/heads/release/")
- || StringComparer.OrdinalIgnoreCase.Equals(GitHubActions.Instance.RefType, "tag");
- }
-
- IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, RepositoryName);
- IsReleasable = Configuration.Release == Configuration;
-
- ShouldPublishNugetPackages = IsRunningOnGitHubActions && IsReleasableBranch && IsReleasable
- && (b.MinVer.MinVerPreRelease is null || !b.MinVer.MinVerPreRelease.EndsWith(".0"));
-
- // VERSION
- Version = new NuGetVersion(b.ForceVersion ?? b.MinVer.Version);
- }
-
- public Configuration Configuration { get; }
- public string MainRepo { get; }
- public string MasterBranch { get; }
- public string RepositoryBranch { get; } = null!;
- public string RepositoryName { get; } = null!;
- public bool IsRunningOnGitHubActions { get; }
- public bool IsMainRepo { get; }
- public bool IsReleasableBranch { get; }
- public bool IsReleasable { get; }
- public NuGetVersion Version { get; set; }
- public bool ShouldPublishNugetPackages { get; set; }
- public string NugetFeedUrl { get; set; }
- public string? NugetApiKey { get; set; }
- }
-}
\ No newline at end of file
diff --git a/build/Configuration.cs b/build/Configuration.cs
deleted file mode 100644
index db3a682b..00000000
--- a/build/Configuration.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.ComponentModel;
-using Nuke.Common.Tooling;
-[TypeConverter(typeof(TypeConverter))]
-public class Configuration : Enumeration {
- public static Configuration Debug = new() { Value = nameof(Debug) };
- public static Configuration Release = new() { Value = nameof(Release) };
-
- public static implicit operator string(Configuration configuration) {
- return configuration.Value;
- }
-}
\ No newline at end of file
diff --git a/build/Directory.Build.props b/build/Directory.Build.props
deleted file mode 100644
index 44acce08..00000000
--- a/build/Directory.Build.props
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/build/Directory.Build.targets b/build/Directory.Build.targets
deleted file mode 100644
index 25326095..00000000
--- a/build/Directory.Build.targets
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/build/Numerge/Constants.cs b/build/Numerge/Constants.cs
deleted file mode 100644
index 2378ae19..00000000
--- a/build/Numerge/Constants.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Collections.Generic;
-using System.Xml.Linq;
-
-namespace Numerge
-{
- static class Constants
- {
- public const string ContentTypesFileName = "[Content_Types].xml";
-
- public const string ContentTypesXmlns = "http://schemas.openxmlformats.org/package/2006/content-types";
- public static XName ContentTypesName(string name) => XName.Get(name, ContentTypesXmlns);
- }
-}
\ No newline at end of file
diff --git a/build/Numerge/INumergeLogger.cs b/build/Numerge/INumergeLogger.cs
deleted file mode 100644
index 33db9059..00000000
--- a/build/Numerge/INumergeLogger.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-
-namespace Numerge
-{
- public interface INumergeLogger
- {
- void Log(NumergeLogLevel level, string message);
- }
-
- public enum NumergeLogLevel
- {
- Info, Warning, Error
- }
-
- public class NumergeConsoleLogger : INumergeLogger
- {
- public void Log(NumergeLogLevel level, string message)
- {
- var oldColor = Console.ForegroundColor;
- Console.ForegroundColor = level == NumergeLogLevel.Info
- ? oldColor
- : level == NumergeLogLevel.Warning
- ? ConsoleColor.Yellow
- : ConsoleColor.Red;
-
- Console.WriteLine(message);
- Console.ForegroundColor = oldColor;
- }
- }
-
- static class NumergeLoggerExtensions
- {
- public static void Warning(this INumergeLogger logger, string message)
- => logger.Log(NumergeLogLevel.Warning, message);
-
- public static void Error(this INumergeLogger logger, string message)
- => logger.Log(NumergeLogLevel.Error, message);
-
- public static void Info(this INumergeLogger logger, string message)
- => logger.Log(NumergeLogLevel.Info, message);
- }
-}
\ No newline at end of file
diff --git a/build/Numerge/LoadedPackage.cs b/build/Numerge/LoadedPackage.cs
deleted file mode 100644
index 7ac771c0..00000000
--- a/build/Numerge/LoadedPackage.cs
+++ /dev/null
@@ -1,352 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Xml.Linq;
-using static Numerge.Constants;
-// ReSharper disable PossibleNullReferenceException
-// ReSharper disable MemberCanBePrivate.Global
-// ReSharper disable IdentifierTypo
-// ReSharper disable StringLiteralTypo
-// ReSharper disable InconsistentNaming
-// ReSharper disable CommentTypo
-#pragma warning disable CS8603 // Possible null reference return.
-#pragma warning disable CS8601 // Possible null reference assignment.
-#pragma warning disable CS8602 // Dereference of a possibly null reference.
-#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
-
-namespace Numerge;
-
-class LoadedPackage {
- readonly string _nuspecName;
-
- public LoadedPackage(string fileName, byte[] package) {
- FileName = fileName;
- var arch = new ZipArchive(new MemoryStream(package));
- foreach (var e in arch.Entries)
- using (var s = e.Open()) {
- var ms = new MemoryStream();
- s.CopyTo(ms);
- BinaryContents.Add(e.FullName.Replace("\\", "/"), ms.ToArray());
- }
-
- var nuspecItem = BinaryContents.First(c => c.Key.EndsWith("nuspec"));
- _nuspecName = nuspecItem.Key;
-
- Spec = new LoadedNuspec(nuspecItem.Value);
- BinaryContents.Remove(_nuspecName);
-
- ContentTypes = new ContentTypes(BinaryContents[ContentTypesFileName]);
- BinaryContents.Remove(ContentTypesFileName);
- }
-
- public LoadedPackage(string path) : this(Path.GetFileName(path), File.ReadAllBytes(path)) { }
- public string FileName { get; }
- public Dictionary BinaryContents { get; } = new();
- public LoadedNuspec Spec { get; }
- public ContentTypes ContentTypes { get; }
-
- public void ResolveBinaryDependencies(Dictionary pkgs) {
- foreach (var grp in Spec.Dependencies) {
- foreach (var d in grp.Value.ToList())
- if (pkgs.TryGetValue(d.Id, out var bindep))
- grp.Value.Replace(d.Id, bindep);
- }
- }
-
- public void MergeContents(INumergeLogger logger, LoadedPackage victim,
- PackageMergeConfiguration config) {
- var ignoredPrefixes = new[] { "lib/", "_rels/", "package/" };
- foreach (var item in victim.BinaryContents.Where(x =>
- x.Key.Contains("/") && !ignoredPrefixes.Any(p => x.Key.StartsWith(p))))
- if (BinaryContents.ContainsKey(item.Key))
- logger.Warning($"{Spec.Id}: Refusing to replace item {item.Key} with item from {victim.Spec.Id}");
- else
- BinaryContents[item.Key] = item.Value;
-
- var libs = victim.BinaryContents.Where(x => x.Key.StartsWith("lib/"))
- .Select(x => new { sp = x.Key.Split(new[] { '/' }, 3), data = x.Value })
- .Select(x => new { Tfm = x.sp[1], File = x.sp[2], Data = x.data }).GroupBy(x => x.Tfm)
- .ToDictionary(x => x.Key, x => x.ToList());
-
- var ourFrameworks = BinaryContents.Where(x => x.Key.StartsWith("lib/")).Select(x => x.Key.Split('/')[1])
- .Distinct().ToList();
-
- foreach (var foreignTfm in libs)
- if (!ourFrameworks.Contains(foreignTfm.Key))
- throw new MergeAbortedException(
- $"Error merging {victim.Spec.Id}: Package {Spec.Id} doesn't have target framework {foreignTfm.Key}");
-
- //TODO: Actually detect compatibility with .NET Standard
- libs.TryGetValue("netstandard2.0", out var netstandardLibs);
-
- foreach (var framework in ourFrameworks) {
- libs.TryGetValue(framework, out var frameworkLibs);
- frameworkLibs = frameworkLibs ?? netstandardLibs;
- if (frameworkLibs == null) {
- if (!config.IgnoreMissingFrameworkBinaries)
- throw new MergeAbortedException(
- $"Unable to merge {victim.Spec.Id} to {Spec.Id}: {victim.Spec.Id} doesn't support {framework} or netstandard2.0");
- }
- else
-
- foreach (var lib in frameworkLibs) {
- var targetPath = $"lib/{framework}/{lib.File}";
- if (BinaryContents.ContainsKey(targetPath))
- logger.Warning(
- $"{Spec.Id}: Refusing to replace item {targetPath} with item from {victim.Spec.Id}");
- else
- BinaryContents[targetPath] = lib.Data;
- }
- }
-
-
- if (!config.DoNotMergeDependencies) {
- //TODO: Actually detect compatibility with .NET Standard
- if (!victim.Spec.Dependencies.TryGetValue(".NETStandard2.0", out var netstandardDeps))
- victim.Spec.Dependencies.TryGetValue("netstandard2.0", out netstandardDeps);
-
- var handledDepFrameworks = new HashSet();
- foreach (var group in victim.Spec.Dependencies) {
- Spec.Dependencies.GetOrCreateGroup(group.Key)
- .AddRange(group.Value);
- handledDepFrameworks.Add(group.Key);
- }
-
- foreach (var ourGroup in Spec.Dependencies)
- // Merge deps
- if (!handledDepFrameworks.Contains(ourGroup.Key)) {
- if (netstandardDeps == null) {
- if (!config.IgnoreMissingFrameworkDependencies)
- throw new MergeAbortedException(
- $"Unable to merge dependencies from {victim.Spec.Id} to {Spec.Id}: {victim.Spec.Id} doesn't have deps for {ourGroup.Key} or netstandard2.0");
- }
- else
- ourGroup.Value.AddRange(netstandardDeps);
- }
- }
-
- foreach (var ct in victim.ContentTypes)
- if (!ContentTypes.ContainsKey(ct.Key))
- ContentTypes[ct.Key] = ct.Value;
-
- }
-
- public void ReplaceDeps(string from, LoadedPackage to) =>
- Spec.Dependencies.Replace(from, to);
-
- public void Save(Stream stream) {
- var contents = BinaryContents.ToDictionary(x => x.Key, x => x.Value);
- contents[_nuspecName] = Spec.Serialize();
- contents[ContentTypesFileName] = ContentTypes.Serialize();
- using (var arch = new ZipArchive(stream, ZipArchiveMode.Create)) {
- foreach (var c in contents) {
- var e = arch.CreateEntry(c.Key, CompressionLevel.Optimal);
- using (var es = e.Open())
- es.Write(c.Value, 0, c.Value.Length);
- }
- }
- }
-
- public void SaveToDirectory(string dirPath) {
- Directory.CreateDirectory(dirPath);
- var path = Path.Combine(dirPath, FileName);
- using (var s = File.Create(path))
- Save(s);
- }
-}
-class LoadedNuspec {
- readonly byte[] _data;
- readonly string _xmlns;
-
- public LoadedNuspec(byte[] data) {
-
- _data = data;
- var doc = XDocument.Load(new MemoryStream(data));
- _xmlns = doc.Root.Name.Namespace.ToString();
-
- var deps = doc.Root.Descendants(NugetName("dependencies")).First();
- foreach (var group in deps.Elements(NugetName("group"))) {
- var tfm = group.Attribute("targetFramework").Value;
- var groupList = Dependencies[tfm] = new DependencyGroup();
- foreach (var dep in group.Elements())
- groupList.Add(new ExternalDependency(dep));
- }
-
- var metadata = doc.Root.Element(NugetName("metadata"));
- Id = metadata.Element(NugetName("id")).Value;
- Version = metadata.Element(NugetName("version")).Value;
- }
- public string Id { get; }
- public string Version { get; }
-
- public Dependencies Dependencies { get; } = new();
-
- public XName NugetName(string name) => XName.Get(name, _xmlns);
-
- public byte[] Serialize() {
- RemoveSelfDependency();
- var doc = XDocument.Load(new MemoryStream(_data));
- var deps = doc.Root.Descendants(NugetName("dependencies")).First();
- deps.RemoveAll();
- foreach (var group in Dependencies) {
- var el = new XElement(NugetName("group"));
- el.SetAttributeValue("targetFramework", group.Key);
- deps.Add(el);
- foreach (var dep in group.Value)
- el.Add(dep.Serialize(_xmlns));
- }
- var ms = new MemoryStream();
- doc.Save(ms, SaveOptions.OmitDuplicateNamespaces);
- return ms.ToArray();
- }
-
- public void RemoveSelfDependency() => Dependencies.RemoveDependency(Id);
-}
-class Dependencies : Dictionary {
- public DependencyGroup GetOrCreateGroup(string tfm) {
- if (!TryGetValue(tfm, out var grp))
- grp = this[tfm] = new DependencyGroup();
- return grp;
- }
-
- public void Add(string tfm, IDependency dependency) =>
- GetOrCreateGroup(tfm).Add(dependency);
-
- public void Replace(string what, LoadedPackage with) {
- foreach (var g in Values)
- g.Replace(what, with);
- }
-
- public void RemoveDependency(string id) {
- foreach (var g in Values)
- g.Remove(id);
- }
-}
-class DependencyGroup : IEnumerable {
- List _list = new List();
- public IEnumerator GetEnumerator() =>
- _list.GetEnumerator();
-
- IEnumerator IEnumerable.GetEnumerator() =>
- ((IEnumerable)_list).GetEnumerator();
-
- static string MergeExcludes(string first, string second) {
- var sl = (first ?? "").Split(',');
- var s2 = (second ?? "").Split(',');
- var a = sl.Where(e => s2.Contains(e)).ToArray();
- if (a.Length == 0)
- return null;
- return string.Join(",", a);
- }
-
- public void Add(IDependency dependency) {
- for (var c = 0; c < _list.Count; c++) {
- var d = _list[c];
- if (d.Id == dependency.Id) {
- var target = d is BinaryDependency ? d : dependency is BinaryDependency ? dependency : d;
- target.ExcludeAssets = MergeExcludes(d.ExcludeAssets, dependency.ExcludeAssets);
- _list[c] = target;
- return;
- }
- }
- _list.Add(dependency);
- }
-
- public void AddRange(IEnumerable deps) {
- foreach (var d in deps)
- Add(d);
- }
-
- public void Replace(string what, LoadedPackage package) {
- var dep = _list.FirstOrDefault(d => d.Id == what);
- if (dep == null)
- return;
- var newDep = new BinaryDependency(dep, package);
- _list.Remove(dep);
- Add(newDep);
- }
-
- public void Remove(string id) {
- var dep = _list.FirstOrDefault(d => d.Id == id);
- if (dep != null)
- _list.Remove(dep);
- }
-}
-interface IDependency {
- string Id { get; }
- string ExcludeAssets { get; set; }
- XElement Serialize(string xmlna);
-}
-class ExternalDependency : IDependency {
- private readonly XElement _el;
-
- public ExternalDependency(XElement el) {
- _el = el;
- Id = el.Attribute("id").Value;
- ExcludeAssets = el.Attribute("exclude")?.Value;
- }
-
- public string Id { get; }
- public string ExcludeAssets { get; set; }
- public XElement Serialize(string xmlns) {
- var rv = XElement.Load(_el.CreateReader());
- if (!string.IsNullOrWhiteSpace(ExcludeAssets))
- rv.SetAttributeValue("exclude", ExcludeAssets);
- else
- rv.Attribute("exclude")?.Remove();
-
- foreach (var e in rv.DescendantsAndSelf()) {
- e.Name = XName.Get(rv.Name.LocalName, xmlns);
- foreach (var a in e.Attributes().ToList()) {
- a.Remove();
- e.SetAttributeValue(XName.Get(a.Name.LocalName), a.Value);
- }
- }
-
- return rv;
- }
-}
-class BinaryDependency : IDependency {
- public BinaryDependency(IDependency original, LoadedPackage package) {
- Package = package;
- ExcludeAssets = original.ExcludeAssets;
- }
- public LoadedPackage Package { get; }
- public string Id => Package.Spec.Id;
- public string ExcludeAssets { get; set; }
-
- public XElement Serialize(string xmlns) {
- var rv = new XElement(XName.Get("dependency", xmlns));
- rv.SetAttributeValue("id", Id);
- rv.SetAttributeValue("version", Package.Spec.Version);
- if (!string.IsNullOrWhiteSpace(ExcludeAssets))
- rv.SetAttributeValue("exclude", ExcludeAssets);
- return rv;
- }
-}
-class ContentTypes : Dictionary {
- public ContentTypes(byte[] data) {
- var doc = XDocument.Load(new MemoryStream(data));
- foreach (var el in doc.Root.Elements())
- this[el.Attribute("Extension").Value] =
- el.Attribute("ContentType").Value;
- }
-
- public byte[] Serialize() {
- var types = new XElement(ContentTypesName("Types"));
- var doc = new XDocument(new XDeclaration("1.0", "utf-8", ""), types);
-
- foreach (var kp in this) {
- var el = new XElement(ContentTypesName("Default"));
- el.SetAttributeValue("Extension", kp.Key);
- el.SetAttributeValue("ContentType", kp.Value);
-
- types.Add(el);
- }
- var ms = new MemoryStream();
- doc.Save(ms);
- return ms.ToArray();
- }
-}
\ No newline at end of file
diff --git a/build/Numerge/MergeAbortedException.cs b/build/Numerge/MergeAbortedException.cs
deleted file mode 100644
index debc2aae..00000000
--- a/build/Numerge/MergeAbortedException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Numerge
-{
- public class MergeAbortedException : Exception
- {
- public MergeAbortedException(string message) : base(message)
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/build/Numerge/MergeConfiguration.cs b/build/Numerge/MergeConfiguration.cs
deleted file mode 100644
index a1d6f798..00000000
--- a/build/Numerge/MergeConfiguration.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Json;
-#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
-#pragma warning disable CS8603 // Possible null reference return.
-#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
-
-namespace Numerge;
-
-[DataContract]
-public class MergeConfiguration {
- [DataMember]
- public List Packages { get; set; }
-
- public static MergeConfiguration Load(Stream s) {
- var serializer = new DataContractJsonSerializer(typeof(MergeConfiguration), new DataContractJsonSerializerSettings() {
- UseSimpleDictionaryFormat = true
- });
- return (MergeConfiguration)serializer.ReadObject(s);
- }
-
- public static MergeConfiguration LoadFile(string path) {
- using (var s = File.OpenRead(path))
- return Load(s);
- }
-}
-[DataContract]
-public class PackageContfiguration {
- [DataMember]
- public string Id { get; set; }
-
- [DataMember]
- public string IncomingIncludeAssetsOverride { get; set; }
-
- [DataMember]
- public bool MergeAll { get; set; }
-
- [DataMember]
- public List Exclude { get; set; } = new List();
-
- [DataMember]
- public List Merge { get; set; } =
- new List();
-}
-[DataContract]
-public class PackageMergeConfiguration {
- [DataMember]
- public string Id { get; set; }
-
- [DataMember]
- public bool IgnoreMissingFrameworkBinaries { get; set; }
-
- [DataMember]
- public bool IgnoreMissingFrameworkDependencies { get; set; }
-
- [DataMember]
- public bool DoNotMergeDependencies { get; set; }
-}
\ No newline at end of file
diff --git a/build/Numerge/NugetPackageMerger.cs b/build/Numerge/NugetPackageMerger.cs
deleted file mode 100644
index 326b2602..00000000
--- a/build/Numerge/NugetPackageMerger.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-// ReSharper disable PossibleNullReferenceException
-// ReSharper disable MemberCanBePrivate.Global
-// ReSharper disable IdentifierTypo
-// ReSharper disable StringLiteralTypo
-// ReSharper disable InconsistentNaming
-// ReSharper disable CommentTypo
-namespace Numerge
-{
- public static class NugetPackageMerger
- {
- public static bool Merge(string directory, string output,
- MergeConfiguration configuration, INumergeLogger logger)
- {
- return MergeCore(directory, output, configuration, logger, "*.nupkg", allowMissing: false)
- && MergeCore(directory, output, configuration, logger, "*.snupkg", allowMissing: true);
- }
-
- static bool MergeCore(string directory, string output,
- MergeConfiguration configuration, INumergeLogger logger, string searchPattern, bool allowMissing)
- {
- try
- {
- var packages = Directory.EnumerateFiles(directory, searchPattern).Select(p => new LoadedPackage(p))
- .ToDictionary(p => p.Spec.Id);
-
- foreach (var p in packages.Values)
- p.ResolveBinaryDependencies(packages);
-
- foreach (var config in configuration.Packages)
- {
- logger.Info($"Processing {config.Id}");
- if (!packages.TryGetValue(config.Id, out var package))
- {
- if (allowMissing)
- continue;
- throw new MergeAbortedException($"Package {config.Id} not found");
- }
-
- var mergeConfigs = config.Merge?.ToList() ?? new List();
- if (config.MergeAll)
- {
- foreach (var dep in package.Spec.Dependencies
- .SelectMany(x => x.Value).OfType())
- {
- if (mergeConfigs.All(x => x.Id != dep.Id) &&
- (config.Exclude == null || !config.Exclude.Contains(dep.Id)))
- mergeConfigs.Add(new PackageMergeConfiguration {Id = dep.Id});
- }
- }
-
- foreach (var mergeConfig in mergeConfigs)
- {
- logger.Info($"Merging {mergeConfig.Id}");
- if (!packages.TryGetValue(mergeConfig.Id, out var victim))
- {
- if (allowMissing)
- continue;
- throw new MergeAbortedException($"Package {mergeConfig.Id} not found");
- }
-
- package.MergeContents(logger, victim, mergeConfig);
- foreach (var p in packages.Values)
- p.ReplaceDeps(mergeConfig.Id, package);
- packages.Remove(mergeConfig.Id);
- }
-
- if (config.IncomingIncludeAssetsOverride != null)
- {
- foreach (var d in packages.Values
- .SelectMany(p => p.Spec.Dependencies.Values.SelectMany(x => x)))
- if (d.Id == package.Spec.Id)
- d.ExcludeAssets = config.IncomingIncludeAssetsOverride;
- }
- }
-
- foreach (var package in packages.Values)
- {
- logger.Info($"Saving {package.FileName}");
- package.SaveToDirectory(output);
- }
- }
- catch (MergeAbortedException e)
- {
- logger.Error(e.Message);
- return false;
- }
-
- return true;
- }
-
-
- }
-}
diff --git a/build/Shims.cs b/build/Shims.cs
deleted file mode 100644
index 17277987..00000000
--- a/build/Shims.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using NuGet.Common;
-using Numerge;
-using Serilog.Events;
-// ReSharper disable TemplateIsNotCompileTimeConstantProblem
-
-public partial class Build {
- sealed class NumergeNukeLogger : INumergeLogger {
- public void Log(NumergeLogLevel level, string message) {
- switch (level) {
- case NumergeLogLevel.Error:
- Serilog.Log.Error(message);
- break;
- case NumergeLogLevel.Warning:
- Serilog.Log.Warning(message);
- break;
- case NumergeLogLevel.Info:
- default:
- Serilog.Log.Information(message);
- break;
- }
- }
- }
-
- sealed class NugetLogger : ILogger {
- public static NugetLogger Instance { get; } = new();
- ///
- public void LogDebug(string data) => Log(LogLevel.Debug, data);
- ///
- public void LogVerbose(string data) => Log(LogLevel.Verbose, data);
- ///
- public void LogInformation(string data) => Log(LogLevel.Information, data);
- ///
- public void LogMinimal(string data) => Log(LogLevel.Minimal, data);
- ///
- public void LogWarning(string data) => Log(LogLevel.Warning, data);
- ///
- public void LogError(string data) => Log(LogLevel.Error, data);
- ///
- public void LogInformationSummary(string data) => Log(LogLevel.Information, data);
- ///
- public void Log(LogLevel level, string data) {
- var logEventLevel = GetSerilogLogEventLevel(level);
- Serilog.Log.Write(logEventLevel, data);
- }
- ///
- public Task LogAsync(LogLevel level, string data) {
- Log(level, data);
- return Task.CompletedTask;
- }
- ///
- public void Log(ILogMessage message) {
- var serilogLogEventLevel = GetSerilogLogEventLevel(message.Level);
- var code = message.Code == NuGetLogCode.Undefined ? string.Empty : $" {message.Code}";
- Serilog.Log.Write(serilogLogEventLevel, "NUGET{Code}: {Message} at {ProjectPath}", code, message.Message, message.ProjectPath);
- }
- ///
- public Task LogAsync(ILogMessage message) {
- Log(message);
- return Task.CompletedTask;
- }
-
- static LogEventLevel GetSerilogLogEventLevel(LogLevel level) {
- var logEventLevel = level switch {
- LogLevel.Debug => LogEventLevel.Debug,
- LogLevel.Verbose => LogEventLevel.Verbose,
- LogLevel.Information => LogEventLevel.Information,
- LogLevel.Minimal => LogEventLevel.Information,
- LogLevel.Warning => LogEventLevel.Warning,
- LogLevel.Error => LogEventLevel.Error,
- _ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
- };
- return logEventLevel;
- }
- }
-}
\ No newline at end of file
diff --git a/build/_build.csproj b/build/_build.csproj
deleted file mode 100644
index c05f459f..00000000
--- a/build/_build.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- Exe
- net8.0
-
- CS0649;CS0169;NU5104;NU1507
- ..
- ..
- 1
- True
- True
- true
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
- v
- nightly
-
-