Skip to content

Commit

Permalink
fix(cake): load preprocessor directive (#10259)
Browse files Browse the repository at this point in the history
Modified the parser, to additionally recognize preprocessor directives
of #load and it's short form of #l.
  • Loading branch information
nils-a committed Jun 1, 2021
1 parent efe2400 commit 235075d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/manager/cake/__fixtures__/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ foo
#addin "nuget:?package=Bim.Bim&version=6.6.6"
#tool nuget:https://example.com?package=Bar.Bar&version=2.2.2
#module nuget:file:///tmp/?package=Baz.Baz&version=3.3.3
#load nuget:?package=Cake.7zip&version=1.0.3
#l nuget:?package=Cake.asciidoctorj&version=1.0.0
// #module nuget:?package=Qux.Qux&version=4.4.4
/*
#module nuget:?package=Quux.Quux&version=5.5.5
Expand Down
10 changes: 10 additions & 0 deletions lib/manager/cake/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ Object {
"depName": "Baz.Baz",
"skipReason": "unsupported-url",
},
Object {
"currentValue": "1.0.3",
"datasource": "nuget",
"depName": "Cake.7zip",
},
Object {
"currentValue": "1.0.0",
"datasource": "nuget",
"depName": "Cake.asciidoctorj",
},
],
}
`;
4 changes: 2 additions & 2 deletions lib/manager/cake/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const lexer = moo.states({
lineComment: { match: /\/\/.*?$/ },
multiLineComment: { match: /\/\*[^]*?\*\//, lineBreaks: true },
dependency: {
match: /^#(?:addin|tool|module)\s+(?:nuget|dotnet):.*$/,
match: /^#(?:addin|tool|module|load|l)\s+(?:nuget|dotnet):.*$/,
},
dependencyQuoted: {
match: /^#(?:addin|tool|module)\s+"(?:nuget|dotnet):[^"]+"\s*$/,
match: /^#(?:addin|tool|module|load|l)\s+"(?:nuget|dotnet):[^"]+"\s*$/,
value: (s: string) => s.trim().slice(1, -1),
},
unknown: moo.fallback,
Expand Down

0 comments on commit 235075d

Please sign in to comment.