diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index fd35569..11bf5a1 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -57,11 +57,11 @@ jobs: job-runs-on: ${{ matrix.job-runs-on }} build-slice: ${{ matrix.job-runs-on }} - - name: Upload DecSm.Tools.ArtifactClean + - name: Upload Invex.Tools.ArtifactClean uses: actions/upload-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-${{ matrix.job-runs-on }} - path: "${{ github.workspace }}/.github/publish/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-${{ matrix.job-runs-on }} + path: "${{ github.workspace }}/.github/publish/Invex.Tools.ArtifactClean" PushToNuget: needs: [ Pack ] @@ -76,23 +76,23 @@ jobs: with: dotnet-version: '10.0.x' - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-windows-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-windows-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-ubuntu-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-ubuntu-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-macos-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-macos-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - name: PushToNuget id: PushToNuget @@ -116,23 +116,23 @@ jobs: with: dotnet-version: '10.0.x' - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-windows-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-windows-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-ubuntu-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-ubuntu-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - - name: Download DecSm.Tools.ArtifactClean + - name: Download Invex.Tools.ArtifactClean uses: actions/download-artifact@v4 with: - name: DecSm.Tools.ArtifactClean-macos-latest - path: "${{ github.workspace }}/.github/artifacts/DecSm.Tools.ArtifactClean" + name: Invex.Tools.ArtifactClean-macos-latest + path: "${{ github.workspace }}/.github/artifacts/Invex.Tools.ArtifactClean" - name: PushToRelease id: PushToRelease diff --git a/Directory.Build.props b/Directory.Build.props index 121b657..08e0163 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,8 @@ - DecSm Dotnet Tools + Invex Dotnet Tools Declan Smith + Invex icon.png README.md A collection of useful .NET tools. diff --git a/DecSm.Tools.ArtifactClean/Commands.cs b/Invex.Tools.ArtifactClean/Commands.cs similarity index 73% rename from DecSm.Tools.ArtifactClean/Commands.cs rename to Invex.Tools.ArtifactClean/Commands.cs index 98c05dd..9baad92 100644 --- a/DecSm.Tools.ArtifactClean/Commands.cs +++ b/Invex.Tools.ArtifactClean/Commands.cs @@ -1,6 +1,4 @@ -using System.Diagnostics.CodeAnalysis; - -namespace DecSm.Tools.ArtifactClean; +namespace Invex.Tools.ArtifactClean; public sealed class Commands { @@ -13,7 +11,8 @@ public sealed class Commands }; /// - /// Cleans 'bin' and 'obj' directories recursively from the specified path, and then optionally restores the project. + /// Runs 'dotnet clean', then recursively deletes 'bin' and 'obj' directories from the specified path and optionally + /// restores the project. /// /// -p, The root path to start cleaning from. [Default: Current directory] /// -n, If true, skips any restore operations. [Default: false] @@ -27,6 +26,7 @@ public void Clean([HideDefaultValue] string? path = null, bool noRestore = false if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path)) return; + DotnetClean(); CleanRecursive(path); if (noRestore) @@ -63,6 +63,38 @@ public void Clean([HideDefaultValue] string? path = null, bool noRestore = false } } + private static void DotnetClean() + { + var cleanProcessStartInfo = new ProcessStartInfo("dotnet", "clean") + { + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + }; + + using var process = Process.Start(cleanProcessStartInfo); + + if (process == null) + { + Console.Error.WriteLine("Failed to start 'dotnet clean' process."); + + return; + } + + process.WaitForExit(); + + if (process.ExitCode == 0) + { + Console.WriteLine("'dotnet clean' completed successfully."); + } + else + { + Console.Error.WriteLine($"'dotnet clean' failed with exit code {process.ExitCode}."); + Console.Error.WriteLine(process.StandardError.ReadToEnd()); + } + } + private static void CleanRecursive(string path) { try diff --git a/DecSm.Tools.ArtifactClean/DecSm.Tools.ArtifactClean.csproj b/Invex.Tools.ArtifactClean/Invex.Tools.ArtifactClean.csproj similarity index 100% rename from DecSm.Tools.ArtifactClean/DecSm.Tools.ArtifactClean.csproj rename to Invex.Tools.ArtifactClean/Invex.Tools.ArtifactClean.csproj diff --git a/DecSm.Tools.ArtifactClean/Program.cs b/Invex.Tools.ArtifactClean/Program.cs similarity index 100% rename from DecSm.Tools.ArtifactClean/Program.cs rename to Invex.Tools.ArtifactClean/Program.cs diff --git a/DecSm.Tools.ArtifactClean/_usings.cs b/Invex.Tools.ArtifactClean/_usings.cs similarity index 54% rename from DecSm.Tools.ArtifactClean/_usings.cs rename to Invex.Tools.ArtifactClean/_usings.cs index 7f2c1a5..5ab9053 100644 --- a/DecSm.Tools.ArtifactClean/_usings.cs +++ b/Invex.Tools.ArtifactClean/_usings.cs @@ -1,4 +1,5 @@ global using System.Diagnostics; +global using System.Diagnostics.CodeAnalysis; global using ConsoleAppFramework; -global using DecSm.Tools.ArtifactClean; +global using Invex.Tools.ArtifactClean; global using JetBrains.Annotations; diff --git a/DecSm.Tools.slnx b/Invex.Tools.slnx similarity index 55% rename from DecSm.Tools.slnx rename to Invex.Tools.slnx index 1408ec7..311cf85 100644 --- a/DecSm.Tools.slnx +++ b/Invex.Tools.slnx @@ -1,4 +1,4 @@ - + diff --git a/README.md b/README.md index a3037ab..c68ba9d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DecSm.Dotnet.Tools +# Invex.Dotnet.Tools A collection of useful .NET tools for developers. @@ -38,7 +38,7 @@ artclean [path] [options] ## Repository Structure -- `DecSm.Tools.ArtifactClean`: Source code for the `artclean` tool. +- `Invex.Tools.ArtifactClean`: Source code for the `artclean` tool. - `_atom`: The **Atom** build system project used for CI/CD and automation. ## License diff --git a/_atom/ITargets.cs b/_atom/ITargets.cs index 43ac591..90a39a1 100644 --- a/_atom/ITargets.cs +++ b/_atom/ITargets.cs @@ -1,11 +1,9 @@ -using JetBrains.Annotations; - -namespace Atom; +namespace Atom; [PublicAPI] internal interface ITargets : IDotnetPackHelper, IDotnetTestHelper, INugetHelper, IGithubReleaseHelper, ISetupBuildInfo { - static readonly string[] ToolsToPack = [Projects.DecSm_Tools_ArtifactClean.Name]; + static readonly string[] ToolsToPack = [Projects.Invex_Tools_ArtifactClean.Name]; [ParamDefinition("nuget-push-feed", "The Nuget feed to push to.")] string NugetFeed => GetParam(() => NugetFeed, "https://api.nuget.org/v3/index.json"); diff --git a/_atom/_usings.cs b/_atom/_usings.cs index 5acc79a..8efec41 100644 --- a/_atom/_usings.cs +++ b/_atom/_usings.cs @@ -1,2 +1,3 @@ global using System.Runtime.InteropServices; global using DecSm.Atom.Module.Dotnet.Helpers; +global using JetBrains.Annotations;