OLD | NEW |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 .. " -Ithird_party/icu/source/i18n" | 109 .. " -Ithird_party/icu/source/i18n" |
110 end | 110 end |
111 | 111 |
112 function InvokeClangPluginForEachFile(filenames, cfg, func) | 112 function InvokeClangPluginForEachFile(filenames, cfg, func) |
113 local cmd_line = MakeClangCommandLine(cfg.plugin, | 113 local cmd_line = MakeClangCommandLine(cfg.plugin, |
114 cfg.plugin_args, | 114 cfg.plugin_args, |
115 cfg.triple, | 115 cfg.triple, |
116 cfg.arch_define) | 116 cfg.arch_define) |
117 for _, filename in ipairs(filenames) do | 117 for _, filename in ipairs(filenames) do |
118 log("-- %s", filename) | 118 log("-- %s", filename) |
119 local action = cmd_line .. " src/" .. filename .. " 2>&1" | 119 local action = cmd_line .. " " .. filename .. " 2>&1" |
120 if FLAGS.verbose then print('popen ', action) end | 120 if FLAGS.verbose then print('popen ', action) end |
121 local pipe = io.popen(action) | 121 local pipe = io.popen(action) |
122 func(filename, pipe:lines()) | 122 func(filename, pipe:lines()) |
123 local success = pipe:close() | 123 local success = pipe:close() |
124 if not success then error("Failed to run: " .. action) end | 124 if not success then error("Failed to run: " .. action) end |
125 end | 125 end |
126 end | 126 end |
127 | 127 |
128 ------------------------------------------------------------------------------- | 128 ------------------------------------------------------------------------------- |
129 -- GYP file parsing | 129 -- GYP file parsing |
130 | 130 |
131 local function ParseGYPFile() | 131 local function ParseGYPFile() |
132 local f = assert(io.open("tools/gyp/v8.gyp"), "failed to open GYP file") | 132 local gyp = "" |
133 local gyp = f:read('*a') | 133 local gyp_files = { "tools/gyp/v8.gyp", "test/cctest/cctest.gyp" } |
134 f:close() | 134 for i = 1, #gyp_files do |
| 135 local f = assert(io.open(gyp_files[i]), "failed to open GYP file") |
| 136 local t = f:read('*a') |
| 137 gyp = gyp .. t |
| 138 f:close() |
| 139 end |
135 | 140 |
136 local result = {} | 141 local result = {} |
137 | 142 |
138 for condition, sources in | 143 for condition, sources in |
139 gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do | 144 gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do |
140 local files = {} | 145 if result[condition] == nil then result[condition] = {} end |
141 for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do | 146 for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do |
142 table.insert(files, file) | 147 table.insert(result[condition], "src/" .. file) |
143 end | 148 end |
144 result[condition] = files | 149 for file in sources:gmatch "'(test-[^']-%.cc)'" do |
| 150 table.insert(result[condition], "test/cctest/" .. file) |
| 151 end |
145 end | 152 end |
146 | 153 |
147 return result | 154 return result |
148 end | 155 end |
149 | 156 |
150 local function EvaluateCondition(cond, props) | 157 local function EvaluateCondition(cond, props) |
151 if cond == 'all' then return true end | 158 if cond == 'all' then return true end |
152 | 159 |
153 local p, v = cond:match "(%w+):(%w+)" | 160 local p, v = cond:match "(%w+):(%w+)" |
154 | 161 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 384 |
378 for _, arch in ipairs(ARCHS) do | 385 for _, arch in ipairs(ARCHS) do |
379 if not ARCHITECTURES[arch] then | 386 if not ARCHITECTURES[arch] then |
380 error ("Unknown arch: " .. arch) | 387 error ("Unknown arch: " .. arch) |
381 end | 388 end |
382 | 389 |
383 errors = SafeCheckCorrectnessForArch(arch, report) or errors | 390 errors = SafeCheckCorrectnessForArch(arch, report) or errors |
384 end | 391 end |
385 | 392 |
386 os.exit(errors and 1 or 0) | 393 os.exit(errors and 1 or 0) |
OLD | NEW |