Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<PropertyGroup>
<Product>DecSm Dotnet Tools</Product>
<Product>Invex Dotnet Tools</Product>
<Authors>Declan Smith</Authors>
<Company>Invex</Company>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageDescription>A collection of useful .NET tools.</PackageDescription>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics.CodeAnalysis;

namespace DecSm.Tools.ArtifactClean;
namespace Invex.Tools.ArtifactClean;

public sealed class Commands
{
Expand All @@ -13,7 +11,8 @@ public sealed class Commands
};

/// <summary>
/// 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.
/// </summary>
/// <param name="path">-p, The root path to start cleaning from. [Default: Current directory]</param>
/// <param name="noRestore">-n, If true, skips any restore operations. [Default: false]</param>
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion DecSm.Tools.slnx → Invex.Tools.slnx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Solution>
<Project Path="DecSm.Tools.ArtifactClean/DecSm.Tools.ArtifactClean.csproj" />
<Project Path="Invex.Tools.ArtifactClean/Invex.Tools.ArtifactClean.csproj" />
<Project Path="_atom/_atom.csproj" />
</Solution>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DecSm.Dotnet.Tools
# Invex.Dotnet.Tools

A collection of useful .NET tools for developers.

Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions _atom/ITargets.cs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
1 change: 1 addition & 0 deletions _atom/_usings.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
global using System.Runtime.InteropServices;
global using DecSm.Atom.Module.Dotnet.Helpers;
global using JetBrains.Annotations;
Loading