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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/debug/liveedit.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 -- Copyright 2011 the V8 project authors. All rights reserved. 1 -- Copyright 2011 the V8 project authors. All rights reserved.
2 -- Redistribution and use in source and binary forms, with or without 2 -- Redistribution and use in source and binary forms, with or without
3 -- modification, are permitted provided that the following conditions are 3 -- modification, are permitted provided that the following conditions are
4 -- met: 4 -- met:
5 -- 5 --
6 -- * Redistributions of source code must retain the above copyright 6 -- * Redistributions of source code must retain the above copyright
7 -- notice, this list of conditions and the following disclaimer. 7 -- notice, this list of conditions and the following disclaimer.
8 -- * Redistributions in binary form must reproduce the above 8 -- * Redistributions in binary form must reproduce the above
9 -- copyright notice, this list of conditions and the following 9 -- copyright notice, this list of conditions and the following
10 -- disclaimer in the documentation and/or other materials provided 10 -- disclaimer in the documentation and/or other materials provided
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 local success = SplitResults(pipe:lines(), func) 177 local success = SplitResults(pipe:lines(), func)
178 local closed = pipe:close() 178 local closed = pipe:close()
179 if not (success and closed) then error("Failed to run: " .. action) end 179 if not (success and closed) then error("Failed to run: " .. action) end
180 end 180 end
181 end 181 end
182 182
183 ------------------------------------------------------------------------------- 183 -------------------------------------------------------------------------------
184 -- GYP file parsing 184 -- GYP file parsing
185 185
186 local function ParseGYPFile() 186 local function ParseGYPFile()
187 local gyp = "" 187 local result = {}
188 local gyp_files = { "src/v8.gyp", "test/cctest/cctest.gyp" } 188 local gyp_files = {
189 { "src/v8.gyp", "'([^']-%.cc)'", "src/" },
190 { "test/cctest/cctest.gyp", "'(test-[^']-%.cc)'", "test/cctest/" }
191 }
192
189 for i = 1, #gyp_files do 193 for i = 1, #gyp_files do
190 local f = assert(io.open(gyp_files[i]), "failed to open GYP file") 194 local filename = gyp_files[i][1]
191 local t = f:read('*a') 195 local pattern = gyp_files[i][2]
192 gyp = gyp .. t 196 local prefix = gyp_files[i][3]
193 f:close() 197 local gyp_file = assert(io.open(filename), "failed to open GYP file")
194 end 198 local gyp = gyp_file:read('*a')
195 199 for condition, sources in
196 local result = {} 200 gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do
197 201 if result[condition] == nil then result[condition] = {} end
198 for condition, sources in 202 for file in sources:gmatch(pattern) do
199 gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do 203 table.insert(result[condition], prefix .. file)
200 if result[condition] == nil then result[condition] = {} end 204 end
201 for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do
202 table.insert(result[condition], "src/" .. file)
203 end 205 end
204 for file in sources:gmatch "'(test-[^']-%.cc)'" do 206 gyp_file:close()
205 table.insert(result[condition], "test/cctest/" .. file)
206 end
207 end 207 end
208 208
209 return result 209 return result
210 end 210 end
211 211
212 local function EvaluateCondition(cond, props) 212 local function EvaluateCondition(cond, props)
213 if cond == 'all' then return true end 213 if cond == 'all' then return true end
214 214
215 local p, v = cond:match "(%w+):(%w+)" 215 local p, v = cond:match "(%w+):(%w+)"
216 216
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 for _, arch in ipairs(ARCHS) do 444 for _, arch in ipairs(ARCHS) do
445 if not ARCHITECTURES[arch] then 445 if not ARCHITECTURES[arch] then
446 error ("Unknown arch: " .. arch) 446 error ("Unknown arch: " .. arch)
447 end 447 end
448 448
449 errors = SafeCheckCorrectnessForArch(arch, report) or errors 449 errors = SafeCheckCorrectnessForArch(arch, report) or errors
450 end 450 end
451 451
452 os.exit(errors and 1 or 0) 452 os.exit(errors and 1 or 0)
OLDNEW
« 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