Skip to content

Commit

Permalink
Fix weird error message when absolute reference cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
yevhen committed Oct 11, 2013
1 parent c5c346d commit 84aa63d
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions Nake.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Fowler.csx = Fowler.csx
Nake.csx = Nake.csx
Build\NuGet\Nake.nuspec = Build\NuGet\Nake.nuspec
Source\ProductAssemblyInfo.cs = Source\ProductAssemblyInfo.cs
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meta", "Source\Meta\Meta.csproj", "{B12EB89E-0C86-4D2E-866D-BBF1E6890806}"
Expand Down
4 changes: 3 additions & 1 deletion Packages/repositories.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\Build\packages.config" />
<repository path="..\Source\Nake.Tests\packages.config" />
<repository path="..\Source\Nake\packages.config" />
<repository path="..\Build\packages.config" />
<repository path="..\Source\Utility.Tests\packages.config" />
<repository path="..\Source\Utility\packages.config" />
</repositories>
18 changes: 12 additions & 6 deletions Source/Nake/Magic/Preprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -174,17 +175,22 @@ void AppendBody(StringBuilder code)

internal struct AbsoluteReference : IEquatable<AbsoluteReference>
{
readonly string path;
public readonly string AssemblyPath;
public string ScriptFile;

public AbsoluteReference(string scriptFile, string assemblyReference)
{
this.ScriptFile = scriptFile;

var currentScriptDirectory = Path.GetDirectoryName(scriptFile);
path = Path.GetFullPath(Path.Combine(currentScriptDirectory, assemblyReference));
Debug.Assert(currentScriptDirectory != null);

AssemblyPath = Path.GetFullPath(Path.Combine(currentScriptDirectory, assemblyReference));
}

public bool Equals(AbsoluteReference other)
{
return String.Equals(path, (string) other.path);
return String.Equals(AssemblyPath, (string) other.AssemblyPath);
}

public override bool Equals(object obj)
Expand All @@ -197,12 +203,12 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
return path.GetHashCode();
return AssemblyPath.GetHashCode();
}

public override string ToString()
{
return path;
return AssemblyPath;
}

public static bool operator ==(AbsoluteReference left, AbsoluteReference right)
Expand All @@ -217,7 +223,7 @@ public override string ToString()

public static implicit operator string(AbsoluteReference obj)
{
return obj.path;
return obj.AssemblyPath;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Nake/Magic/Script.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ string Preprocess(FileInfo file)
foreach (var absoluteReference in result.AbsoluteReferences)
{
if (!File.Exists(absoluteReference))
throw new NakeException("Reference {0} defined in script {1} cannot be found");
throw new NakeException("Reference {0} defined in script {1} cannot be found",
absoluteReference.AssemblyPath, absoluteReference.ScriptFile);

if (NakeReferences.Contains(absoluteReference))
continue;
Expand Down
2 changes: 1 addition & 1 deletion Source/ProductAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;

[assembly: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyVersion("1.0.0.4")]
[assembly: AssemblyCopyright("Copyright © Yevhen Bobrov 2013")]
Binary file modified Tools/Nake/Meta.dll
Binary file not shown.
Binary file modified Tools/Nake/Meta.pdb
Binary file not shown.
Binary file modified Tools/Nake/Nake.exe
Binary file not shown.
Binary file modified Tools/Nake/Nake.pdb
Binary file not shown.
Binary file modified Tools/Nake/Utility.dll
Binary file not shown.
Binary file modified Tools/Nake/Utility.pdb
Binary file not shown.

0 comments on commit 84aa63d

Please sign in to comment.