move Environment.parse_makefile_deps to Util
This commit is contained in:
1 parent
db788cdd35
commit
1b63dc7503
7 files changed
+49
-47
No files matched your search
@@ -111,7 +111,7 @@ module Rscons
|
||||
if options[:command_status]
|
||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
if File.exists?(vars['_DEPFILE'])
|
||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||
deps += Util.parse_makefile_deps(vars['_DEPFILE'])
|
||||
end
|
||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||
target
|
||||
|
||||
@@ -49,7 +49,7 @@ module Rscons
|
||||
if options[:command_status]
|
||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
if File.exists?(vars['_DEPFILE'])
|
||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||
deps += Util.parse_makefile_deps(vars['_DEPFILE'])
|
||||
end
|
||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||
target
|
||||
|
||||
@@ -96,7 +96,7 @@ module Rscons
|
||||
if options[:command_status]
|
||||
target, deps, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
if File.exists?(vars['_DEPFILE'])
|
||||
deps += Environment.parse_makefile_deps(vars['_DEPFILE'])
|
||||
deps += Util.parse_makefile_deps(vars['_DEPFILE'])
|
||||
end
|
||||
cache.register_build(target, options[:tc].command, deps.uniq, env)
|
||||
target
|
||||
|
||||
@@ -806,31 +806,6 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Parse dependencies from a Makefile.
|
||||
#
|
||||
# This method is used internally by Rscons builders.
|
||||
#
|
||||
# @param mf_fname [String] File name of the Makefile to read.
|
||||
#
|
||||
# @return [Array<String>] Paths of dependency files.
|
||||
def self.parse_makefile_deps(mf_fname)
|
||||
deps = []
|
||||
buildup = ''
|
||||
File.read(mf_fname).each_line do |line|
|
||||
if line =~ /^(.*)\\\s*$/
|
||||
buildup += ' ' + $1
|
||||
else
|
||||
buildup += ' ' + line
|
||||
if buildup =~ /^.*: (.*)$/
|
||||
mf_deps = $1
|
||||
deps += mf_deps.split(' ').map(&:strip)
|
||||
end
|
||||
buildup = ''
|
||||
end
|
||||
end
|
||||
deps
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Environment.class_init
|
||||
|
||||
@@ -64,6 +64,33 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Parse dependencies from a Makefile.
|
||||
#
|
||||
# This method is used internally by Rscons builders.
|
||||
#
|
||||
# @param mf_fname [String]
|
||||
# File name of the Makefile to read.
|
||||
#
|
||||
# @return [Array<String>]
|
||||
# Paths of dependency files.
|
||||
def parse_makefile_deps(mf_fname)
|
||||
deps = []
|
||||
buildup = ''
|
||||
File.read(mf_fname).each_line do |line|
|
||||
if line =~ /^(.*)\\\s*$/
|
||||
buildup += ' ' + $1
|
||||
else
|
||||
buildup += ' ' + line
|
||||
if buildup =~ /^.*: (.*)$/
|
||||
mf_deps = $1
|
||||
deps += mf_deps.split(' ').map(&:strip)
|
||||
end
|
||||
buildup = ''
|
||||
end
|
||||
end
|
||||
deps
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Check if a directory contains a certain executable.
|
||||
|
||||
Reference in new issue
Block a user