Skip to content

Commit 578df97

Browse files
committed
Merge branch 'release/0.7.0'
2 parents c7cfb4c + 66a7deb commit 578df97

9 files changed

Lines changed: 115 additions & 42 deletions

File tree

.appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ branches:
2525
#---------------------------------#
2626
cache:
2727
- src\packages -> src\**\packages.config
28-
- tools -> setup.cake
28+
- tools -> setup.cake
29+
- tools -> tools\packages.config

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ __pycache__/
274274
*.pyc
275275

276276
# Cake - Uncomment if you are using it
277-
tools/**
277+
tools/
278278
!tools/packages.config
279279
BuildArtifacts/
280280
moduletest/

moduletest/test.cake

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ Setup(
1919
context=>{
2020
file = Context.FileSystem.GetFile("test.cake");
2121
directory = Context.FileSystem.GetDirectory("tools");
22+
var fileSystemType = Context.FileSystem.GetType();
23+
2224
Information(
23-
"IFileSystem: {0}\r\n\tIFile: {1}\r\n\tIDirectory: {2}",
24-
Context.FileSystem.GetType(),
25+
"IFileSystem: {0}\r\n\tIFile: {1}\r\n\tIDirectory: {2}\r\n\tAssembly: {3}",
26+
fileSystemType,
2527
file.GetType(),
26-
directory.GetType()
28+
directory.GetType(),
29+
fileSystemType.Assembly
2730
);
2831

2932
testPath = Directory("testpath");
@@ -36,7 +39,11 @@ Setup(
3639
});
3740

3841
Teardown(context=>{
39-
DeleteDirectory(testPath, recursive:true);
42+
DeleteDirectory(testPath,
43+
new DeleteDirectorySettings {
44+
Recursive = true,
45+
Force = true
46+
});
4047
});
4148

4249
Task("Create-Directory-Structure")
@@ -113,10 +120,10 @@ Task("Move-Folder")
113120
.Does(() => {
114121
var source = Context.FileSystem.GetDirectory(moveSourcePath);
115122
var target = moveDestPath.Combine("target");
116-
123+
117124
Information("Moving {0} to {1}", source, target);
118125
source.Move(target);
119-
126+
120127
if(!FileExists(target.CombineWithFilePath("marker.txt")))
121128
{
122129
throw new Exception("Folder not moved correctly");

moduletest/test.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
IF NOT EXIST "tools" (md "tools")
33
IF NOT EXIST "tools\modules" (md "tools\modules")
44
IF NOT EXIST "tools\nuget.exe" (@powershell -NoProfile -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','tools/nuget.exe')")
5-
IF NOT EXIST "tools\Cake" (tools\nuget.exe install Cake -ExcludeVersion -OutputDirectory "Tools" -Source https://www.nuget.org/api/v2/)
6-
IF NOT EXIST "tools\modules\Cake.LongPath.Module" (tools\nuget.exe install Cake.LongPath.Module -PreRelease -ExcludeVersion -OutputDirectory "Tools\Modules" -Source https://www.nuget.org/api/v2/)
5+
IF NOT EXIST "tools\Cake" (tools\nuget.exe install Cake -ExcludeVersion -OutputDirectory "Tools" -Source https://api.nuget.org/v3/index.json)
6+
IF NOT EXIST "tools\modules\Cake.LongPath.Module" (tools\nuget.exe install Cake.LongPath.Module -OutputDirectory "Tools\Modules" -Source https://api.nuget.org/v3/index.json)
77
tools\Cake\Cake.exe test.cake

moduleusageexample/build.cake

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
1-
var fileSystemType = Context.FileSystem.GetType();
2-
var file = Context.FileSystem.GetFile("test.cake");
3-
var directory = Context.FileSystem.GetFile("tools");
4-
5-
if (fileSystemType.ToString()=="Cake.LongPath.Module.LongPathFileSystem")
6-
{
7-
Information("Sucessfully loaded {0}", fileSystemType.Assembly.Location);
8-
}
9-
else
10-
{
11-
Error("Failed to load Cake.LongPath.Module");
12-
}
13-
14-
Information(
15-
"IFileSystem: {0}\r\n\tIFile: {1}\r\n\tIDirectory: {2}",
16-
Context.FileSystem.GetType(),
17-
file.GetType(),
18-
directory.GetType()
19-
);
1+
#module nuget:?package=Cake.LongPath.Module
2+
3+
Task("IFileSystem")
4+
.Does(() => {
5+
var fileSystemType = Context.FileSystem.GetType();
6+
7+
Information(
8+
"IFileSystem: {0}",
9+
Context.FileSystem.GetType());
10+
11+
if (fileSystemType.ToString()=="Cake.LongPath.Module.LongPathFileSystem")
12+
{
13+
Information("Sucessfully loaded {0}", fileSystemType.Assembly.Location);
14+
}
15+
else
16+
{
17+
throw new Exception("Failed to load Cake.LongPath.Module");
18+
}
19+
});
20+
21+
Task("IFile")
22+
.IsDependentOn("IFileSystem")
23+
.Does(() => {
24+
var file = Context.FileSystem.GetFile("build.cake");
25+
26+
Information(
27+
"IFile: {0}\r\n\t{1}",
28+
file.GetType(),
29+
file.Path);
30+
});
31+
32+
Task("IDirectory")
33+
.IsDependentOn("IFileSystem")
34+
.Does(() => {
35+
var directory = Context.FileSystem.GetFile("tools");
36+
37+
Information(
38+
"IDirectory: {0}\r\n\t{1}",
39+
directory.GetType(),
40+
directory.Path);
41+
});
42+
43+
Task("Default")
44+
.IsDependentOn("IFileSystem")
45+
.IsDependentOn("IFile")
46+
.IsDependentOn("IDirectory");
47+
48+
49+
RunTarget("Default");

moduleusageexample/build.cmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@ECHO OFF
22
IF NOT EXIST "tools" (md "tools")
3-
IF NOT EXIST "tools\modules" (md "tools\modules")
43
IF NOT EXIST "tools\nuget.exe" (@powershell -NoProfile -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','tools/nuget.exe')")
54
IF NOT EXIST "tools\Cake" (tools\nuget.exe install Cake -ExcludeVersion -OutputDirectory "Tools" -Source https://www.nuget.org/api/v2/)
6-
IF NOT EXIST "tools\modules\Cake.LongPath.Module" (tools\nuget.exe install Cake.LongPath.Module -PreRelease -ExcludeVersion -OutputDirectory "Tools\Modules" -Source https://www.nuget.org/api/v2/)
7-
tools\Cake\Cake.exe build.cake
5+
(tools\Cake\Cake.exe build.cake --bootstrap) && (tools\Cake\Cake.exe build.cake)

setup.cake

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,32 @@ ToolSettings.SetToolSettings(context: Context,
1919
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
2020
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
2121

22-
Build.Run();
22+
Task("Integration-Tests")
23+
.IsDependentOn("Build")
24+
.IsDependeeOf("Test")
25+
.Does(()=> {
26+
27+
var moduleTestPath = MakeAbsolute(Directory("moduletest"));
28+
var moduleToolsPath = moduleTestPath.Combine("tools");
29+
var moduleModulesPath = moduleToolsPath.Combine("modules").Combine("Cake.LongPath.Module");
30+
var testCakePath = moduleTestPath.CombineWithFilePath("test.cake");
31+
var longPathModulePath = BuildParameters.Paths.Directories.PublishedLibraries.Combine("Cake.LongPath.Module");
32+
33+
if (DirectoryExists(moduleToolsPath))
34+
{
35+
DeleteDirectory(moduleToolsPath,
36+
new DeleteDirectorySettings {
37+
Recursive = true,
38+
Force = true
39+
});
40+
}
41+
42+
EnsureDirectoryExists(moduleToolsPath);
43+
EnsureDirectoryExists(moduleModulesPath);
44+
45+
CopyDirectory(longPathModulePath, moduleModulesPath);
46+
47+
CakeExecuteScript(testCakePath);
48+
});
49+
50+
Build.Run();

src/Cake.LongPath.Module/Cake.LongPath.Module.csproj

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,8 @@
6464
</ItemGroup>
6565
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6666
<PropertyGroup>
67-
<PostBuildEvent>IF NOT EXIST "..\..\..\..\moduletest\tools" (md "..\..\..\..\moduletest\tools")
68-
IF NOT EXIST "..\..\..\..\moduletest\tools\modules" (md "..\..\..\..\moduletest\tools\modules")
69-
IF NOT EXIST "..\..\..\..\moduletest\tools\nuget.exe" (@powershell -NoProfile -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe','..\..\..\..\moduletest\tools/nuget.exe')")
70-
IF NOT EXIST "..\..\..\..\moduletest\tools\modules\$(TargetName)" (md "..\..\..\..\moduletest\tools\modules\$(TargetName)")
71-
XCOPY /Y "Pri.LongPath.*" "..\..\..\..\moduletest\tools\modules\$(TargetName)"
72-
XCOPY /Y "$(TargetName).*" "..\..\..\..\moduletest\tools\modules\$(TargetName)"
73-
74-
IF NOT EXIST "Cake" (..\..\..\..\moduletest\tools\nuget.exe install Cake -ExcludeVersion -Source https://www.nuget.org/api/v2/)</PostBuildEvent>
67+
<PostBuildEvent>
68+
</PostBuildEvent>
7569
</PropertyGroup>
7670
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7771
Other similar extension points exist, see Microsoft.Common.targets.

src/Cake.LongPath.Module/LongPathDirectory.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,22 @@ internal class LongPathDirectory : IDirectory
2626
/// <value>The path.</value>
2727
Path IFileSystemInfo.Path => Path;
2828

29-
public bool Exists => Directory.Exists;
29+
public bool Exists
30+
{
31+
get
32+
{
33+
// Workaround until https://github.com/peteraritchie/LongPath/issues/82 is fixed
34+
try
35+
{
36+
return Directory.Exists;
37+
}
38+
catch
39+
{
40+
return false;
41+
}
42+
}
43+
}
44+
3045
public bool Hidden => (Directory.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
3146

3247
/// <summary>

0 commit comments

Comments
 (0)