From 235075d09ac814ac1afce69b38134b07e3880c53 Mon Sep 17 00:00:00 2001
From: Nils Andresen <nils@nils-andresen.de>
Date: Tue, 1 Jun 2021 12:06:25 +0200
Subject: [PATCH] fix(cake): load preprocessor directive (#10259)

Modified the parser, to additionally recognize preprocessor directives
of #load and it's short form of #l.
---
 lib/manager/cake/__fixtures__/build.cake          |  2 ++
 lib/manager/cake/__snapshots__/index.spec.ts.snap | 10 ++++++++++
 lib/manager/cake/index.ts                         |  4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/manager/cake/__fixtures__/build.cake b/lib/manager/cake/__fixtures__/build.cake
index f3d942b919..c678319560 100644
--- a/lib/manager/cake/__fixtures__/build.cake
+++ b/lib/manager/cake/__fixtures__/build.cake
@@ -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
diff --git a/lib/manager/cake/__snapshots__/index.spec.ts.snap b/lib/manager/cake/__snapshots__/index.spec.ts.snap
index 8df0548df5..aa18c9baff 100644
--- a/lib/manager/cake/__snapshots__/index.spec.ts.snap
+++ b/lib/manager/cake/__snapshots__/index.spec.ts.snap
@@ -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",
+    },
   ],
 }
 `;
diff --git a/lib/manager/cake/index.ts b/lib/manager/cake/index.ts
index f7352cb1f5..77e334e2f0 100644
--- a/lib/manager/cake/index.ts
+++ b/lib/manager/cake/index.ts
@@ -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,
-- 
GitLab