Skip to content

Commit

Permalink
fix cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
crobibero committed Feb 22, 2024
1 parent eca148f commit 6e766cc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,6 @@ pip-log.txt
##########
# Rider
##########
.idea/
.idea/

artifacts/
2 changes: 2 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"items": {
"type": "string",
"enum": [
"CleanGenerated",
"CopyConfig",
"RestoreTools",
"Run"
Expand All @@ -88,6 +89,7 @@
"items": {
"type": "string",
"enum": [
"CleanGenerated",
"CopyConfig",
"RestoreTools",
"Run"
Expand Down
33 changes: 32 additions & 1 deletion nuke/Generate.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
using System;
using System.IO;
using System.Linq;
using Nuke.Common;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Serilog;

public class Generate : NukeBuild
{
static string[] IgnoreFiles =
[
".editorconfig",
"kiota-lock.json",
"kiota-lock-stable.json",
"kiota-lock-unstable.json"
];


public static int Main () => Execute<Generate>(x => x.Run);

[Parameter("Configuration to build - 'Stable' (default) or 'Unstable'")]
Expand All @@ -15,9 +26,29 @@ public class Generate : NukeBuild
readonly Solution Solution;

Target RestoreTools => g => g.Executes(() => DotNetTasks.DotNetToolRestore());

Target CleanGenerated => g => g.Executes(() =>
{
var generatedDirectory = new DirectoryInfo(Path.Combine(Solution.Jellyfin_Sdk.Directory, "Generated"));

foreach (var file in generatedDirectory.GetFiles())
{
if (IgnoreFiles.Contains(file.Name, StringComparer.OrdinalIgnoreCase))
{
continue;
}

file.Delete();
}

foreach (var directory in generatedDirectory.GetDirectories())
{
directory.Delete(recursive: true);
}
});

Target CopyConfig => g => g
.DependsOn(RestoreTools)
.DependsOn(RestoreTools, CleanGenerated)
.Executes(() =>
{
var sourceFile = Configuration == Configuration.Stable
Expand Down
2 changes: 2 additions & 0 deletions src/Jellyfin.Sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{78BA
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple", "..\samples\Simple\Simple.csproj", "{7BBC005F-06BE-4CDB-9E64-C4AA54CAE667}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_nuke", "..\nuke\_nuke.csproj", "{7CB9B852-FD55-4BD1-B7D6-C7C9300CB31E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down

0 comments on commit 6e766cc

Please sign in to comment.