From 9aad95273b79211d8a6ac47aecc2c1fa3548c7fa Mon Sep 17 00:00:00 2001 From: fcying Date: Fri, 30 Aug 2024 18:29:23 +0800 Subject: [PATCH] fix: make_enter_dir support ` " --- cmd/compiledb/main.go | 2 +- internal/parser.go | 2 +- tests/build.log | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/compiledb/main.go b/cmd/compiledb/main.go index cf0f72a..ef5dc44 100644 --- a/cmd/compiledb/main.go +++ b/cmd/compiledb/main.go @@ -9,7 +9,7 @@ import ( "github.com/urfave/cli/v2" ) -var Version string = "v1.3.1" +var Version string = "v1.3.2" func init() { log.SetOutput(os.Stdout) diff --git a/internal/parser.go b/internal/parser.go index c44b287..d1ae5ae 100644 --- a/internal/parser.go +++ b/internal/parser.go @@ -25,7 +25,7 @@ var compile_regex *regexp.Regexp var file_regex *regexp.Regexp // Leverage `make --print-directory` option -var make_enter_dir = regexp.MustCompile(`^\s?make.*?: Entering directory .*'(.*)'$`) +var make_enter_dir = regexp.MustCompile(`^\s?make.*?: Entering directory .*['"` + "`" + `](.*)['"` + "`" + `]$`) var make_leave_dir = regexp.MustCompile(`^\s?make.*?: Leaving directory .*'(.*)'$`) // We want to skip such lines from configure to avoid spurious MAKE expansion errors. diff --git a/tests/build.log b/tests/build.log index 6220c34..32181be 100644 --- a/tests/build.log +++ b/tests/build.log @@ -1,4 +1,4 @@ -make: Entering directory 'out/test' +make: Entering directory 'out/test" clang -fno-common -MM -MT objs/main1.c.o main1.c -o objs/main1.c.d @@ -17,3 +17,5 @@ gcc -c /opt/fullpath.c -o objs/fullpath.c.o make: Leaving directory 'out/test' + +make[1]: Entering directory `/home/test/src/algorithm"