mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
update-deps: for clang
* tool/update-deps (read_single_cc_deps): clang may not include the current working directory name in .i files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
78b9d778de
commit
fc480888a8
1 changed files with 15 additions and 7 deletions
|
@ -327,21 +327,23 @@ end
|
||||||
|
|
||||||
def read_single_cc_deps(path_i, cwd)
|
def read_single_cc_deps(path_i, cwd)
|
||||||
files = {}
|
files = {}
|
||||||
path_i.each_line.with_index {|line, lineindex|
|
compiler_wd = nil
|
||||||
|
path_i.each_line {|line|
|
||||||
next if /\A\# \d+ "(.*)"/ !~ line
|
next if /\A\# \d+ "(.*)"/ !~ line
|
||||||
files[$1] = lineindex
|
dep = $1
|
||||||
|
next if %r{\A<.*>\z} =~ dep # omit <command-line>, etc.
|
||||||
|
compiler_wd ||= dep
|
||||||
|
files[dep] = true
|
||||||
}
|
}
|
||||||
# gcc emits {# 1 "/absolute/directory/of/the/source/file//"} at 2nd line.
|
# gcc emits {# 1 "/absolute/directory/of/the/source/file//"} at 2nd line.
|
||||||
compiler_wd = files.keys.find {|f| %r{\A/.*//\z} =~ f }
|
if %r{\A/.*//\z} =~ compiler_wd
|
||||||
if compiler_wd
|
|
||||||
files.delete compiler_wd
|
files.delete compiler_wd
|
||||||
compiler_wd = Pathname(compiler_wd.sub(%r{//\z}, ''))
|
compiler_wd = Pathname(compiler_wd.sub(%r{//\z}, ''))
|
||||||
else
|
elsif !(compiler_wd = yield)
|
||||||
raise "compiler working directory not found: #{path_i}"
|
raise "compiler working directory not found: #{path_i}"
|
||||||
end
|
end
|
||||||
deps = []
|
deps = []
|
||||||
files.each_key {|dep|
|
files.each_key {|dep|
|
||||||
next if %r{\A<.*>\z} =~ dep # omit <command-line>, etc.
|
|
||||||
dep = Pathname(dep)
|
dep = Pathname(dep)
|
||||||
if dep.relative?
|
if dep.relative?
|
||||||
dep = compiler_wd + dep
|
dep = compiler_wd + dep
|
||||||
|
@ -367,7 +369,13 @@ def read_cc_deps(cwd)
|
||||||
end
|
end
|
||||||
path_o = cwd + fn_o
|
path_o = cwd + fn_o
|
||||||
path_i = cwd + fn_i
|
path_i = cwd + fn_i
|
||||||
deps[path_o] = read_single_cc_deps(path_i, cwd)
|
deps[path_o] = read_single_cc_deps(path_i, cwd) do
|
||||||
|
if fn_o.to_s.start_with?("enc/")
|
||||||
|
cwd
|
||||||
|
else
|
||||||
|
path_i.parent
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
deps
|
deps
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue