-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert name change, add new IHaveCommonLintTargets to group common li… (
#1310) * revert name change, add new IHaveCommonLintTargets to group common linting tasks. * Try to fix pr list of files.. * Automatically linting code --------- Co-authored-by: Rocket Understudy <33589210+rsg-bot@users.noreply.github.com>
- Loading branch information
1 parent
c862ff0
commit 6134894
Showing
6 changed files
with
127 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Utilities.Collections; | ||
|
||
// ReSharper disable SuspiciousTypeConversion.Global | ||
|
||
namespace Rocket.Surgery.Nuke; | ||
|
||
/// <summary> | ||
/// Defines a target that cleans common directories | ||
/// </summary> | ||
[PublicAPI] | ||
public interface ICanClean : IHaveCleanTarget, IHaveBuildTarget | ||
{ | ||
/// <summary> | ||
/// clean all artifact directories | ||
/// </summary> | ||
[NonEntryTarget] | ||
public Target CleanWellKnownTemporaryFiles => d => d | ||
.Before(Build) | ||
.TryDependentFor<IHaveCleanTarget>(z => z.Clean) | ||
.Executes( | ||
() => | ||
{ | ||
if (this is IHaveArtifacts artifacts) | ||
{ | ||
_ = artifacts.ArtifactsDirectory.CreateOrCleanDirectory(); | ||
if (artifacts is IHaveOutputLogs logs) | ||
{ | ||
_ = logs.LogsDirectory.CreateDirectory(); | ||
} | ||
|
||
if (artifacts is IHaveTestArtifacts testArtifacts) | ||
{ | ||
_ = testArtifacts.TestResultsDirectory.CreateDirectory(); | ||
} | ||
|
||
if (artifacts is IHaveNuGetPackages nuGetArtifacts) | ||
{ | ||
_ = nuGetArtifacts.NuGetPackageDirectory.CreateDirectory(); | ||
} | ||
|
||
if (artifacts is IHavePublishArtifacts publishArtifacts) | ||
{ | ||
_ = publishArtifacts.PublishDirectory.CreateDirectory(); | ||
} | ||
|
||
if (artifacts is IHaveOutputArtifacts outputArtifacts) | ||
{ | ||
_ = outputArtifacts.OutputArtifactsDirectory.CreateDirectory(); | ||
} | ||
} | ||
|
||
if (this is IHaveCodeCoverage codeCoverage) | ||
{ | ||
_ = codeCoverage.CoverageDirectory.CreateOrCleanDirectory(); | ||
} | ||
|
||
// ReSharper disable SuspiciousTypeConversion.Global | ||
if (this is not IMayTheForceBeWithYou forceBeWithYou || !forceBeWithYou.Force) | ||
{ | ||
return; | ||
} | ||
|
||
if (this is IComprehendSamples samples && samples.SampleDirectory.DirectoryExists()) | ||
{ | ||
samples | ||
.SampleDirectory.GlobDirectories("**/bin", "**/obj") | ||
.ForEach(AbsolutePathExtensions.DeleteDirectory); | ||
} | ||
|
||
if (this is IComprehendSources sources && sources.SourceDirectory.DirectoryExists()) | ||
{ | ||
sources | ||
.SourceDirectory.GlobDirectories("**/bin", "**/obj") | ||
.ForEach(AbsolutePathExtensions.DeleteDirectory); | ||
} | ||
|
||
if (this is IComprehendTemplates templates && templates.TemplatesDirectory.DirectoryExists()) | ||
{ | ||
templates | ||
.TemplatesDirectory.GlobDirectories("**/bin", "**/obj") | ||
.ForEach(AbsolutePathExtensions.DeleteDirectory); | ||
} | ||
|
||
if (this is IComprehendTests tests && tests.TestsDirectory.DirectoryExists()) | ||
{ | ||
tests | ||
.TestsDirectory.GlobDirectories("**/bin", "**/obj") | ||
.ForEach(AbsolutePathExtensions.DeleteDirectory); | ||
} | ||
} // ReSharper restore SuspiciousTypeConversion.Global | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Rocket.Surgery.Nuke.DotNetCore; | ||
|
||
namespace Rocket.Surgery.Nuke; | ||
|
||
/// <summary> | ||
/// Defines a target that cleans common directories | ||
/// </summary> | ||
public interface IHaveCommonLintTargets : | ||
ICanDotNetFormat, | ||
ICanPrettier, | ||
IHavePublicApis, | ||
ICanUpdateReadme, | ||
ICanUpdateSolution, | ||
ICanRegenerateBuildConfiguration; |