-
Notifications
You must be signed in to change notification settings - Fork 366
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
Fix #1186 Fixing signtool.exe path for new windows kits #1188
Open
gustavocalheiros
wants to merge
9
commits into
nuke-build:develop
Choose a base branch
from
gustavocalheiros:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a35fe9c
Fix https://github.com/nuke-build/nuke/issues/1186 Fixing signtool.ex…
f82a482
Fix Dropped support of "SignTool" to old Windows Kits (#1186)
56c86f1
feat(utilities): implement AbsolutePath copy/move
matkoch f97cb24
chore: update FileSystemTasks usages
matkoch ea39775
fix
matkoch 6eb7796
fix
matkoch 1279c3c
Merge branch 'nuke-build:develop' into develop
gustavocalheiros e9401fb
Added support for "Microsoft BuildTools" Nuget Package (#1186)
7fcb610
Fixed variable name (#1186)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,135 @@ | ||
// Copyright 2024 Maintainers of NUKE. | ||
// Distributed under the MIT License. | ||
// https://github.com/nuke-build/nuke/blob/master/LICENSE | ||
|
||
using System; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Utilities.Collections; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Nuke.Common.Tests; | ||
|
||
public class MoveCopyTest : FileSystemDependentTest | ||
{ | ||
public MoveCopyTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper) | ||
{ | ||
AbsolutePathExtensions.DefaultEofLineBreak = false; | ||
} | ||
|
||
[Fact] | ||
public void TestCopyFile() | ||
{ | ||
var source = TestTempDirectory / "source.txt"; | ||
source.WriteAllText("foobar"); | ||
|
||
var target = TestTempDirectory / "target.txt"; | ||
source.Copy(target); | ||
|
||
target.FileExists().Should().BeTrue(); | ||
|
||
new Action(() => source.Copy(target)) | ||
.Should().Throw<Exception>().WithMessage("* already exists"); | ||
|
||
new Action(() => source.Copy(target, policy: ExistsPolicy.FileFail | ExistsPolicy.FileOverwrite)) | ||
.Should().Throw<Exception>().WithMessage("Multiple file policies *"); | ||
|
||
source.WriteAllText("fizzbuzz"); | ||
source.Copy(target, policy: ExistsPolicy.FileOverwrite) | ||
.Should().Be(target); | ||
target.ReadAllText().Should().Be("fizzbuzz"); | ||
} | ||
|
||
[Fact] | ||
public void TestMoveFile() | ||
{ | ||
var source1 = (TestTempDirectory / "source1.txt").TouchFile(); | ||
var source2 = (TestTempDirectory / "source2.txt").TouchFile(); | ||
var source3 = (TestTempDirectory / "source3.txt").TouchFile(); | ||
|
||
var target = TestTempDirectory / "target.txt"; | ||
source2.Move(target); | ||
|
||
target.FileExists().Should().BeTrue(); | ||
source2.FileExists().Should().BeFalse(); | ||
|
||
new Action(() => source1.Move(target, policy: ExistsPolicy.FileFail)) | ||
.Should().Throw<Exception>().WithMessage("* already exists"); | ||
|
||
source1.Move(target, policy: ExistsPolicy.FileSkip).Should().Be(source1); | ||
source1.Move(target, policy: ExistsPolicy.FileOverwriteIfNewer).Should().Be(source1); | ||
|
||
source3.TouchFile(); | ||
source3.Move(target, policy: ExistsPolicy.FileOverwriteIfNewer).Should().Be(target); | ||
} | ||
|
||
[Fact] | ||
public void TestCopyDirectory() | ||
{ | ||
var source = TestTempDirectory / "source"; | ||
var sourceFiles = new[] | ||
{ | ||
source / "source1.txt", | ||
source / "source2.txt", | ||
source / "sub" / "source3.txt", | ||
source / "sub" / "source4.txt", | ||
}; | ||
sourceFiles.ForEach(x => x.WriteAllText("source")); | ||
|
||
var target = TestTempDirectory / "target"; | ||
source.Copy(target); | ||
target.GetFiles(depth: int.MaxValue).Select(x => target.GetRelativePathTo(x).ToString()) | ||
.Should().BeEquivalentTo(sourceFiles.Select(x => source.GetRelativePathTo(x).ToString())); | ||
|
||
target.CreateOrCleanDirectory(); | ||
var target0 = (target / "source0.txt").TouchFile(); | ||
var target3 = (target / "sub" / "source3.txt").WriteAllText("target"); | ||
var target4 = (target / "sub" / "source4.txt").WriteAllText("target"); | ||
(source / target.GetRelativePathTo(target4)).TouchFile(); | ||
|
||
new Action(() => source.Copy(target, ExistsPolicy.DirectoryFail)) | ||
.Should().Throw<Exception>().WithMessage("Policy disallows merging directories"); | ||
target.GetFiles(depth: int.MaxValue).Should().HaveCount(3); | ||
|
||
source.Copy(target, ExistsPolicy.MergeAndSkip); | ||
target0.FileExists().Should().BeTrue(); | ||
target3.ReadAllText().Should().Be("target"); | ||
target4.ReadAllText().Should().Be("target"); | ||
|
||
source.Copy(target, ExistsPolicy.MergeAndOverwriteIfNewer); | ||
target3.ReadAllText().Should().Be("target"); | ||
target4.ReadAllText().Should().Be("source"); | ||
|
||
source.Copy(target, ExistsPolicy.MergeAndOverwrite); | ||
target3.ReadAllText().Should().Be("source"); | ||
} | ||
|
||
[Fact] | ||
public void TestMoveDirectory() | ||
{ | ||
var source = TestTempDirectory / "source"; | ||
var sourceFiles = new[] | ||
{ | ||
source / "source1.txt", | ||
source / "source2.txt", | ||
source / "sub" / "source3.txt", | ||
source / "sub" / "source4.txt", | ||
}; | ||
sourceFiles.ForEach(x => x.WriteAllText("source")); | ||
|
||
var target = TestTempDirectory / "target"; | ||
(target / "source1.txt").TouchFile(); | ||
(target / "sub" / "source3.txt").TouchFile(); | ||
|
||
new Action(() => source.Move(target)).Should().Throw<Exception>(); | ||
|
||
source.Move(target, ExistsPolicy.MergeAndSkip); | ||
source.GetFiles(depth: int.MaxValue).Should().HaveCount(2); | ||
|
||
source.Move(target, ExistsPolicy.MergeAndSkip, deleteRemainingFiles: true) | ||
.Should().Be(target); | ||
source.DirectoryExists().Should().BeFalse(); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path structure for nuget packages is different, for example :
C:\Users\MyUser\ .nuget\packages\microsoft.windows.sdk.buildtools\10.0.20348\bin\10.0.20348\x64\signtool.exe