Mxx_ru 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +26 -0
- data/NEWS +52 -0
- data/README +21 -0
- data/Rakefile +32 -0
- data/examples/exe_and_lib/main.cpp +15 -0
- data/examples/exe_and_lib/prj.rb +11 -0
- data/examples/exe_and_lib/say.cpp +13 -0
- data/examples/exe_and_lib/say.hpp +11 -0
- data/examples/exe_and_lib/say.rb +7 -0
- data/examples/exe_dll_lib/inout.cpp +15 -0
- data/examples/exe_dll_lib/inout.hpp +26 -0
- data/examples/exe_dll_lib/inout.rb +18 -0
- data/examples/exe_dll_lib/main.cpp +23 -0
- data/examples/exe_dll_lib/prj.rb +11 -0
- data/examples/exe_dll_lib/say.cpp +13 -0
- data/examples/exe_dll_lib/say.hpp +12 -0
- data/examples/exe_dll_lib/say.rb +9 -0
- data/examples/exe_dll_lib_2/build.rb +7 -0
- data/examples/exe_dll_lib_2/inout/inout.cpp +15 -0
- data/examples/exe_dll_lib_2/inout/inout.hpp +26 -0
- data/examples/exe_dll_lib_2/inout/prj.rb +16 -0
- data/examples/exe_dll_lib_2/main/main.cpp +23 -0
- data/examples/exe_dll_lib_2/main/prj.rb +9 -0
- data/examples/exe_dll_lib_2/say/prj.rb +8 -0
- data/examples/exe_dll_lib_2/say/say.cpp +13 -0
- data/examples/exe_dll_lib_2/say/say.hpp +12 -0
- data/examples/simple_exe/main.cpp +26 -0
- data/examples/simple_exe/prj.rb +7 -0
- data/lib/mxx_ru/abstract_target.rb +283 -0
- data/lib/mxx_ru/binary_target.rb +89 -0
- data/lib/mxx_ru/binary_unittest.rb +130 -0
- data/lib/mxx_ru/cpp/analyzer.rb +230 -0
- data/lib/mxx_ru/cpp/composite.rb +106 -0
- data/lib/mxx_ru/cpp/detect_toolset.rb +122 -0
- data/lib/mxx_ru/cpp/mode.rb +85 -0
- data/lib/mxx_ru/cpp/obj_placement.rb +321 -0
- data/lib/mxx_ru/cpp/qt.rb +333 -0
- data/lib/mxx_ru/cpp/rucodegen.rb +114 -0
- data/lib/mxx_ru/cpp/source_file.rb +71 -0
- data/lib/mxx_ru/cpp/target.rb +1371 -0
- data/lib/mxx_ru/cpp/toolset.rb +1029 -0
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +52 -0
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +451 -0
- data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +56 -0
- data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +56 -0
- data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +273 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +54 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +382 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +60 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +144 -0
- data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +87 -0
- data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -0
- data/lib/mxx_ru/cpp/toolsets/vc8.rb +452 -0
- data/lib/mxx_ru/cpp/toolsets/vc_family.rb +428 -0
- data/lib/mxx_ru/cpp.rb +36 -0
- data/lib/mxx_ru/ex.rb +134 -0
- data/lib/mxx_ru/makestyle_generator.rb +138 -0
- data/lib/mxx_ru/textfile_unittest.rb +284 -0
- data/lib/mxx_ru/util.rb +258 -0
- data/tests/c/pcre/chartables.c +183 -0
- data/tests/c/pcre/config.h +99 -0
- data/tests/c/pcre/dftables.c +167 -0
- data/tests/c/pcre/get.c +349 -0
- data/tests/c/pcre/internal.h +677 -0
- data/tests/c/pcre/maketables.c +140 -0
- data/tests/c/pcre/pcre.c +8304 -0
- data/tests/c/pcre/pcre.h +193 -0
- data/tests/c/pcre/pcre.rb +14 -0
- data/tests/c/pcre/pcredemo.c +316 -0
- data/tests/c/pcre/pcregrep.c +642 -0
- data/tests/c/pcre/pcreposix.c +305 -0
- data/tests/c/pcre/pcreposix.h +88 -0
- data/tests/c/pcre/pcretest.c +1483 -0
- data/tests/c/pcre/perltest +211 -0
- data/tests/c/pcre/printint.c +360 -0
- data/tests/c/pcre/study.c +472 -0
- data/tests/cpp/mswin_res_dll/build.rb +14 -0
- data/tests/cpp/mswin_res_dll/dll.cpp +17 -0
- data/tests/cpp/mswin_res_dll/dll.rb +30 -0
- data/tests/cpp/mswin_res_dll/dll.rc +48 -0
- data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -0
- data/tests/cpp/mswin_res_dll/h/res.h +3 -0
- data/tests/cpp/mswin_res_dll/main.cpp +13 -0
- data/tests/cpp/mswin_res_dll/main.rb +20 -0
- data/tests/cpp/mswin_res_dll/res/tree_fol.bmp +0 -0
- data/tests/cpp/mswin_res_dll/res/tree_state_1.bmp +0 -0
- data/tests/cpp/mswin_res_dll/res/tree_state_2.bmp +0 -0
- data/tests/cpp/mswin_res_exe/build.rb +23 -0
- data/tests/cpp/mswin_res_exe/h/res.h +3 -0
- data/tests/cpp/mswin_res_exe/main.cpp +17 -0
- data/tests/cpp/mswin_res_exe/main.rc +48 -0
- data/tests/cpp/mswin_res_exe/res/tree_fol.bmp +0 -0
- data/tests/cpp/mswin_res_exe/res/tree_state_1.bmp +0 -0
- data/tests/cpp/mswin_res_exe/res/tree_state_2.bmp +0 -0
- data/tests/cpp/rucodegen/host_config.cpp +20 -0
- data/tests/cpp/rucodegen/host_config.rb +14 -0
- data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -0
- data/tests/cpp/rucodegen/impl/conn_params.rb +14 -0
- data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -0
- data/tests/cpp/rucodegen/prj.rb +17 -0
- data/tests/cpp/textfile_unittest/build.rb +8 -0
- data/tests/cpp/textfile_unittest/etalons/out_0.txt +0 -0
- data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -0
- data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -0
- data/tests/cpp/textfile_unittest/main.cpp +89 -0
- data/tests/cpp/textfile_unittest/prj.rb +8 -0
- data/tests/cpp/textfile_unittest/prj.ut.rb +18 -0
- data/tests/cpp/toolset_name.rb +6 -0
- data/tests/cpp/vc_cleanup/cout.log +72 -0
- data/tests/cpp/vc_cleanup/dll_hi.cpp +5 -0
- data/tests/cpp/vc_cleanup/exe_hi.cpp +10 -0
- data/tests/cpp/vc_cleanup/lib_hi.cpp +5 -0
- data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -0
- data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/prj_lib.rb +10 -0
- data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -0
- data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +60 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -0
- data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -0
- data/tests/mxx_ru/change_default_value/ok/build.rb +8 -0
- data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -0
- data/tests/mxx_ru/tc_makestyle_generator.rb +117 -0
- data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -0
- data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -0
- data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -0
- data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -0
- data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -0
- data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -0
- data/tests/mxx_ru/vc8/ts_vc8.rb +10 -0
- data/tests/qt/aclock/aclock.cpp +148 -0
- data/tests/qt/aclock/aclock.h +45 -0
- data/tests/qt/aclock/main.cpp +28 -0
- data/tests/qt/aclock/prj.rb +21 -0
- data/tests/qt/iconview/main.cpp +76 -0
- data/tests/qt/iconview/prj.rb +21 -0
- data/tests/qt/toplevel/main.cpp +9 -0
- data/tests/qt/toplevel/options.ui +587 -0
- data/tests/qt/toplevel/options.ui.h +98 -0
- data/tests/qt/toplevel/prj.rb +21 -0
- metadata +241 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
#
|
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
8
|
+
# are permitted provided that the following conditions are met:
|
|
9
|
+
#
|
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer.
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
16
|
+
# from this software without specific prior written permission.
|
|
17
|
+
#
|
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
require 'singleton'
|
|
30
|
+
|
|
31
|
+
module Mxx_ru
|
|
32
|
+
module Cpp
|
|
33
|
+
|
|
34
|
+
module Analyzer
|
|
35
|
+
# Class, describing one source file.
|
|
36
|
+
class Source_file
|
|
37
|
+
# Already processed file sign.
|
|
38
|
+
attr_reader :is_processed
|
|
39
|
+
# A set of files-dependecies.
|
|
40
|
+
# Hash, key is a String, no value.
|
|
41
|
+
attr_reader :depends
|
|
42
|
+
|
|
43
|
+
def initialize
|
|
44
|
+
@is_processed = false
|
|
45
|
+
@depends = Hash.new
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Set processed file sign.
|
|
49
|
+
def processed
|
|
50
|
+
@is_processed = true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Add a dependency.
|
|
54
|
+
def <<( a_name )
|
|
55
|
+
@depends[ a_name ]= nil
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end # class Source_file
|
|
59
|
+
|
|
60
|
+
class Cpp_analyzer
|
|
61
|
+
include Singleton
|
|
62
|
+
|
|
63
|
+
@@include_regex = Regexp.new(
|
|
64
|
+
'^[ \t]*#[ \t]*include[ \t]*(<|")([^>"]+)(>|")' )
|
|
65
|
+
|
|
66
|
+
def initialize
|
|
67
|
+
# Key is a string, value - Source_file.
|
|
68
|
+
@sources = Hash.new
|
|
69
|
+
# A list of folders to look header files in.
|
|
70
|
+
@include_paths = Array.new
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Add files to view.
|
|
74
|
+
# [_a_sources_] Should be Array of Strings.
|
|
75
|
+
def add_sources( a_sources )
|
|
76
|
+
|
|
77
|
+
a_sources.each { |s|
|
|
78
|
+
if !@sources.key?( s )
|
|
79
|
+
@sources[ s ] = Source_file.new
|
|
80
|
+
end
|
|
81
|
+
}
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Add paths to header files.
|
|
85
|
+
# [_a_paths_] Should be Array of Strings.
|
|
86
|
+
def add_include_paths( a_paths )
|
|
87
|
+
|
|
88
|
+
a_paths.each { |p|
|
|
89
|
+
if !@include_paths.include?( p )
|
|
90
|
+
@include_paths << p
|
|
91
|
+
end
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Perform file analisys.
|
|
96
|
+
def analyze
|
|
97
|
+
# Current list of keys should be taken to avoid
|
|
98
|
+
# dynamic growth of file list.
|
|
99
|
+
# Repeat iterations until source file list changes stop
|
|
100
|
+
old_size = 0
|
|
101
|
+
files = @sources.keys
|
|
102
|
+
while old_size != files.size
|
|
103
|
+
files.each { |file_name|
|
|
104
|
+
current = @sources[ file_name ]
|
|
105
|
+
if !current.is_processed
|
|
106
|
+
process_file( file_name, current )
|
|
107
|
+
end
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
old_size = files.size
|
|
111
|
+
files = @sources.keys
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Get full dependencies list for a file.
|
|
116
|
+
# Returns Array of Strings.
|
|
117
|
+
def get_depends_for( a_file_name )
|
|
118
|
+
result_hash = Hash.new
|
|
119
|
+
file_obj = @sources[ a_file_name ]
|
|
120
|
+
if nil != file_obj
|
|
121
|
+
to_review = file_obj.depends
|
|
122
|
+
to_review_next = Hash.new
|
|
123
|
+
|
|
124
|
+
while to_review.size != to_review_next.size
|
|
125
|
+
to_review.each_key { |f|
|
|
126
|
+
if !result_hash.key?( f )
|
|
127
|
+
result_hash[ f ] = nil
|
|
128
|
+
to_review_next_obj = @sources[ f ]
|
|
129
|
+
to_review_next_obj.depends.each_key { |k|
|
|
130
|
+
to_review_next[ k ] = nil }
|
|
131
|
+
end
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
to_review = to_review_next
|
|
135
|
+
to_review_next = Hash.new
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
return result_hash.keys
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
protected
|
|
143
|
+
# Process next file.
|
|
144
|
+
# [_a_file_name_] File name.
|
|
145
|
+
# [_a_file_obj_] Corresponding object.
|
|
146
|
+
def process_file( a_file_name, a_file_obj )
|
|
147
|
+
|
|
148
|
+
# Gather file names list from include directives.
|
|
149
|
+
std_path_included = Array.new
|
|
150
|
+
local_path_included = Array.new
|
|
151
|
+
IO.foreach( a_file_name ) { |line|
|
|
152
|
+
r = @@include_regex.match( line )
|
|
153
|
+
if nil != r
|
|
154
|
+
if "<" == r[ 1 ]
|
|
155
|
+
std_path_included << r[ 2 ]
|
|
156
|
+
else
|
|
157
|
+
local_path_included << r[ 2 ]
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
# All files, loaded through include <>
|
|
163
|
+
# should be searched in standard search paths only.
|
|
164
|
+
std_path_included.each { |f|
|
|
165
|
+
process_std_include_path_file( f, a_file_obj )
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if local_path_included.size
|
|
169
|
+
# Files loaded through include ""
|
|
170
|
+
# should be searched in folder with the source file first.
|
|
171
|
+
local_path = File.dirname( a_file_name )
|
|
172
|
+
local_path_included.each { |f|
|
|
173
|
+
process_local_include_path_file( f, local_path, a_file_obj )
|
|
174
|
+
}
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
a_file_obj.processed
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Processing file loaded through include <>
|
|
181
|
+
# [_a_file_name_] File name.
|
|
182
|
+
# [_a_owner_obj_] File object contained include directive.
|
|
183
|
+
def process_std_include_path_file( a_file_name, a_owner_obj )
|
|
184
|
+
|
|
185
|
+
@include_paths.find { |path|
|
|
186
|
+
test_name = File.join( [ path, a_file_name ] )
|
|
187
|
+
if File.exists?( test_name )
|
|
188
|
+
add_depend_to( a_owner_obj, test_name )
|
|
189
|
+
true
|
|
190
|
+
else
|
|
191
|
+
false
|
|
192
|
+
end
|
|
193
|
+
}
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Processing file loaded through include ""
|
|
197
|
+
# [_a_file_name_] File name.
|
|
198
|
+
# [_a_local_path_] Folder with owner_obj.
|
|
199
|
+
# [_a_owner_obj_] File object contained include directive.
|
|
200
|
+
def process_local_include_path_file(
|
|
201
|
+
a_file_name,
|
|
202
|
+
a_local_path,
|
|
203
|
+
a_owner_obj )
|
|
204
|
+
|
|
205
|
+
test_name = File.join( [ a_local_path, a_file_name ] )
|
|
206
|
+
if File.exists?( test_name )
|
|
207
|
+
add_depend_to( a_owner_obj, test_name )
|
|
208
|
+
else
|
|
209
|
+
process_std_include_path_file( a_file_name, a_owner_obj )
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Add dependency to a file.
|
|
214
|
+
# [_a_owner_obj_] Dependency owner.
|
|
215
|
+
# [_a_depend_name_] Dependency file name.
|
|
216
|
+
def add_depend_to( a_owner_obj, a_depend_name )
|
|
217
|
+
|
|
218
|
+
a_owner_obj << a_depend_name
|
|
219
|
+
|
|
220
|
+
if !@sources.key?( a_depend_name )
|
|
221
|
+
# This file wasn't viewed yet.
|
|
222
|
+
@sources[ a_depend_name ] = Source_file.new
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end # class Cpp_analyzer
|
|
226
|
+
|
|
227
|
+
end # module Analyzer
|
|
228
|
+
end # module cpp
|
|
229
|
+
end # module Mxx_ru
|
|
230
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
#
|
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
8
|
+
# are permitted provided that the following conditions are met:
|
|
9
|
+
#
|
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer.
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
16
|
+
# from this software without specific prior written permission.
|
|
17
|
+
#
|
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
require 'mxx_ru/cpp/target'
|
|
30
|
+
|
|
31
|
+
module Mxx_ru
|
|
32
|
+
|
|
33
|
+
module Cpp
|
|
34
|
+
|
|
35
|
+
# Target type is a composition of subprojects
|
|
36
|
+
class Composite_target_type < Target_type
|
|
37
|
+
TYPE = "composite"
|
|
38
|
+
|
|
39
|
+
def name
|
|
40
|
+
return TYPE
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Composition of subprojects target
|
|
45
|
+
class Composite_target < Target
|
|
46
|
+
def initialize( a_alias, &block )
|
|
47
|
+
super( a_alias )
|
|
48
|
+
|
|
49
|
+
instance_eval( &block ) if block
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def target_type
|
|
53
|
+
return Composite_target_type.new
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def build
|
|
57
|
+
if nil == @mxx_last_build_result
|
|
58
|
+
|
|
59
|
+
if !@mxx_all_options_defined
|
|
60
|
+
# It's required for toolset to define all required options
|
|
61
|
+
# taking all current modes into account.
|
|
62
|
+
Mxx_ru::Cpp::toolset.setup_mandatory_options( self )
|
|
63
|
+
@mxx_all_options_defined = true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
@mxx_last_build_result = build_required_projects
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
return @mxx_last_build_result
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def clean
|
|
74
|
+
if nil == @mxx_last_build_result
|
|
75
|
+
|
|
76
|
+
if !@mxx_all_options_defined
|
|
77
|
+
# It's required for toolset to define all required options
|
|
78
|
+
# taking all current modes into account.
|
|
79
|
+
Mxx_ru::Cpp::toolset.setup_mandatory_options( self )
|
|
80
|
+
@mxx_all_options_defined = true
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
clean_required_prjs
|
|
84
|
+
|
|
85
|
+
@mxx_last_build_result = Mxx_ru::Target_state.new(
|
|
86
|
+
Mxx_ru::Target_state::ABSENT )
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end # class Composite_target
|
|
91
|
+
|
|
92
|
+
# Simple method to define composite target.
|
|
93
|
+
#
|
|
94
|
+
# Example:
|
|
95
|
+
# Mxx_ru::Cpp::composite_target( Mxx_ru::BUILD_ROOT ) {
|
|
96
|
+
# required_prj 'some_project.rb'
|
|
97
|
+
# required_prj 'some_another_project.rb'
|
|
98
|
+
# }
|
|
99
|
+
def Cpp.composite_target( prj_alias, &block )
|
|
100
|
+
Mxx_ru::setup_target Composite_target.new( prj_alias, &block )
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end # module Cpp
|
|
104
|
+
|
|
105
|
+
end # module Mxx_ru
|
|
106
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
#
|
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
8
|
+
# are permitted provided that the following conditions are met:
|
|
9
|
+
#
|
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer.
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
16
|
+
# from this software without specific prior written permission.
|
|
17
|
+
#
|
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
require 'mxx_ru/cpp/toolset'
|
|
30
|
+
|
|
31
|
+
module Mxx_ru
|
|
32
|
+
module Cpp
|
|
33
|
+
|
|
34
|
+
# Detect current toolset based on values of environment variables
|
|
35
|
+
#
|
|
36
|
+
# Following algorithm is used:
|
|
37
|
+
# Getting the value of MXX_RU_CPP_TOOLSET envonment variable.
|
|
38
|
+
# It should be in a following format:
|
|
39
|
+
# <file> [tag=value [tag=value [...]]
|
|
40
|
+
# <file> value is used in require directive.
|
|
41
|
+
#
|
|
42
|
+
# After loading of file defined, toolset method should return
|
|
43
|
+
# a pointer to toolset object.
|
|
44
|
+
#
|
|
45
|
+
# If toolset object was created, pairs of tag=value are parsed and
|
|
46
|
+
# saved to the toolset created using a setup_tag method.
|
|
47
|
+
def Cpp.detect_toolset
|
|
48
|
+
begin
|
|
49
|
+
env_var = "MXX_RU_CPP_TOOLSET"
|
|
50
|
+
|
|
51
|
+
env = ENV[ env_var ]
|
|
52
|
+
if nil == env
|
|
53
|
+
raise Mxx_ru::Invalid_value_ex.new(
|
|
54
|
+
"Environment variable '#{env_var}' not found (not set " +
|
|
55
|
+
"or empty" )
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Exctracting file name, responsible for toolset object creation.
|
|
59
|
+
toolset_file_name_regexp = /^(\S+)(.*)$/
|
|
60
|
+
file_name_match = toolset_file_name_regexp.match( env )
|
|
61
|
+
if nil == file_name_match
|
|
62
|
+
raise Mxx_ru::Invalid_value_ex.new(
|
|
63
|
+
"Invalid format of environment variable '#{env_var}'. " +
|
|
64
|
+
"Expected format: #{env_var}=<file>[ <tag>=<value>[ " +
|
|
65
|
+
"<tag>=<value>[ ...]]]" )
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
file_name = file_name_match[ 1 ]
|
|
69
|
+
unparsed_tags = file_name_match[ 2 ]
|
|
70
|
+
|
|
71
|
+
# Loading the file
|
|
72
|
+
# Try to loading specified file first, if it fails try to
|
|
73
|
+
# loading file with 'mxx_ru/cpp/toolsets' added...
|
|
74
|
+
try_load_toolset_file file_name
|
|
75
|
+
|
|
76
|
+
if nil == toolset()
|
|
77
|
+
raise Mxx_ru::Invalid_value_ex.new(
|
|
78
|
+
"C/C++ Toolset is not set by file '#{file_name}'" )
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Setting up toolset tags
|
|
82
|
+
setup_toolset_tags( toolset(), unparsed_tags )
|
|
83
|
+
|
|
84
|
+
rescue Mxx_ru::Ex => ex
|
|
85
|
+
$stderr.print "<<<[#{ex.class.name}]\t#{ex}>>>\n"
|
|
86
|
+
exit( -1 )
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# [_a_toolset_] Toolset, tags are set for
|
|
91
|
+
# [_a_unparsed_tags_] A string, formatted that way:
|
|
92
|
+
# <tag>=<value>[ <tag>=<value> [<tag>=<value> ...]]
|
|
93
|
+
def Cpp.setup_toolset_tags( a_toolset,
|
|
94
|
+
a_unparsed_tags )
|
|
95
|
+
|
|
96
|
+
a_unparsed_tags.scan( /(\S+)=(\S+)/ ) { |t, v|
|
|
97
|
+
a_toolset.setup_tag( t, v )
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Try load toolset file (without and with 'mxx_ru/cpp/toolsets' prefix).
|
|
103
|
+
#
|
|
104
|
+
# Raises LoadError if loading failed
|
|
105
|
+
def Cpp.try_load_toolset_file( file_name )
|
|
106
|
+
files_to_load = [ file_name,
|
|
107
|
+
File.join( 'mxx_ru/cpp/toolsets', file_name ) ]
|
|
108
|
+
load_result = files_to_load.detect { |file_to_load|
|
|
109
|
+
begin
|
|
110
|
+
require file_to_load
|
|
111
|
+
rescue LoadError
|
|
112
|
+
false
|
|
113
|
+
end
|
|
114
|
+
}
|
|
115
|
+
raise Mxx_ru::Invalid_value_ex.new(
|
|
116
|
+
"Unable to load Toolset from files: " +
|
|
117
|
+
"'#{files_to_load.join('; ')}'" ) unless load_result
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end # module Cpp
|
|
121
|
+
end # module Mxx_ru
|
|
122
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 1996-2004, Yauheni Akhotnikau
|
|
3
|
+
# Copyright (c) 2004-2006, JSC Intervale
|
|
4
|
+
# Copyright (c) 2006, The Mxx_ru Project
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
#
|
|
7
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
|
8
|
+
# are permitted provided that the following conditions are met:
|
|
9
|
+
#
|
|
10
|
+
# 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer.
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
# 3. The name of the author may not be used to endorse or promote products derived
|
|
16
|
+
# from this software without specific prior written permission.
|
|
17
|
+
#
|
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
19
|
+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
require 'singleton'
|
|
30
|
+
|
|
31
|
+
module Mxx_ru
|
|
32
|
+
module Cpp
|
|
33
|
+
|
|
34
|
+
# Arguments passed into Ruby interpreter, intended to control Mxx_ru::Cpp.
|
|
35
|
+
MXXCPPARG_RELEASE = "--mxx-cpp-release"
|
|
36
|
+
MXXCPPARG_DEBUG = "--mxx-cpp-debug"
|
|
37
|
+
MXXCPPARG_ONLY_ONE = "--mxx-cpp-1"
|
|
38
|
+
MXXCPPARG_NO_DEPENDS_ANALYZER = "--mxx-cpp-no-depends-analyzer"
|
|
39
|
+
|
|
40
|
+
# Class, detecting a mode of Mxx_ru::Cpp is running
|
|
41
|
+
class Mode
|
|
42
|
+
include Singleton
|
|
43
|
+
|
|
44
|
+
attr_reader :is_release
|
|
45
|
+
attr_reader :is_debug
|
|
46
|
+
attr_reader :is_only_one
|
|
47
|
+
attr_reader :is_no_depends_analyzer
|
|
48
|
+
|
|
49
|
+
# Constructor checks for a special arguments in a command line
|
|
50
|
+
def initialize
|
|
51
|
+
@is_release = ARGV.include?( MXXCPPARG_RELEASE )
|
|
52
|
+
@is_debug = ARGV.include?( MXXCPPARG_DEBUG )
|
|
53
|
+
@is_only_one = ARGV.include?( MXXCPPARG_ONLY_ONE )
|
|
54
|
+
@is_no_depends_analyzer = ARGV.include?( MXXCPPARG_NO_DEPENDS_ANALYZER )
|
|
55
|
+
@manual_dry_run_counter = 0
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# It should be executed before build/clean of subprojects.
|
|
59
|
+
# If is_only_one option is set and manual_dry_run_counter is equal to 0,
|
|
60
|
+
# manual dry_run mode is activated.
|
|
61
|
+
def before_subprj_processing
|
|
62
|
+
if is_only_one
|
|
63
|
+
if 0 == @manual_dry_run_counter
|
|
64
|
+
Mxx_ru::Util::Mode.instance.manual_dry_run( true )
|
|
65
|
+
end
|
|
66
|
+
@manual_dry_run_counter += 1
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# It should be executed after build/clean of subprojects.
|
|
71
|
+
# If is_only_one option is set and manual_dry_run_counter is equal to 0,
|
|
72
|
+
# manual dry_run mode is activated.
|
|
73
|
+
def after_subprj_processing
|
|
74
|
+
if is_only_one
|
|
75
|
+
@manual_dry_run_counter -= 1
|
|
76
|
+
if 0 == @manual_dry_run_counter
|
|
77
|
+
Mxx_ru::Util::Mode.instance.manual_dry_run( false )
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end # module Cpp
|
|
85
|
+
end # module Mxx_ru
|