Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: tools/gcmole/gcmole.lua

Issue 2065933002: [gcmole] Fix source files pattern in GYP parsing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix found issues. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/liveedit.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gcmole/gcmole.lua
diff --git a/tools/gcmole/gcmole.lua b/tools/gcmole/gcmole.lua
index f16ad8fd5d8010ddf1a3a9082ed4ebd521f84c13..5c5e502926a5a60f88dcc8460ff62897902ff458 100644
--- a/tools/gcmole/gcmole.lua
+++ b/tools/gcmole/gcmole.lua
@@ -184,26 +184,26 @@ end
-- GYP file parsing
local function ParseGYPFile()
- local gyp = ""
- local gyp_files = { "src/v8.gyp", "test/cctest/cctest.gyp" }
- for i = 1, #gyp_files do
- local f = assert(io.open(gyp_files[i]), "failed to open GYP file")
- local t = f:read('*a')
- gyp = gyp .. t
- f:close()
- end
-
local result = {}
+ local gyp_files = {
+ { "src/v8.gyp", "'([^']-%.cc)'", "src/" },
+ { "test/cctest/cctest.gyp", "'(test-[^']-%.cc)'", "test/cctest/" }
+ }
- for condition, sources in
- gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do
- if result[condition] == nil then result[condition] = {} end
- for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do
- table.insert(result[condition], "src/" .. file)
- end
- for file in sources:gmatch "'(test-[^']-%.cc)'" do
- table.insert(result[condition], "test/cctest/" .. file)
+ for i = 1, #gyp_files do
+ local filename = gyp_files[i][1]
+ local pattern = gyp_files[i][2]
+ local prefix = gyp_files[i][3]
+ local gyp_file = assert(io.open(filename), "failed to open GYP file")
+ local gyp = gyp_file:read('*a')
+ for condition, sources in
+ gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do
+ if result[condition] == nil then result[condition] = {} end
+ for file in sources:gmatch(pattern) do
+ table.insert(result[condition], prefix .. file)
+ end
end
+ gyp_file:close()
end
return result
« no previous file with comments | « src/debug/liveedit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698