Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.2'
Browse files Browse the repository at this point in the history
* hotfix/0.9.2:
  (GH-166) Don't add non cil script references
  • Loading branch information
devlead committed Dec 12, 2021
2 parents 3900618 + 5efe976 commit 0c63beb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Cake.Scripting/CodeGen/CakeScriptGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,21 @@ public CakeScript Generate(FileChange fileChange)

// Load all references.
_log.Verbose("Adding references...");
var references = new HashSet<FilePath>(
var references = new HashSet<IFile>(
_scriptConventions
.GetDefaultAssemblies(_environment.ApplicationRoot)
.Union(_referenceAssemblyResolver.GetReferenceAssemblies())
.Select(a => FilePath.FromString(a.Location)));
.Select(a => _fileSystem.GetFile(a.Location))
.Where(file => !file.Exists || file.IsClrAssembly()));

references.AddRange(result.References.Select(r => new FilePath(r)));
references.AddRange(result.References.Select(r => _fileSystem.GetFile(r)));

// Find aliases
_log.Verbose("Finding aliases...");
var aliases = new List<CakeScriptAlias>();
foreach (var reference in references.Select(_fileSystem.GetFile))
foreach (var reference in references)
{
if (reference.Exists && reference.IsClrAssembly())
if (reference.Exists)
{
aliases.AddRange(_aliasFinder.FindAliases(reference.Path));
}
Expand All @@ -152,7 +153,7 @@ public CakeScript Generate(FileChange fileChange)
GenerateSource(aliases) +
string.Join("\n", result.Lines);
response.Usings.AddRange(namespaces);
response.References.AddRange(references.Select(r => r.FullPath));
response.References.AddRange(references.Select(r => r.Path.FullPath));

// Return the response.
return response;
Expand Down

0 comments on commit 0c63beb

Please sign in to comment.