Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ignore paths to the solution update, and defaulted them to igno… #1088

Merged
merged 1 commit into from
Jan 31, 2024
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
154 changes: 0 additions & 154 deletions Nuke.sln
Original file line number Diff line number Diff line change
Expand Up @@ -80,135 +80,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vscode", ".vscode", "{B3A0
.vscode/settings.json = .vscode/settings.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "node_modules", "node_modules", "{CA1E2735-79F3-4824-A1E5-ED26591DFFA2}"
ProjectSection(SolutionItems) = preProject
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "define-properties", "define-properties", "{C810602D-E932-40D7-8109-3205DA8E44DE}"
ProjectSection(SolutionItems) = preProject
node_modules/define-properties/.editorconfig = node_modules/define-properties/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "es-abstract", "es-abstract", "{B9A10660-999D-4449-9DF5-6F6AE61B4DD6}"
ProjectSection(SolutionItems) = preProject
node_modules/es-abstract/.editorconfig = node_modules/es-abstract/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "for-each", "for-each", "{F97BF990-97A7-4637-99D9-AC70F4B20E05}"
ProjectSection(SolutionItems) = preProject
node_modules/for-each/.editorconfig = node_modules/for-each/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "function-bind", "function-bind", "{5167B0F3-107D-4270-AC5D-A43F9A09698E}"
ProjectSection(SolutionItems) = preProject
node_modules/function-bind/.editorconfig = node_modules/function-bind/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "function.prototype.name", "function.prototype.name", "{F215BD0A-CF1C-465D-8F7B-D8B2FCDF81F3}"
ProjectSection(SolutionItems) = preProject
node_modules/function.prototype.name/.editorconfig = node_modules/function.prototype.name/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "functions-have-names", "functions-have-names", "{4F3E8AFF-E018-4E28-9EA5-B768FDFE78E2}"
ProjectSection(SolutionItems) = preProject
node_modules/functions-have-names/.editorconfig = node_modules/functions-have-names/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "internal-slot", "internal-slot", "{E7DCFB20-4DB4-464B-827D-704A08E1C04D}"
ProjectSection(SolutionItems) = preProject
node_modules/internal-slot/.editorconfig = node_modules/internal-slot/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-boolean-object", "is-boolean-object", "{B4C4F857-7182-4CD0-A2C2-24F69AB3C068}"
ProjectSection(SolutionItems) = preProject
node_modules/is-boolean-object/.editorconfig = node_modules/is-boolean-object/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-callable", "is-callable", "{27F304EC-7CB5-42C6-9177-7F6DE2E3CE07}"
ProjectSection(SolutionItems) = preProject
node_modules/is-callable/.editorconfig = node_modules/is-callable/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-date-object", "is-date-object", "{91D02175-3A1C-46DF-9D58-EB7711E74416}"
ProjectSection(SolutionItems) = preProject
node_modules/is-date-object/.editorconfig = node_modules/is-date-object/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-negative-zero", "is-negative-zero", "{6CA19B25-7810-48FF-B70B-5C9B26AE32FF}"
ProjectSection(SolutionItems) = preProject
node_modules/is-negative-zero/.editorconfig = node_modules/is-negative-zero/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-number-object", "is-number-object", "{2F296B33-ADBA-4C74-9670-BAB8ACC4C711}"
ProjectSection(SolutionItems) = preProject
node_modules/is-number-object/.editorconfig = node_modules/is-number-object/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-regex", "is-regex", "{32CF1691-A8CC-43F8-AFAB-1915D1D1AA76}"
ProjectSection(SolutionItems) = preProject
node_modules/is-regex/.editorconfig = node_modules/is-regex/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-symbol", "is-symbol", "{7220CF76-1FF9-4AD6-8EBE-E15A06C2E221}"
ProjectSection(SolutionItems) = preProject
node_modules/is-symbol/.editorconfig = node_modules/is-symbol/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "is-typed-array", "is-typed-array", "{D236D6E2-E8A0-497C-940B-65D39E5BE58D}"
ProjectSection(SolutionItems) = preProject
node_modules/is-typed-array/.editorconfig = node_modules/is-typed-array/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lokijs", "lokijs", "{F949B6A7-F989-4EF2-B45E-1538A8931968}"
ProjectSection(SolutionItems) = preProject
node_modules/lokijs/.editorconfig = node_modules/lokijs/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "object-keys", "object-keys", "{668ACBB8-9D9E-4702-AEE0-C76F808B14D3}"
ProjectSection(SolutionItems) = preProject
node_modules/object-keys/.editorconfig = node_modules/object-keys/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "object.assign", "object.assign", "{A3A29247-E58E-4C3F-ABDF-38C9414656B1}"
ProjectSection(SolutionItems) = preProject
node_modules/object.assign/.editorconfig = node_modules/object.assign/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "qs", "qs", "{52163B52-C176-4186-8687-EB3C81A24D02}"
ProjectSection(SolutionItems) = preProject
node_modules/qs/.editorconfig = node_modules/qs/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "regexp.prototype.flags", "regexp.prototype.flags", "{167A05BD-9A91-4D94-9567-E53F4050EFB4}"
ProjectSection(SolutionItems) = preProject
node_modules/regexp.prototype.flags/.editorconfig = node_modules/regexp.prototype.flags/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "string.prototype.trimend", "string.prototype.trimend", "{713086C3-B631-419C-83CD-257193ACF0AC}"
ProjectSection(SolutionItems) = preProject
node_modules/string.prototype.trimend/.editorconfig = node_modules/string.prototype.trimend/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "string.prototype.trimstart", "string.prototype.trimstart", "{34EFDB2C-60FA-4799-838D-1B5E7A22E837}"
ProjectSection(SolutionItems) = preProject
node_modules/string.prototype.trimstart/.editorconfig = node_modules/string.prototype.trimstart/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unbox-primitive", "unbox-primitive", "{3BA719F1-5AB2-4F1A-927D-F2F02C972E04}"
ProjectSection(SolutionItems) = preProject
node_modules/unbox-primitive/.editorconfig = node_modules/unbox-primitive/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "which-boxed-primitive", "which-boxed-primitive", "{9612AEDD-851F-4435-B00E-652334E774DF}"
ProjectSection(SolutionItems) = preProject
node_modules/which-boxed-primitive/.editorconfig = node_modules/which-boxed-primitive/.editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "which-typed-array", "which-typed-array", "{076E16A3-B48A-4503-9DF0-2872EA381A18}"
ProjectSection(SolutionItems) = preProject
node_modules/which-typed-array/.editorconfig = node_modules/which-typed-array/.editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -261,31 +132,6 @@ Global
{D92D8A6D-4ED9-4F7B-B43D-26BEE3F110C2} = {C9A77903-FD53-44D1-AADB-E46BD36188C3}
{39F6D15D-2627-4749-9B1D-EB7C9C656465} = {AE7B2AE7-C209-4B7F-B1B8-AF150FA27A8F}
{B3A06ADD-1DA1-4B79-98C6-2527B8842984} = {AE7B2AE7-C209-4B7F-B1B8-AF150FA27A8F}
{C810602D-E932-40D7-8109-3205DA8E44DE} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{B9A10660-999D-4449-9DF5-6F6AE61B4DD6} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{F97BF990-97A7-4637-99D9-AC70F4B20E05} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{5167B0F3-107D-4270-AC5D-A43F9A09698E} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{F215BD0A-CF1C-465D-8F7B-D8B2FCDF81F3} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{4F3E8AFF-E018-4E28-9EA5-B768FDFE78E2} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{E7DCFB20-4DB4-464B-827D-704A08E1C04D} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{B4C4F857-7182-4CD0-A2C2-24F69AB3C068} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{27F304EC-7CB5-42C6-9177-7F6DE2E3CE07} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{91D02175-3A1C-46DF-9D58-EB7711E74416} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{6CA19B25-7810-48FF-B70B-5C9B26AE32FF} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{2F296B33-ADBA-4C74-9670-BAB8ACC4C711} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{32CF1691-A8CC-43F8-AFAB-1915D1D1AA76} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{7220CF76-1FF9-4AD6-8EBE-E15A06C2E221} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{D236D6E2-E8A0-497C-940B-65D39E5BE58D} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{F949B6A7-F989-4EF2-B45E-1538A8931968} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{668ACBB8-9D9E-4702-AEE0-C76F808B14D3} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{A3A29247-E58E-4C3F-ABDF-38C9414656B1} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{52163B52-C176-4186-8687-EB3C81A24D02} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{167A05BD-9A91-4D94-9567-E53F4050EFB4} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{713086C3-B631-419C-83CD-257193ACF0AC} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{34EFDB2C-60FA-4799-838D-1B5E7A22E837} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{3BA719F1-5AB2-4F1A-927D-F2F02C972E04} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{9612AEDD-851F-4435-B00E-652334E774DF} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
{076E16A3-B48A-4503-9DF0-2872EA381A18} = {CA1E2735-79F3-4824-A1E5-ED26591DFFA2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {439897C2-CCBD-44FE-B2DC-A3E4670ADA59}
Expand Down
5 changes: 3 additions & 2 deletions src/Nuke/LocalBuildConventionsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
SolutionUpdater.UpdateSolution(
haveSolution.Solution,
attributes.SelectMany(z => z.AdditionalRelativeFolderFilePatterns),
attributes.SelectMany(z => z.AdditionalConfigFolderFilePatterns)
attributes.SelectMany(z => z.AdditionalConfigFolderFilePatterns),
attributes.SelectMany(z => z.AdditionalIgnoreFolderFilePatterns)

Check warning on line 36 in src/Nuke/LocalBuildConventionsAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/LocalBuildConventionsAttribute.cs#L35-L36

Added lines #L35 - L36 were not covered by tests
);
File.SetLastWriteTime(path, DateTime.Now);
}
Expand Down Expand Up @@ -69,4 +70,4 @@

EnsureSolutionIsUptoDate(nukeBuild, haveSolution);
}
}
}
3 changes: 2 additions & 1 deletion src/Nuke/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,9 @@ Rocket.Surgery.Nuke.Readme.Sections.Sections() -> void
Rocket.Surgery.Nuke.SolutionExtensions
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute.AdditionalConfigFolderFilePatterns.get -> string![]!
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute.AdditionalIgnoreFolderFilePatterns.get -> string![]!
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute.AdditionalRelativeFolderFilePatterns.get -> string![]!
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute.SolutionUpdaterConfigurationAttribute(string![]? additionalRelativeFolderFilePatterns = null, string![]? additionalConfigFolderFilePatterns = null) -> void
Rocket.Surgery.Nuke.SolutionUpdaterConfigurationAttribute.SolutionUpdaterConfigurationAttribute(string![]? additionalRelativeFolderFilePatterns = null, string![]? additionalConfigFolderFilePatterns = null, string![]? additionalIgnoreFolderFilePatterns = null) -> void
Rocket.Surgery.Nuke.StringExtensions
Rocket.Surgery.Nuke.Symbols
Rocket.Surgery.Nuke.TestMethodExtensions
Expand Down
36 changes: 26 additions & 10 deletions src/Nuke/SolutionUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using GlobExpressions;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Serilog;
Expand All @@ -7,9 +8,10 @@
internal static class SolutionUpdater
{
public static void UpdateSolution(
Solution solution,
Solution solution,
IEnumerable<string> additionalRelativeFolderFilePatterns,
IEnumerable<string> additionalConfigFolderFilePatterns
IEnumerable<string> additionalConfigFolderFilePatterns,
IEnumerable<string> additionalIgnoreFolderFilePatterns
)
{
if (EnvironmentInfo.HasVariable("RSG_NUKE_LINT_STAGED")) return;
Expand All @@ -20,7 +22,15 @@

var actions = ReplaceDotBuildFolder(solution, configFolder)
.Concat(ReplaceDotSolutionFolder(solution, configFolder))
.Concat(AddConfigurationFiles(solution, additionalRelativeFolderFilePatterns, additionalConfigFolderFilePatterns, configFolder))
.Concat(
AddConfigurationFiles(
solution,
additionalRelativeFolderFilePatterns,
additionalConfigFolderFilePatterns,
additionalIgnoreFolderFilePatterns,
configFolder
)
)

Check warning on line 33 in src/Nuke/SolutionUpdater.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/SolutionUpdater.cs#L25-L33

Added lines #L25 - L33 were not covered by tests
.Concat(AddNukeBuilds(solution, configFolder))
.Concat(NormalizePaths(solution))
;
Expand Down Expand Up @@ -51,6 +61,8 @@
"package.json",
};

private static readonly string[] _ignoreFolderFilePatterns = { "**node_modules/**", };

Check warning on line 64 in src/Nuke/SolutionUpdater.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/SolutionUpdater.cs#L64

Added line #L64 was not covered by tests

private static IEnumerable<Action> AddNukeBuilds(Solution solution, SolutionFolder configFolder)
{
if (solution.Directory != NukeBuild.RootDirectory) yield break;
Expand Down Expand Up @@ -93,12 +105,14 @@
}

private static List<Action> AddConfigurationFiles(
Solution solution,
Solution solution,
IEnumerable<string> additionalRelativeFolderFilePatterns,
IEnumerable<string> additionalConfigFolderFilePatterns,
SolutionFolder configFolder
IEnumerable<string> additionalIgnoreFolderFilePatterns,
SolutionFolder configFolder
)
{
var ignoreGlobs = _ignoreFolderFilePatterns.Concat(additionalIgnoreFolderFilePatterns).Select(z => new Glob(z)).ToList();

Check warning on line 115 in src/Nuke/SolutionUpdater.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/SolutionUpdater.cs#L115

Added line #L115 was not covered by tests
var actions = new List<Action>();
if (solution.Directory != NukeBuild.RootDirectory) return actions;
actions.AddRange(
Expand All @@ -113,6 +127,7 @@
.GlobFiles(
_relativeFolderFilePatterns.Concat(additionalRelativeFolderFilePatterns).ToArray()
)
.Where(path => ignoreGlobs.All(z => !z.IsMatch(path)))

Check warning on line 130 in src/Nuke/SolutionUpdater.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/SolutionUpdater.cs#L130

Added line #L130 was not covered by tests
.SelectMany(path => AddSolutionItemToRelativeFolder(solution, configFolder, path))
);
actions.AddRange(
Expand All @@ -121,6 +136,7 @@
.GlobFiles(
_configFolderFilePatterns.Concat(additionalConfigFolderFilePatterns).ToArray()
)
.Where(path => ignoreGlobs.All(z => !z.IsMatch(path)))

Check warning on line 139 in src/Nuke/SolutionUpdater.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/SolutionUpdater.cs#L139

Added line #L139 was not covered by tests
.SelectMany(path => AddSolutionItemToRelativeConfigFolder(solution, configFolder, path))
);

Expand All @@ -132,12 +148,12 @@
foreach (var folder in solution.AllSolutionFolders)
{
if (folder.Items.Values.All(z => ( (RelativePath)z ).ToUnixRelativePath() == z)) continue;
if (folder.Items.Keys.All(z => ( (RelativePath)z ).ToUnixRelativePath() == z)) continue;
if (folder.Items.Keys.All(z => ( (RelativePath)z ).ToUnixRelativePath() == z)) continue;
yield return () =>
{
foreach (var item in folder
.Items.Where(
z => ( (RelativePath)z.Key ).ToUnixRelativePath() != z.Key
z => ( (RelativePath)z.Key ).ToUnixRelativePath() != z.Key
|| ( (RelativePath)z.Value ).ToUnixRelativePath() != z.Value
)
.ToArray())
Expand Down Expand Up @@ -180,12 +196,12 @@
private static IEnumerable<Action> AddSolutionItemToFolder(SolutionFolder folder, UnixRelativePath path)
{
if (folder.Items.Values.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) yield break;
if (folder.Items.Keys.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) yield break;
if (folder.Items.Keys.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) yield break;
if (folder.Items.ContainsKey(path)) yield break;
yield return () =>
{
if (folder.Items.Values.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) return;
if (folder.Items.Keys.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) return;
if (folder.Items.Keys.Select(z => ( (RelativePath)z ).ToUnixRelativePath().ToString()).Any(z => z == path)) return;
if (folder.Items.ContainsKey(path)) return;
folder.Items.Add(path, path);
};
Expand Down Expand Up @@ -222,4 +238,4 @@
}
}
}
}
}
Loading
Loading