cxxproject 0.5.76 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile.rb +116 -116
- data/bin/cxx +10 -10
- data/lib/cxxproject/buildingblocks/binary_library.rb +39 -39
- data/lib/cxxproject/buildingblocks/building_block.rb +251 -234
- data/lib/cxxproject/buildingblocks/command_line.rb +79 -86
- data/lib/cxxproject/buildingblocks/custom_building_block.rb +39 -39
- data/lib/cxxproject/buildingblocks/executable.rb +246 -258
- data/lib/cxxproject/buildingblocks/has_dependencies_mixin.rb +83 -83
- data/lib/cxxproject/buildingblocks/has_includes_mixin.rb +20 -20
- data/lib/cxxproject/buildingblocks/has_libraries_mixin.rb +34 -34
- data/lib/cxxproject/buildingblocks/has_sources_mixin.rb +371 -379
- data/lib/cxxproject/buildingblocks/makefile.rb +153 -153
- data/lib/cxxproject/buildingblocks/module.rb +35 -35
- data/lib/cxxproject/buildingblocks/single_source.rb +33 -33
- data/lib/cxxproject/buildingblocks/source_library.rb +124 -111
- data/lib/cxxproject/errorparser/diab_compiler_error_parser.rb +40 -40
- data/lib/cxxproject/errorparser/diab_linker_error_parser.rb +41 -41
- data/lib/cxxproject/errorparser/error_parser.rb +50 -71
- data/lib/cxxproject/errorparser/gcc_compiler_error_parser.rb +35 -35
- data/lib/cxxproject/errorparser/gcc_linker_error_parser.rb +35 -35
- data/lib/cxxproject/errorparser/ti_compiler_error_parser.rb +30 -30
- data/lib/cxxproject/errorparser/ti_linker_error_parser.rb +30 -30
- data/lib/cxxproject/eval_context.rb +144 -144
- data/lib/cxxproject/ext/file.rb +71 -81
- data/lib/cxxproject/ext/filelist.rb +6 -6
- data/lib/cxxproject/ext/progressbar.rb +20 -0
- data/lib/cxxproject/ext/rake.rb +419 -434
- data/lib/cxxproject/ext/rake_dirty.rb +30 -30
- data/lib/cxxproject/ext/rake_listener.rb +59 -59
- data/lib/cxxproject/ext/stdout.rb +44 -44
- data/lib/cxxproject/ext/string.rb +9 -9
- data/lib/cxxproject/ide_interface.rb +187 -189
- data/lib/cxxproject/toolchain/clang.rb +39 -43
- data/lib/cxxproject/toolchain/colorizing_formatter.rb +99 -99
- data/lib/cxxproject/toolchain/diab.rb +1 -1
- data/lib/cxxproject/toolchain/gcc.rb +1 -1
- data/lib/cxxproject/toolchain/provider.rb +131 -143
- data/lib/cxxproject/toolchain/toolchain.rb +38 -38
- data/lib/cxxproject/toolchain/toolchain_benchmark.rb +23 -23
- data/lib/cxxproject/torake.rb +259 -218
- data/lib/cxxproject/utils/cleanup.rb +20 -24
- data/lib/cxxproject/utils/console.rb +6 -6
- data/lib/cxxproject/utils/exit_helper.rb +40 -40
- data/lib/cxxproject/utils/graphstream.rb +154 -154
- data/lib/cxxproject/utils/optional.rb +16 -16
- data/lib/cxxproject/utils/printer.rb +50 -50
- data/lib/cxxproject/utils/process.rb +52 -58
- data/lib/cxxproject/utils/progress.rb +66 -0
- data/lib/cxxproject/utils/progress_helper.rb +77 -0
- data/lib/cxxproject/utils/rbcurse.rb +284 -0
- data/lib/cxxproject/utils/rbcurse_executable_ext.rb +14 -0
- data/lib/cxxproject/utils/rbcurse_progress.rb +71 -0
- data/lib/cxxproject/utils/rbcurse_tasktable.rb +51 -0
- data/lib/cxxproject/utils/stats.rb +60 -60
- data/lib/cxxproject/utils/ubigraph.rb +228 -228
- data/lib/cxxproject/utils/utils.rb +37 -69
- data/lib/cxxproject/version.rb +7 -7
- data/lib/cxxproject.rb +23 -19
- data/lib/tools/Rakefile.rb.template +10 -10
- data/lib/tools/project.rb.template +6 -6
- data/lib/tools/project_wizard.rb +66 -66
- data/spec/building_block_spec.rb +56 -56
- data/spec/cxxproject_2_rake_spec.rb +186 -186
- data/spec/file_ext_spec.rb +30 -30
- data/spec/ide_interface_spec.rb +41 -41
- data/spec/object_dependency_spec.rb +83 -83
- data/spec/project_path_spec.rb +71 -71
- data/spec/rake_listener_ext_spec.rb +58 -58
- data/spec/spec_helper.rb +18 -18
- data/spec/string_spec.rb +11 -11
- data/spec/testdata/basic/exe12/project.rb +5 -5
- data/spec/testdata/basic/lib1/project.rb +5 -5
- data/spec/testdata/basic/lib2/project.rb +8 -8
- data/spec/testdata/multiple_levels/libs/lib1/project.rb +5 -5
- data/spec/testdata/multiple_levels/libs/lib2/project.rb +19 -19
- data/spec/testdata/multiple_levels/mainproject/basic/project.rb +8 -8
- data/spec/testdata/onlyOneHeader/Rakefile.rb +4 -4
- data/spec/testdata/onlyOneHeader/project.rb +4 -4
- data/spec/toolchain_spec.rb +29 -29
- metadata +116 -107
- checksums.yaml +0 -7
- data/lib/cxxproject/buildingblocks/lint.rb +0 -89
- data/lib/cxxproject/errorparser/gcc_lint_error_parser.rb +0 -34
- data/lib/cxxproject/errorparser/greenhills_compiler_error_parser.rb +0 -32
- data/lib/cxxproject/errorparser/greenhills_linker_error_parser.rb +0 -44
- data/lib/cxxproject/errorparser/keil_compiler_error_parser.rb +0 -40
- data/lib/cxxproject/errorparser/keil_linker_error_parser.rb +0 -30
- data/lib/cxxproject/toolchain/gcc_lint.rb +0 -21
- data/lib/cxxproject/toolchain/gcc_param.rb +0 -7
- data/lib/cxxproject/toolchain/greenhills.rb +0 -51
- data/lib/cxxproject/toolchain/keil.rb +0 -52
- data/lib/cxxproject/utils/valgrind.rb +0 -11
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'cxxproject/errorparser/error_parser'
|
2
|
-
|
3
|
-
module Cxxproject
|
4
|
-
class TICompilerErrorParser < ErrorParser
|
5
|
-
|
6
|
-
def initialize()
|
7
|
-
@error_expression = /\"([^,^\"]+)\", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z]+): (.+)/
|
8
|
-
end
|
9
|
-
|
10
|
-
def scan_lines(consoleOutput, proj_dir)
|
11
|
-
res = []
|
12
|
-
consoleOutputFullnames = ""
|
13
|
-
consoleOutput.each_line do |l|
|
14
|
-
d = ErrorDesc.new
|
15
|
-
scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
|
16
|
-
if scan_res.length > 0
|
17
|
-
d.file_name = File.expand_path(scan_res[0][0])
|
18
|
-
d.line_number = scan_res[0][1].to_i
|
19
|
-
d.message = scan_res[0][4]
|
20
|
-
d.severity = get_severity(scan_res[0][3])
|
21
|
-
l.gsub!(scan_res[0][0],d.file_name)
|
22
|
-
end
|
23
|
-
res << d
|
24
|
-
consoleOutputFullnames << l
|
25
|
-
end
|
26
|
-
[res, consoleOutputFullnames]
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'cxxproject/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Cxxproject
|
4
|
+
class TICompilerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@error_expression = /\"([^,^\"]+)\", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z]+): (.+)/
|
8
|
+
end
|
9
|
+
|
10
|
+
def scan_lines(consoleOutput, proj_dir)
|
11
|
+
res = []
|
12
|
+
consoleOutputFullnames = ""
|
13
|
+
consoleOutput.each_line do |l|
|
14
|
+
d = ErrorDesc.new
|
15
|
+
scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
|
16
|
+
if scan_res.length > 0
|
17
|
+
d.file_name = File.expand_path(scan_res[0][0])
|
18
|
+
d.line_number = scan_res[0][1].to_i
|
19
|
+
d.message = scan_res[0][4]
|
20
|
+
d.severity = get_severity(scan_res[0][3])
|
21
|
+
l.gsub!(scan_res[0][0],d.file_name)
|
22
|
+
end
|
23
|
+
res << d
|
24
|
+
consoleOutputFullnames << l
|
25
|
+
end
|
26
|
+
[res, consoleOutputFullnames]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'cxxproject/errorparser/error_parser'
|
2
|
-
|
3
|
-
module Cxxproject
|
4
|
-
class TILinkerErrorParser < ErrorParser
|
5
|
-
|
6
|
-
def initialize()
|
7
|
-
# todo: is every line an error?
|
8
|
-
# todo: some linker errors look like simple text, dunno how to parse properly...
|
9
|
-
# @error_expression1 = /(.*:\(\..*\)): (.*)/ # e.g. /c/Tool/Temp/ccAlar4R.o:x.cpp:(.text+0x17): undefined reference to `_a'
|
10
|
-
# @error_expression2 = /(.*):([0-9]+): (.*)/ # e.g. /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:roodi.yml.a:1: syntax error
|
11
|
-
end
|
12
|
-
|
13
|
-
def scan_lines(consoleOutput, proj_dir)
|
14
|
-
res = []
|
15
|
-
consoleOutput.each_line do |l|
|
16
|
-
l.rstrip!
|
17
|
-
d = ErrorDesc.new
|
18
|
-
if l != "<Linking>" then
|
19
|
-
d.file_name = proj_dir
|
20
|
-
d.line_number = 0
|
21
|
-
d.message = l
|
22
|
-
d.severity = SEVERITY_ERROR
|
23
|
-
end
|
24
|
-
res << d
|
25
|
-
end
|
26
|
-
[res, consoleOutput]
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'cxxproject/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Cxxproject
|
4
|
+
class TILinkerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
# todo: is every line an error?
|
8
|
+
# todo: some linker errors look like simple text, dunno how to parse properly...
|
9
|
+
# @error_expression1 = /(.*:\(\..*\)): (.*)/ # e.g. /c/Tool/Temp/ccAlar4R.o:x.cpp:(.text+0x17): undefined reference to `_a'
|
10
|
+
# @error_expression2 = /(.*):([0-9]+): (.*)/ # e.g. /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:roodi.yml.a:1: syntax error
|
11
|
+
end
|
12
|
+
|
13
|
+
def scan_lines(consoleOutput, proj_dir)
|
14
|
+
res = []
|
15
|
+
consoleOutput.each_line do |l|
|
16
|
+
l.rstrip!
|
17
|
+
d = ErrorDesc.new
|
18
|
+
if l != "<Linking>" then
|
19
|
+
d.file_name = proj_dir
|
20
|
+
d.line_number = 0
|
21
|
+
d.message = l
|
22
|
+
d.severity = SEVERITY_ERROR
|
23
|
+
end
|
24
|
+
res << d
|
25
|
+
end
|
26
|
+
[res, consoleOutput]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -1,144 +1,144 @@
|
|
1
|
-
|
2
|
-
module Cxxproject
|
3
|
-
class BinaryLibs
|
4
|
-
class << self
|
5
|
-
def [](*libs)
|
6
|
-
libraries = Array.new
|
7
|
-
libs.each do |x|
|
8
|
-
libraries << BinaryLibrary.new(x)
|
9
|
-
end
|
10
|
-
libraries
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class EvalContext
|
16
|
-
|
17
|
-
attr_accessor :myblock, :all_blocks
|
18
|
-
|
19
|
-
# must be called to add building blocks
|
20
|
-
def cxx_configuration(&block)
|
21
|
-
@myblock = block
|
22
|
-
@all_blocks = []
|
23
|
-
end
|
24
|
-
|
25
|
-
def eval_project(project_text, project_file, pwd)
|
26
|
-
@current_project_file = project_file
|
27
|
-
@current_working_dir = pwd
|
28
|
-
instance_eval(project_text)
|
29
|
-
end
|
30
|
-
|
31
|
-
def configuration(*args, &block)
|
32
|
-
name = args[0]
|
33
|
-
raise "no name given" unless name.is_a?(String) && !name.strip.empty?
|
34
|
-
instance_eval(&block)
|
35
|
-
end
|
36
|
-
|
37
|
-
def check_hash(hash,allowed)
|
38
|
-
hash.keys.map do |k|
|
39
|
-
error_string = ["error while evaluating \"#{@current_working_dir}/#{@current_project_file}\"",
|
40
|
-
"\"#{k}\" is not a valid specifier!"].join($/)
|
41
|
-
raise error_string unless allowed.include?(k)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_as_array(hash, s)
|
46
|
-
res = hash[s]
|
47
|
-
if res.is_a?(Array)
|
48
|
-
return res
|
49
|
-
end
|
50
|
-
return [res]
|
51
|
-
end
|
52
|
-
|
53
|
-
# specify an executable
|
54
|
-
# hash supports:
|
55
|
-
# * :sources
|
56
|
-
# * :includes
|
57
|
-
# * :dependencies
|
58
|
-
# * :libpath
|
59
|
-
# * :output_dir
|
60
|
-
def exe(name, hash)
|
61
|
-
raise "not a hash" unless hash.is_a?(Hash)
|
62
|
-
check_hash hash,[:sources,:includes,:dependencies,:libpath,:output_dir]
|
63
|
-
bblock = Executable.new(name)
|
64
|
-
bblock.set_sources(hash[:sources]) if hash.has_key?(:sources)
|
65
|
-
bblock.set_includes(get_as_array(hash, :includes)) if hash.has_key?(:includes)
|
66
|
-
calc_lib_searchpath(hash).each { |sp| bblock.add_lib_element(HasLibraries::SEARCH_PATH, sp) }
|
67
|
-
if hash.has_key?(:dependencies)
|
68
|
-
bblock.set_dependencies(hash[:dependencies])
|
69
|
-
hash[:dependencies].each { |d| bblock.add_lib_element(HasLibraries::DEPENDENCY, d) }
|
70
|
-
end
|
71
|
-
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
72
|
-
all_blocks << bblock
|
73
|
-
end
|
74
|
-
|
75
|
-
def calc_lib_searchpath(hash)
|
76
|
-
if hash.has_key?(:libpath)
|
77
|
-
hash[:libpath]
|
78
|
-
else
|
79
|
-
if Utils::OS.linux? || Utils::OS.mac?
|
80
|
-
["/usr/local/lib","/usr/lib"]
|
81
|
-
elsif Utils::OS.windows?
|
82
|
-
["C:/tool/cygwin/lib", "C:/Tool/cygwin/usr/local/lib"]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# specify a sourcelib
|
88
|
-
# hash supports:
|
89
|
-
# * :sources
|
90
|
-
# * :includes
|
91
|
-
# * :dependencies
|
92
|
-
# * :toolchain
|
93
|
-
# * :file_dependencies
|
94
|
-
# * :output_dir
|
95
|
-
def source_lib(name, hash)
|
96
|
-
raise "not a hash" unless hash.is_a?(Hash)
|
97
|
-
check_hash hash,[:sources, :includes, :dependencies, :toolchain, :file_dependencies, :output_dir]
|
98
|
-
raise ":sources need to be defined" unless hash.has_key?(:sources)
|
99
|
-
bblock = SourceLibrary.new(name)
|
100
|
-
bblock.set_sources(hash[:sources])
|
101
|
-
bblock.set_includes(get_as_array(hash, :includes)) if hash.has_key?(:includes)
|
102
|
-
bblock.set_tcs(hash[:toolchain]) if hash.has_key?(:toolchain)
|
103
|
-
if hash.has_key?(:dependencies)
|
104
|
-
bblock.set_dependencies(hash[:dependencies])
|
105
|
-
hash[:dependencies].each { |d| bblock.add_lib_element(HasLibraries::DEPENDENCY, d) }
|
106
|
-
end
|
107
|
-
bblock.file_dependencies = hash[:file_dependencies] if hash.has_key?(:file_dependencies)
|
108
|
-
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
109
|
-
all_blocks << bblock
|
110
|
-
end
|
111
|
-
|
112
|
-
# specify some binary libs
|
113
|
-
# returns all binary libs as array
|
114
|
-
def bin_libs(*names)
|
115
|
-
res = []
|
116
|
-
mapped = names.map{|n|n.to_s}
|
117
|
-
mapped.each do |name|
|
118
|
-
res << BinaryLibrary.new(name)
|
119
|
-
end
|
120
|
-
mapped
|
121
|
-
end
|
122
|
-
|
123
|
-
def compile(name, hash)
|
124
|
-
raise "not a hash" unless hash.is_a?(Hash)
|
125
|
-
check_hash hash,[:sources,:includes]
|
126
|
-
bblock = SingleSource.new(name)
|
127
|
-
bblock.set_sources(hash[:sources]) if hash.has_key?(:sources)
|
128
|
-
bblock.set_includes(hash[:includes]) if hash.has_key?(:includes)
|
129
|
-
all_blocks << bblock
|
130
|
-
end
|
131
|
-
|
132
|
-
def custom(name, hash)
|
133
|
-
raise "not a hash" unless hash.is_a?(Hash)
|
134
|
-
check_hash hash,[:execute, :dependencies]
|
135
|
-
bblock = CustomBuildingBlock.new(name)
|
136
|
-
bblock.set_actions(hash[:execute]) if hash.has_key?(:execute)
|
137
|
-
if hash.has_key?(:dependencies)
|
138
|
-
bblock.set_dependencies(hash[:dependencies])
|
139
|
-
end
|
140
|
-
all_blocks << bblock
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
end
|
1
|
+
|
2
|
+
module Cxxproject
|
3
|
+
class BinaryLibs
|
4
|
+
class << self
|
5
|
+
def [](*libs)
|
6
|
+
libraries = Array.new
|
7
|
+
libs.each do |x|
|
8
|
+
libraries << BinaryLibrary.new(x)
|
9
|
+
end
|
10
|
+
libraries
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class EvalContext
|
16
|
+
|
17
|
+
attr_accessor :myblock, :all_blocks
|
18
|
+
|
19
|
+
# must be called to add building blocks
|
20
|
+
def cxx_configuration(&block)
|
21
|
+
@myblock = block
|
22
|
+
@all_blocks = []
|
23
|
+
end
|
24
|
+
|
25
|
+
def eval_project(project_text, project_file, pwd)
|
26
|
+
@current_project_file = project_file
|
27
|
+
@current_working_dir = pwd
|
28
|
+
instance_eval(project_text)
|
29
|
+
end
|
30
|
+
|
31
|
+
def configuration(*args, &block)
|
32
|
+
name = args[0]
|
33
|
+
raise "no name given" unless name.is_a?(String) && !name.strip.empty?
|
34
|
+
instance_eval(&block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_hash(hash,allowed)
|
38
|
+
hash.keys.map do |k|
|
39
|
+
error_string = ["error while evaluating \"#{@current_working_dir}/#{@current_project_file}\"",
|
40
|
+
"\"#{k}\" is not a valid specifier!"].join($/)
|
41
|
+
raise error_string unless allowed.include?(k)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_as_array(hash, s)
|
46
|
+
res = hash[s]
|
47
|
+
if res.is_a?(Array)
|
48
|
+
return res
|
49
|
+
end
|
50
|
+
return [res]
|
51
|
+
end
|
52
|
+
|
53
|
+
# specify an executable
|
54
|
+
# hash supports:
|
55
|
+
# * :sources
|
56
|
+
# * :includes
|
57
|
+
# * :dependencies
|
58
|
+
# * :libpath
|
59
|
+
# * :output_dir
|
60
|
+
def exe(name, hash)
|
61
|
+
raise "not a hash" unless hash.is_a?(Hash)
|
62
|
+
check_hash hash,[:sources,:includes,:dependencies,:libpath,:output_dir]
|
63
|
+
bblock = Executable.new(name)
|
64
|
+
bblock.set_sources(hash[:sources]) if hash.has_key?(:sources)
|
65
|
+
bblock.set_includes(get_as_array(hash, :includes)) if hash.has_key?(:includes)
|
66
|
+
calc_lib_searchpath(hash).each { |sp| bblock.add_lib_element(HasLibraries::SEARCH_PATH, sp) }
|
67
|
+
if hash.has_key?(:dependencies)
|
68
|
+
bblock.set_dependencies(hash[:dependencies])
|
69
|
+
hash[:dependencies].each { |d| bblock.add_lib_element(HasLibraries::DEPENDENCY, d) }
|
70
|
+
end
|
71
|
+
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
72
|
+
all_blocks << bblock
|
73
|
+
end
|
74
|
+
|
75
|
+
def calc_lib_searchpath(hash)
|
76
|
+
if hash.has_key?(:libpath)
|
77
|
+
hash[:libpath]
|
78
|
+
else
|
79
|
+
if Utils::OS.linux? || Utils::OS.mac?
|
80
|
+
["/usr/local/lib","/usr/lib"]
|
81
|
+
elsif Utils::OS.windows?
|
82
|
+
["C:/tool/cygwin/lib", "C:/Tool/cygwin/usr/local/lib"]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# specify a sourcelib
|
88
|
+
# hash supports:
|
89
|
+
# * :sources
|
90
|
+
# * :includes
|
91
|
+
# * :dependencies
|
92
|
+
# * :toolchain
|
93
|
+
# * :file_dependencies
|
94
|
+
# * :output_dir
|
95
|
+
def source_lib(name, hash)
|
96
|
+
raise "not a hash" unless hash.is_a?(Hash)
|
97
|
+
check_hash hash,[:sources, :includes, :dependencies, :toolchain, :file_dependencies, :output_dir]
|
98
|
+
raise ":sources need to be defined" unless hash.has_key?(:sources)
|
99
|
+
bblock = SourceLibrary.new(name)
|
100
|
+
bblock.set_sources(hash[:sources])
|
101
|
+
bblock.set_includes(get_as_array(hash, :includes)) if hash.has_key?(:includes)
|
102
|
+
bblock.set_tcs(hash[:toolchain]) if hash.has_key?(:toolchain)
|
103
|
+
if hash.has_key?(:dependencies)
|
104
|
+
bblock.set_dependencies(hash[:dependencies])
|
105
|
+
hash[:dependencies].each { |d| bblock.add_lib_element(HasLibraries::DEPENDENCY, d) }
|
106
|
+
end
|
107
|
+
bblock.file_dependencies = hash[:file_dependencies] if hash.has_key?(:file_dependencies)
|
108
|
+
bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)
|
109
|
+
all_blocks << bblock
|
110
|
+
end
|
111
|
+
|
112
|
+
# specify some binary libs
|
113
|
+
# returns all binary libs as array
|
114
|
+
def bin_libs(*names)
|
115
|
+
res = []
|
116
|
+
mapped = names.map{|n|n.to_s}
|
117
|
+
mapped.each do |name|
|
118
|
+
res << BinaryLibrary.new(name)
|
119
|
+
end
|
120
|
+
mapped
|
121
|
+
end
|
122
|
+
|
123
|
+
def compile(name, hash)
|
124
|
+
raise "not a hash" unless hash.is_a?(Hash)
|
125
|
+
check_hash hash,[:sources,:includes]
|
126
|
+
bblock = SingleSource.new(name)
|
127
|
+
bblock.set_sources(hash[:sources]) if hash.has_key?(:sources)
|
128
|
+
bblock.set_includes(hash[:includes]) if hash.has_key?(:includes)
|
129
|
+
all_blocks << bblock
|
130
|
+
end
|
131
|
+
|
132
|
+
def custom(name, hash)
|
133
|
+
raise "not a hash" unless hash.is_a?(Hash)
|
134
|
+
check_hash hash,[:execute, :dependencies]
|
135
|
+
bblock = CustomBuildingBlock.new(name)
|
136
|
+
bblock.set_actions(hash[:execute]) if hash.has_key?(:execute)
|
137
|
+
if hash.has_key?(:dependencies)
|
138
|
+
bblock.set_dependencies(hash[:dependencies])
|
139
|
+
end
|
140
|
+
all_blocks << bblock
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
data/lib/cxxproject/ext/file.rb
CHANGED
@@ -1,81 +1,71 @@
|
|
1
|
-
require 'cxxproject/utils/utils'
|
2
|
-
|
3
|
-
class File
|
4
|
-
|
5
|
-
SLASH = '/'
|
6
|
-
|
7
|
-
def self.is_absolute?(filename)
|
8
|
-
if Cxxproject::Utils.old_ruby?
|
9
|
-
filename[0] == 47 or filename[1] == 58 # 47 = /, 58 = :
|
10
|
-
else
|
11
|
-
filename[0] == SLASH or filename[1] == ':'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
def self.add_prefix(prefix, file)
|
74
|
-
if not prefix or is_absolute?(file)
|
75
|
-
file
|
76
|
-
else
|
77
|
-
prefix + file
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
1
|
+
require 'cxxproject/utils/utils'
|
2
|
+
|
3
|
+
class File
|
4
|
+
|
5
|
+
SLASH = '/'
|
6
|
+
|
7
|
+
def self.is_absolute?(filename)
|
8
|
+
if Cxxproject::Utils.old_ruby?
|
9
|
+
filename[0] == 47 or filename[1] == 58 # 47 = /, 58 = :
|
10
|
+
else
|
11
|
+
filename[0] == SLASH or filename[1] == ':'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.rel_from_to_project(from,to,endWithSlash = true)
|
16
|
+
return nil if from.nil? or to.nil?
|
17
|
+
|
18
|
+
toSplitted = to.split('/')
|
19
|
+
fromSplitted = from.split('/')
|
20
|
+
|
21
|
+
max = [toSplitted.length, fromSplitted.length].min
|
22
|
+
|
23
|
+
return nil if max < 1
|
24
|
+
|
25
|
+
i = 0
|
26
|
+
|
27
|
+
# path letter in windows may be case different
|
28
|
+
if toSplitted[0].length > 1 and fromSplitted[0].length > 1
|
29
|
+
if Cxxproject::Utils.old_ruby?
|
30
|
+
i = 1 if toSplitted[0][1] == 58 and fromSplitted[0][1] == 58 and toSplitted[0].swapcase[0] == fromSplitted[0][0]
|
31
|
+
else
|
32
|
+
i = 1 if toSplitted[0][1] == ':' and fromSplitted[0][1] == ':' and toSplitted[0].swapcase[0] == fromSplitted[0][0]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
while i < max
|
37
|
+
break if toSplitted[i] != fromSplitted[i]
|
38
|
+
i += 1
|
39
|
+
end
|
40
|
+
j = i
|
41
|
+
|
42
|
+
res = []
|
43
|
+
while i < fromSplitted.length
|
44
|
+
res << ".."
|
45
|
+
i += 1
|
46
|
+
end
|
47
|
+
|
48
|
+
while j < toSplitted.length
|
49
|
+
res << toSplitted[j]
|
50
|
+
j += 1
|
51
|
+
end
|
52
|
+
|
53
|
+
if res.length == 0
|
54
|
+
return ""
|
55
|
+
end
|
56
|
+
|
57
|
+
res = res.join('/')
|
58
|
+
res += "/" if endWithSlash
|
59
|
+
res
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def self.add_prefix(prefix, file)
|
64
|
+
if not prefix or is_absolute?(file)
|
65
|
+
file
|
66
|
+
else
|
67
|
+
prefix + file
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Rake
|
2
|
-
class FileList
|
3
|
-
attr_accessor :pending_add
|
4
|
-
attr_accessor :items
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Rake
|
2
|
+
class FileList
|
3
|
+
attr_accessor :pending_add
|
4
|
+
attr_accessor :items
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class ::ProgressBar
|
2
|
+
attr_writer :title
|
3
|
+
|
4
|
+
def title_width=(w)
|
5
|
+
@title_width = w
|
6
|
+
@format = "%-#{@title_width}s #{'%3d%%'.red} #{'%s'.green} #{'%s'.blue}"
|
7
|
+
end
|
8
|
+
|
9
|
+
show_original = self.instance_method(:show)
|
10
|
+
define_method(:show) do
|
11
|
+
if @unblocked && !RakeFileUtils.verbose
|
12
|
+
show_original.bind(self).call
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def unblock
|
17
|
+
@unblocked = true
|
18
|
+
show
|
19
|
+
end
|
20
|
+
end
|