Mxx_ru 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +17 -0
- data/Rakefile +3 -3
- data/THANKS +1 -0
- data/lib/mxx_ru/abstract_target.rb +34 -4
- data/lib/mxx_ru/cpp/composite.rb +2 -1
- data/lib/mxx_ru/cpp/qt.rb +8 -4
- data/lib/mxx_ru/cpp/rucodegen.rb +8 -2
- data/lib/mxx_ru/cpp/target.rb +39 -2
- data/lib/mxx_ru/cpp/toolset.rb +20 -5
- data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +3 -1
- data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +21 -2
- data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +4 -0
- data/lib/mxx_ru/makestyle_generator.rb +4 -1
- data/lib/mxx_ru/util.rb +58 -8
- data/tests/cpp/cpp_sources_glob/build.rb +7 -0
- data/tests/cpp/cpp_sources_glob/some/module/1/f1.cpp +8 -0
- data/tests/cpp/cpp_sources_glob/some/module/2/f2.cpp +8 -0
- data/tests/cpp/cpp_sources_glob/some/module/3/f3.cpp +8 -0
- data/tests/cpp/cpp_sources_glob/some/module/4/f4.cpp +8 -0
- data/tests/cpp/cpp_sources_glob/some/module/funcs.hpp +9 -0
- data/tests/cpp/cpp_sources_glob/some/module/main.cpp +11 -0
- data/tests/cpp/cpp_sources_glob/some/module/prj.rb +10 -0
- data/tests/cpp/rucodegen/prj.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_lib.rb +1 -1
- data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +1 -1
- data/tests/mxx_ru/plural_form_methods/tc.rb +72 -0
- metadata +27 -2
data/NEWS
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
Changes in Mxx_ru
|
2
2
|
|
3
|
+
1.2.0 version (2006.04.15)
|
4
|
+
|
5
|
+
Added command-line arguments --mxx-brief-show, --mxx-brief-hide and
|
6
|
+
method Mxx_ru.enable_show_brief for controlling brief description of
|
7
|
+
executed commands.
|
8
|
+
|
9
|
+
Argument prj_alias for composite_target, exe_target, lib_target and
|
10
|
+
dll_target now optional. If it omitted than Mxx_ru try detect prj_alias form
|
11
|
+
Kernel#caller result (assume what call to *_target method was made directly
|
12
|
+
in project file).
|
13
|
+
|
14
|
+
Added methods Abstract_target#required_prjs, Cpp::Target#c_sources,
|
15
|
+
Cpp::Target#cpp_sources those accept Enumerable (plural form for
|
16
|
+
corresponding singular analogs). New methods can accept result of Dir.glob().
|
17
|
+
|
18
|
+
Some fixes for MinGW C++, Borland C++ compilers.
|
19
|
+
|
3
20
|
1.1.0 version (2006.02..2006.04)
|
4
21
|
|
5
22
|
Documentation and commentaries are translated to english.
|
data/Rakefile
CHANGED
@@ -4,18 +4,18 @@ Gem::manage_gems
|
|
4
4
|
require 'rake/gempackagetask'
|
5
5
|
|
6
6
|
PKG_NAME =
|
7
|
-
RKG_VERSION = '1.
|
7
|
+
RKG_VERSION = '1.2.0'
|
8
8
|
|
9
9
|
spec = Gem::Specification.new do |s|
|
10
10
|
s.name = "Mxx_ru"
|
11
|
-
s.version = "1.
|
11
|
+
s.version = "1.2.0"
|
12
12
|
s.author = "The Mxx_ru Project"
|
13
13
|
s.email = "eao197@yahoo.com"
|
14
14
|
s.homepage = "http://www.rubyforge.com/projects/mxx-ru"
|
15
15
|
s.platform = Gem::Platform::RUBY
|
16
16
|
s.summary = "Mxx_ru (Make++ on Ruby) is a cross-platform build tool"
|
17
17
|
s.files = FileList[ "{bin,tests,lib,docs,examples}/**/*" ].
|
18
|
-
exclude( "rdoc" ).to_a
|
18
|
+
exclude( "rdoc" ).to_a + [ "THANKS" ]
|
19
19
|
s.require_path = "lib"
|
20
20
|
# s.autorequire = "rucodegen"
|
21
21
|
# s.test_file = "tests/ts_rucodegen.rb"
|
data/THANKS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Konstantine Nazarov (rut at user dot sourceforge dot net)
|
@@ -179,6 +179,25 @@ module Mxx_ru
|
|
179
179
|
# Vector of source code generators.
|
180
180
|
attr_reader :mxx_generators
|
181
181
|
|
182
|
+
# Metacode for generating 'plural' version of singular method.
|
183
|
+
# Plural version accept Enumerable-type argument and call
|
184
|
+
# singular version for each member of Enumerable argument.
|
185
|
+
#
|
186
|
+
# For example:
|
187
|
+
# define_plural_form_method :required_prj
|
188
|
+
# define_plural_form_method :cpp_source
|
189
|
+
# produces methods
|
190
|
+
# required_prjs( items )
|
191
|
+
# cpp_sources( items )
|
192
|
+
#
|
193
|
+
def Abstract_target.define_plural_form_method( singular_method )
|
194
|
+
class_eval %Q{
|
195
|
+
def #{singular_method}s(a)
|
196
|
+
a.each { |e| #{singular_method}( e ) }
|
197
|
+
end
|
198
|
+
}
|
199
|
+
end
|
200
|
+
|
182
201
|
def initialize( a_prj_alias )
|
183
202
|
@mxx_full_targets_names = Array.new
|
184
203
|
@mxx_prj_alias = a_prj_alias
|
@@ -214,6 +233,13 @@ module Mxx_ru
|
|
214
233
|
return target
|
215
234
|
end
|
216
235
|
|
236
|
+
# Plural form of required_prj.
|
237
|
+
#
|
238
|
+
# For example:
|
239
|
+
# required_prjs [ 'module1/prj.rb', 'module2/prj.rb' ]
|
240
|
+
# required_prjs Dir.glob( 'modules/**/prj.rb' )
|
241
|
+
define_plural_form_method :required_prj
|
242
|
+
|
217
243
|
# Add one more generator to the target.
|
218
244
|
# Reference to the target is returned.
|
219
245
|
def generator( a_generator )
|
@@ -236,12 +262,16 @@ module Mxx_ru
|
|
236
262
|
#
|
237
263
|
# [a_cmd_lines] Array of String
|
238
264
|
# [a_to_destroy_on_fail] Files required to be cleaned up if any of given command fail.
|
239
|
-
|
265
|
+
# [brief_desc] Brief description of command (will be shown if --mxx-brief-desc
|
266
|
+
# specified in command line)
|
267
|
+
def Abstract_target.run( a_cmd_lines, a_to_destroy_on_fail, brief_desc = nil )
|
268
|
+
|
269
|
+
puts "#{brief_desc.capitalize} ..." \
|
270
|
+
if Mxx_ru::Util::Mode.instance.is_brief_desc and nil != brief_desc
|
240
271
|
|
241
272
|
a_cmd_lines.each { |c|
|
242
|
-
|
243
|
-
|
244
|
-
end
|
273
|
+
puts "<<< #{c} >>>" \
|
274
|
+
if Mxx_ru::Util::Mode.instance.is_show_cmd
|
245
275
|
|
246
276
|
# Do not actually execute in dry-run mode.
|
247
277
|
if !Mxx_ru::Util::Mode.instance.is_dry_run
|
data/lib/mxx_ru/cpp/composite.rb
CHANGED
@@ -96,7 +96,8 @@ module Mxx_ru
|
|
96
96
|
# required_prj 'some_project.rb'
|
97
97
|
# required_prj 'some_another_project.rb'
|
98
98
|
# }
|
99
|
-
def Cpp.composite_target( prj_alias, &block )
|
99
|
+
def Cpp.composite_target( prj_alias = nil, &block )
|
100
|
+
prj_alias = Mxx_ru::Util::prj_alias_form_caller( caller ) unless prj_alias
|
100
101
|
Mxx_ru::setup_target Composite_target.new( prj_alias, &block )
|
101
102
|
end
|
102
103
|
|
data/lib/mxx_ru/cpp/qt.rb
CHANGED
@@ -173,14 +173,16 @@ module Cpp
|
|
173
173
|
header_file, [ ui ] ).state
|
174
174
|
Mxx_ru::Abstract_target::run(
|
175
175
|
[ "#{@uic_name} -o #{header_file} #{ui}" ],
|
176
|
-
[ header_file ]
|
176
|
+
[ header_file ],
|
177
|
+
"building header file #{header_file}" )
|
177
178
|
end
|
178
179
|
if Target_state::EXISTS != Target_state.detect(
|
179
180
|
cpp_file, [ ui, header_file ] ).state
|
180
181
|
Mxx_ru::Abstract_target::run(
|
181
182
|
[ "#{@uic_name} -i #{header_file} " +
|
182
183
|
"-o #{cpp_file} #{ui}" ],
|
183
|
-
[ cpp_file ]
|
184
|
+
[ cpp_file ],
|
185
|
+
"building source file #{cpp_file}" )
|
184
186
|
end
|
185
187
|
}
|
186
188
|
end
|
@@ -225,7 +227,8 @@ module Cpp
|
|
225
227
|
Mxx_ru::Abstract_target::run(
|
226
228
|
[ "#{moc_name} -o #{moc_full} " +
|
227
229
|
"#{header_full}" ],
|
228
|
-
[ moc_full ]
|
230
|
+
[ moc_full ],
|
231
|
+
"building moc file #{moc_full}" )
|
229
232
|
end
|
230
233
|
|
231
234
|
add_cpp_source( a_target, moc )
|
@@ -282,7 +285,8 @@ module Cpp
|
|
282
285
|
Mxx_ru::Abstract_target::run(
|
283
286
|
[ "#{moc_name} -o #{moc_full} " +
|
284
287
|
"#{cpp_full}" ],
|
285
|
-
[ moc_full ]
|
288
|
+
[ moc_full ],
|
289
|
+
"building moc file #{moc_full}" )
|
286
290
|
end
|
287
291
|
}
|
288
292
|
end
|
data/lib/mxx_ru/cpp/rucodegen.rb
CHANGED
@@ -88,14 +88,20 @@ class RuCodeGen < Abstract_generator
|
|
88
88
|
# Perform code generation.
|
89
89
|
def build( target )
|
90
90
|
@scripts.each do |s|
|
91
|
-
Abstract_target.run(
|
91
|
+
Abstract_target.run(
|
92
|
+
make_build_cmd( s, :build ),
|
93
|
+
[],
|
94
|
+
"running code generation script #{s} (build mode)" )
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
95
98
|
# Perform cleanup of generated files.
|
96
99
|
def clean( target )
|
97
100
|
@scripts.each do |s|
|
98
|
-
Abstract_target.run(
|
101
|
+
Abstract_target.run(
|
102
|
+
make_build_cmd( s, :clean ),
|
103
|
+
[],
|
104
|
+
"running code generation script #{s} (clean mode)" )
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
data/lib/mxx_ru/cpp/target.rb
CHANGED
@@ -788,6 +788,18 @@ module Mxx_ru
|
|
788
788
|
|
789
789
|
# Add one C-file to the target.
|
790
790
|
#
|
791
|
+
# Note: if a_file_name contains prefix equal to current sources_root
|
792
|
+
# than mxx_ru does not add sources_root to name of file. For example:
|
793
|
+
# Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
|
794
|
+
# ...
|
795
|
+
# c_source 'f1.c' # become 'some/module/f1.c'
|
796
|
+
# c_source 'some/module/impl/f2.c' # remains 'some/module/impl/f2.c
|
797
|
+
# This approach will be useful with Dir.glob:
|
798
|
+
# Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
|
799
|
+
# ...
|
800
|
+
# c_sources Dir.glob( 'some/module/**/*.c' )
|
801
|
+
# }
|
802
|
+
#
|
791
803
|
# [_a_file_name_] The name of a file added.
|
792
804
|
# [_a_options_] Optional list of a compiler options for that file.
|
793
805
|
# When command line would be created, this options would
|
@@ -799,6 +811,18 @@ module Mxx_ru
|
|
799
811
|
|
800
812
|
# Add one C++-file to the target.
|
801
813
|
#
|
814
|
+
# Note: if a_file_name contains prefix equal to current sources_root
|
815
|
+
# than mxx_ru does not add sources_root to name of file. For example:
|
816
|
+
# Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
|
817
|
+
# ...
|
818
|
+
# cpp_source 'f1.cpp' # become 'some/module/f1.cpp'
|
819
|
+
# cpp_source 'some/module/impl/f2.cpp' # remains 'some/module/impl/f2.cpp
|
820
|
+
# This approach will be useful with Dir.glob:
|
821
|
+
# Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
|
822
|
+
# ...
|
823
|
+
# cpp_sources Dir.glob( 'some/module/**/*.cpp' )
|
824
|
+
# }
|
825
|
+
#
|
802
826
|
# [_a_file_name_] The name of a file added.
|
803
827
|
# [_a_options_] Optional list of a compiler options for that file.
|
804
828
|
# When command line would be created, this options would
|
@@ -808,6 +832,11 @@ module Mxx_ru
|
|
808
832
|
create_full_src_file_name( a_file_name ), a_options ) )
|
809
833
|
end
|
810
834
|
|
835
|
+
# Plural form for c_source and cpp_source. Does not allow specify options
|
836
|
+
# for source files.
|
837
|
+
define_plural_form_method :c_source
|
838
|
+
define_plural_form_method :cpp_source
|
839
|
+
|
811
840
|
# Set mswin resource file name.
|
812
841
|
#
|
813
842
|
# [_a_rc_file_] The name of rc-file.
|
@@ -936,11 +965,18 @@ module Mxx_ru
|
|
936
965
|
|
937
966
|
# Creation of a complete name of a source file
|
938
967
|
# taking the value of mxx_sources_root into account
|
968
|
+
#
|
969
|
+
# If a_file_name starts with current value of mxx_sources_root
|
970
|
+
# than a_file_name remains unchanged.
|
939
971
|
def create_full_src_file_name( a_file_name )
|
940
972
|
if "" == mxx_sources_root
|
941
973
|
return a_file_name
|
942
974
|
else
|
943
|
-
|
975
|
+
if a_file_name[ 0..mxx_sources_root.size ] == mxx_sources_root + '/'
|
976
|
+
return a_file_name
|
977
|
+
else
|
978
|
+
return File.join( [ mxx_sources_root, a_file_name ] )
|
979
|
+
end
|
944
980
|
end
|
945
981
|
end
|
946
982
|
|
@@ -1356,7 +1392,8 @@ module Mxx_ru
|
|
1356
1392
|
def Cpp.generate_simple_target_method( target_type )
|
1357
1393
|
target_class_name = target_type.to_s.capitalize
|
1358
1394
|
class_eval %Q{
|
1359
|
-
def Cpp.#{target_type}( prj_alias, &block )
|
1395
|
+
def Cpp.#{target_type}( prj_alias = nil, &block )
|
1396
|
+
prj_alias = Mxx_ru::Util::prj_alias_form_caller( caller ) unless prj_alias
|
1360
1397
|
Mxx_ru::setup_target #{target_class_name}.new( prj_alias, &block )
|
1361
1398
|
end
|
1362
1399
|
}
|
data/lib/mxx_ru/cpp/toolset.rb
CHANGED
@@ -353,7 +353,10 @@ module Mxx_ru
|
|
353
353
|
full_name, target.mxx_mswin_rc_file.name,
|
354
354
|
target.mxx_all_mswin_rc_options, target )
|
355
355
|
|
356
|
-
Mxx_ru::Abstract_target::run(
|
356
|
+
Mxx_ru::Abstract_target::run(
|
357
|
+
cmd_lines,
|
358
|
+
[ full_name ],
|
359
|
+
"compilling #{full_name}" )
|
357
360
|
|
358
361
|
state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
|
359
362
|
end
|
@@ -406,7 +409,10 @@ module Mxx_ru
|
|
406
409
|
lib_file, target.mxx_obj_files,
|
407
410
|
target.mxx_all_librarian_options, target )
|
408
411
|
|
409
|
-
Mxx_ru::Abstract_target::run(
|
412
|
+
Mxx_ru::Abstract_target::run(
|
413
|
+
cmd_lines,
|
414
|
+
[ lib_file ],
|
415
|
+
"building #{lib_file}" )
|
410
416
|
|
411
417
|
lib_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
|
412
418
|
end
|
@@ -486,7 +492,10 @@ module Mxx_ru
|
|
486
492
|
cmd_lines = make_dll_command_lines(
|
487
493
|
dll_file, dll_info, link_lists, target )
|
488
494
|
|
489
|
-
Mxx_ru::Abstract_target::run(
|
495
|
+
Mxx_ru::Abstract_target::run(
|
496
|
+
cmd_lines,
|
497
|
+
[ dll_file ],
|
498
|
+
"building #{dll_file}" )
|
490
499
|
|
491
500
|
dll_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
|
492
501
|
end
|
@@ -555,7 +564,10 @@ module Mxx_ru
|
|
555
564
|
cmd_lines = make_exe_command_lines(
|
556
565
|
exe_file, exe_info, link_lists, target )
|
557
566
|
|
558
|
-
Mxx_ru::Abstract_target::run(
|
567
|
+
Mxx_ru::Abstract_target::run(
|
568
|
+
cmd_lines,
|
569
|
+
[ exe_file ],
|
570
|
+
"building #{exe_file}" )
|
559
571
|
|
560
572
|
exe_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
|
561
573
|
end
|
@@ -893,7 +905,10 @@ module Mxx_ru
|
|
893
905
|
target )
|
894
906
|
|
895
907
|
# Executing.
|
896
|
-
Mxx_ru::Abstract_target::run(
|
908
|
+
Mxx_ru::Abstract_target::run(
|
909
|
+
cmd_lines,
|
910
|
+
[ o.name ],
|
911
|
+
"compiling #{o.source.name}" )
|
897
912
|
}
|
898
913
|
|
899
914
|
end
|
@@ -428,7 +428,9 @@ module Mxx_ru
|
|
428
428
|
|
429
429
|
if 0 != a_linker_lists.lib_paths.size
|
430
430
|
result << "/L;"
|
431
|
-
a_linker_lists.lib_paths.each { |p|
|
431
|
+
unix2win_mass( a_linker_lists.lib_paths ).each { |p|
|
432
|
+
result << "#{p};"
|
433
|
+
}
|
432
434
|
result << " "
|
433
435
|
end
|
434
436
|
|
@@ -206,7 +206,9 @@ module Mxx_ru
|
|
206
206
|
a_linker_lists.lib_paths.each { |p| result << "-L#{p} " }
|
207
207
|
|
208
208
|
result << "#{a_linker_lists.objs.join(' ')} "
|
209
|
-
a_linker_lists.libs.each { |l|
|
209
|
+
a_linker_lists.libs.each { |l|
|
210
|
+
result << "-l#{port_specific_lib_name_checker(l)} "
|
211
|
+
}
|
210
212
|
|
211
213
|
result << port_specific_dll_link_options(
|
212
214
|
a_dll_name, a_dll_info, a_linker_lists, a_target )
|
@@ -258,7 +260,9 @@ module Mxx_ru
|
|
258
260
|
a_linker_lists.lib_paths.each { |p| result << "-L#{p} " }
|
259
261
|
|
260
262
|
result << "#{a_linker_lists.objs.join(' ')} "
|
261
|
-
a_linker_lists.libs.each { |l|
|
263
|
+
a_linker_lists.libs.each { |l|
|
264
|
+
result << "-l#{port_specific_lib_name_checker(l)} "
|
265
|
+
}
|
262
266
|
|
263
267
|
result << port_specific_exe_link_options(
|
264
268
|
a_exe_name, a_exe_info, a_linker_lists, a_target )
|
@@ -286,6 +290,11 @@ module Mxx_ru
|
|
286
290
|
return ""
|
287
291
|
end
|
288
292
|
|
293
|
+
# Return correct name of library to be given for linker.
|
294
|
+
def port_specific_lib_name_checker(library_name)
|
295
|
+
library_name
|
296
|
+
end
|
297
|
+
|
289
298
|
end # class Gcc_family
|
290
299
|
|
291
300
|
# Toolset implemetation for GCC compiler for Win32.
|
@@ -373,6 +382,16 @@ module Mxx_ru
|
|
373
382
|
return ""
|
374
383
|
end
|
375
384
|
|
385
|
+
# Checks library name for suffix '.lib' and return name without
|
386
|
+
# that suffix.
|
387
|
+
def port_specific_lib_name_checker(library_name)
|
388
|
+
if /\.lib$/i =~ library_name
|
389
|
+
Mxx_ru::Util::remove_file_ext(library_name)
|
390
|
+
else
|
391
|
+
library_name
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
376
395
|
end # class Gcc_mswin_family
|
377
396
|
|
378
397
|
end # module Toolsets
|
@@ -64,6 +64,10 @@ module Mxx_ru
|
|
64
64
|
target.linker_option( "-mconsole" )
|
65
65
|
end
|
66
66
|
|
67
|
+
if THREADING_MULTI == target.mxx_threading_mode
|
68
|
+
target.compiler_option( "-mthreads" )
|
69
|
+
end
|
70
|
+
|
67
71
|
# ��� defines � ��� include_path ������ ���������������� � ��
|
68
72
|
# ���������� ��������.
|
69
73
|
target.mxx_all_defines.each { |d|
|
@@ -100,7 +100,10 @@ class Makestyle_generator < Abstract_generator
|
|
100
100
|
|
101
101
|
if need_build
|
102
102
|
# It's required to run all commands to build target.
|
103
|
-
Abstract_target.run(
|
103
|
+
Abstract_target.run(
|
104
|
+
@build_cmds,
|
105
|
+
[],
|
106
|
+
"building #{@target_files.join(', ')}" )
|
104
107
|
end
|
105
108
|
end
|
106
109
|
|
data/lib/mxx_ru/util.rb
CHANGED
@@ -41,10 +41,15 @@ module Mxx_ru
|
|
41
41
|
MXXARG_KEEP_TMPS = "--mxx-keep-tmps"
|
42
42
|
MXXARG_SHOW_TMPS = "--mxx-show-tmps"
|
43
43
|
MXXARG_DRY_RUN = "--mxx-dry-run"
|
44
|
+
MXXARG_BRIEF_DESC = '--mxx-brief-show'
|
45
|
+
MXXARG_BRIEF_DESC_DISABLED = '--mxx-brief-hide'
|
44
46
|
|
45
47
|
# OS name, script is run on.
|
46
48
|
@@host_os = nil
|
47
49
|
|
50
|
+
# Regular expression to parse entries in Kernel#caller result.
|
51
|
+
CALLER_ENTRY_REGEX = /^(.+):\d+(:in\s.+){0,1}$/
|
52
|
+
|
48
53
|
# Class, which detects Mxx_ru current mode.
|
49
54
|
class Mode
|
50
55
|
include Singleton
|
@@ -53,6 +58,7 @@ module Mxx_ru
|
|
53
58
|
attr_reader :is_show_cmd
|
54
59
|
attr_reader :is_keep_tmps
|
55
60
|
attr_reader :is_show_tmps
|
61
|
+
attr_reader :is_brief_desc
|
56
62
|
|
57
63
|
# Constructor checks for special arguments in command line.
|
58
64
|
def initialize
|
@@ -61,6 +67,11 @@ module Mxx_ru
|
|
61
67
|
@is_keep_tmps = ARGV.include?( MXXARG_KEEP_TMPS )
|
62
68
|
@is_show_tmps = ARGV.include?( MXXARG_SHOW_TMPS )
|
63
69
|
@is_dry_run = ARGV.include?( MXXARG_DRY_RUN )
|
70
|
+
@is_brief_desc = ARGV.include?( MXXARG_BRIEF_DESC )
|
71
|
+
@is_brief_desc_disabled = ARGV.include?( MXXARG_BRIEF_DESC_DISABLED )
|
72
|
+
|
73
|
+
@is_brief_desc = false if @is_brief_desc_disabled
|
74
|
+
|
64
75
|
@is_manual_dry_run = false
|
65
76
|
end
|
66
77
|
|
@@ -73,11 +84,18 @@ module Mxx_ru
|
|
73
84
|
|
74
85
|
# On/Off manual dry-run mode.
|
75
86
|
# In some cases it's efficient to turn it on for some time.
|
76
|
-
# For example, it's used to handle subprojects with --mxx-cpp-1 option
|
87
|
+
# For example, it's used to handle subprojects with --mxx-cpp-1 option
|
88
|
+
# set.
|
77
89
|
def manual_dry_run( a_is_manual_dry_run )
|
78
90
|
@is_manual_dry_run = a_is_manual_dry_run
|
79
91
|
end
|
80
92
|
|
93
|
+
# Try to manually enable 'show-brief' mode. Attempt ignored if
|
94
|
+
# '--mxx-show-brief-disabled' was specified.
|
95
|
+
def try_enable_show_brief
|
96
|
+
@is_brief_desc = true unless @is_brief_desc_disabled
|
97
|
+
end
|
98
|
+
|
81
99
|
end
|
82
100
|
|
83
101
|
# Returns file name without last extension.
|
@@ -177,10 +195,10 @@ module Mxx_ru
|
|
177
195
|
|
178
196
|
end # class Tmp_files
|
179
197
|
|
180
|
-
# Auxiliary function for correct execution of build method of target
|
181
|
-
# Before execution Tmp_files.push is executed, and after execution
|
182
|
-
# Tmp_files.pop is called. This way we are removing
|
183
|
-
# created during a compilation of given target.
|
198
|
+
# Auxiliary function for correct execution of build method of target
|
199
|
+
# object. Before execution Tmp_files.push is executed, and after execution
|
200
|
+
# of build method Tmp_files.pop is called. This way we are removing
|
201
|
+
# temporary files created during a compilation of given target.
|
184
202
|
def Util.build_call_wrapper( a_target )
|
185
203
|
begin
|
186
204
|
Tmp_files.instance.push
|
@@ -194,8 +212,8 @@ module Mxx_ru
|
|
194
212
|
# Create folder if it isn't exist.
|
195
213
|
#
|
196
214
|
# All chain of names is tracked. For example, if we trying to create
|
197
|
-
# output/release/lib folder, and only output is exists, then release/lib
|
198
|
-
# are created.
|
215
|
+
# output/release/lib folder, and only output is exists, then release/lib
|
216
|
+
# folders are created.
|
199
217
|
def Util.create_dir( a_name )
|
200
218
|
# Dividing the chain.
|
201
219
|
chain = Array.new
|
@@ -219,7 +237,8 @@ module Mxx_ru
|
|
219
237
|
# If dry-run mode wasn't set, checking for existance.
|
220
238
|
# If it isn't exists, trying to create it.
|
221
239
|
#
|
222
|
-
# In a dry-run mode Mxx_ru always assumes folder is exists, even if it
|
240
|
+
# In a dry-run mode Mxx_ru always assumes folder is exists, even if it
|
241
|
+
# isn't.
|
223
242
|
def Util.ensure_path_exists( a_path_name )
|
224
243
|
if !Mxx_ru::Util::Mode.instance.is_dry_run
|
225
244
|
if !FileTest.exists?( a_path_name )
|
@@ -252,7 +271,38 @@ module Mxx_ru
|
|
252
271
|
return a_pathname
|
253
272
|
end
|
254
273
|
|
274
|
+
# Extract file name from 'Kernel#caller' result for using this
|
275
|
+
# name as project alias.
|
276
|
+
def Util.prj_alias_form_caller( caller_result )
|
277
|
+
r = CALLER_ENTRY_REGEX.match( caller_result[ 0 ] )[ 1 ]
|
278
|
+
# Name can starts with './' ('./some/module/prj.rb'). That name
|
279
|
+
# must be transformed to 'some/module/prj.rb'.
|
280
|
+
if r[ 0..1 ] == './'
|
281
|
+
r[ 2...r.size ]
|
282
|
+
else
|
283
|
+
r
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
255
287
|
end # module Util
|
256
288
|
|
289
|
+
# Manually enable 'show-brief' mode.
|
290
|
+
#
|
291
|
+
# Intended to use in project files:
|
292
|
+
# Mxx_ru::Cpp::exe_target( 'some.prj' ) {
|
293
|
+
# ...
|
294
|
+
# Mxx_ru::enable_show_brief
|
295
|
+
# ...
|
296
|
+
# }
|
297
|
+
# 'show-brief' is global mode. Once enabled it cannot be disabled
|
298
|
+
# form inside another project file.
|
299
|
+
#
|
300
|
+
# Call to Mxx_ru::enable_show_brief ignored if '--mxx-show-brief-disabled'
|
301
|
+
# specified in command-line.
|
302
|
+
#
|
303
|
+
def Mxx_ru.enable_show_brief
|
304
|
+
Util::Mode.instance.try_enable_show_brief
|
305
|
+
end
|
306
|
+
|
257
307
|
end # module Mxx_ru
|
258
308
|
|
data/tests/cpp/rucodegen/prj.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'mxx_ru/cpp'
|
2
2
|
require 'mxx_ru/cpp/rucodegen'
|
3
3
|
|
4
|
-
Mxx_ru::setup_target Mxx_ru::Cpp::Exe_target.new( "
|
4
|
+
Mxx_ru::setup_target Mxx_ru::Cpp::Exe_target.new( "tests/cpp/rucodegen/prj.rb" ) {
|
5
5
|
target "host_config"
|
6
6
|
|
7
7
|
rucodegen = generator Mxx_ru::Cpp::RuCodeGen.new( self )
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'mxx_ru/cpp'
|
4
|
+
|
5
|
+
class TC_PluralFormMethods < Test::Unit::TestCase
|
6
|
+
def test_required_prj
|
7
|
+
test_value = [ 'test_required_prj_sub1', 'test_required_prj_sub2' ]
|
8
|
+
|
9
|
+
test_value.each { |p| Mxx_ru::Cpp::composite_target( p ) {} }
|
10
|
+
|
11
|
+
t = Mxx_ru::Cpp::composite_target( 'test_required_prj' ) {
|
12
|
+
required_prjs test_value
|
13
|
+
}
|
14
|
+
|
15
|
+
assert_equal( test_value.size, t.mxx_required_prjs.size )
|
16
|
+
t.mxx_required_prjs.each { |p|
|
17
|
+
assert( test_value.member?( p.prj_alias ) )
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_c_sources
|
22
|
+
test_files = [ 'hello.c', 'greeting.c' ]
|
23
|
+
|
24
|
+
t = Mxx_ru::setup_target(
|
25
|
+
Mxx_ru::Cpp::Exe_target.new( 'test_c_sources' ) {
|
26
|
+
target 'test_c_sources'
|
27
|
+
|
28
|
+
c_sources test_files
|
29
|
+
},
|
30
|
+
false )
|
31
|
+
|
32
|
+
defined_sources = t.mxx_c_files.inject( [] ) { |r, f| r << File.basename( f.name ) }
|
33
|
+
|
34
|
+
assert_equal( test_files, defined_sources )
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_cpp_sources
|
38
|
+
test_files = [ 'hello.cpp', 'greeting.cpp' ]
|
39
|
+
|
40
|
+
path = 'some/test'
|
41
|
+
t = Mxx_ru::setup_target(
|
42
|
+
Mxx_ru::Cpp::Exe_target.new( "#{path}/test_cpp_sources" ) {
|
43
|
+
target 'test_cpp_sources'
|
44
|
+
|
45
|
+
cpp_sources test_files
|
46
|
+
},
|
47
|
+
false )
|
48
|
+
|
49
|
+
expected_sources = test_files.inject( [] ) { |r, f| r << "#{path}/#{f}" }
|
50
|
+
defined_sources = t.mxx_cpp_files.inject( [] ) { |r, f| r << f.name }
|
51
|
+
|
52
|
+
assert_equal( expected_sources, defined_sources )
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_cpp_sources_with_special_prefix
|
56
|
+
path = 'some/test'
|
57
|
+
test_files = [ "#{path}/hello.cpp", "#{path}/greeting.cpp" ]
|
58
|
+
|
59
|
+
t = Mxx_ru::setup_target(
|
60
|
+
Mxx_ru::Cpp::Exe_target.new( "#{path}/test_cpp_sources" ) {
|
61
|
+
target 'test_cpp_sources'
|
62
|
+
|
63
|
+
cpp_sources test_files
|
64
|
+
},
|
65
|
+
false )
|
66
|
+
|
67
|
+
defined_sources = t.mxx_cpp_files.inject( [] ) { |r, f| r << f.name }
|
68
|
+
|
69
|
+
assert_equal( test_files, defined_sources )
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: Mxx_ru
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date: 2006-04-
|
6
|
+
version: 1.2.0
|
7
|
+
date: 2006-04-16
|
8
8
|
summary: Mxx_ru (Make++ on Ruby) is a cross-platform build tool
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- tests/c/pcre/perltest
|
52
52
|
- tests/c/pcre/printint.c
|
53
53
|
- tests/c/pcre/study.c
|
54
|
+
- tests/cpp/cpp_sources_glob
|
54
55
|
- tests/cpp/mswin_res_dll
|
55
56
|
- tests/cpp/mswin_res_exe
|
56
57
|
- tests/cpp/o
|
@@ -58,6 +59,25 @@ files:
|
|
58
59
|
- tests/cpp/textfile_unittest
|
59
60
|
- tests/cpp/toolset_name.rb
|
60
61
|
- tests/cpp/vc_cleanup
|
62
|
+
- tests/cpp/cpp_sources_glob/build.rb
|
63
|
+
- tests/cpp/cpp_sources_glob/some
|
64
|
+
- tests/cpp/cpp_sources_glob/some/module
|
65
|
+
- tests/cpp/cpp_sources_glob/some/module/1
|
66
|
+
- tests/cpp/cpp_sources_glob/some/module/2
|
67
|
+
- tests/cpp/cpp_sources_glob/some/module/3
|
68
|
+
- tests/cpp/cpp_sources_glob/some/module/4
|
69
|
+
- tests/cpp/cpp_sources_glob/some/module/funcs.hpp
|
70
|
+
- tests/cpp/cpp_sources_glob/some/module/main.cpp
|
71
|
+
- tests/cpp/cpp_sources_glob/some/module/o
|
72
|
+
- tests/cpp/cpp_sources_glob/some/module/prj.rb
|
73
|
+
- tests/cpp/cpp_sources_glob/some/module/1/f1.cpp
|
74
|
+
- tests/cpp/cpp_sources_glob/some/module/1/o
|
75
|
+
- tests/cpp/cpp_sources_glob/some/module/2/f2.cpp
|
76
|
+
- tests/cpp/cpp_sources_glob/some/module/2/o
|
77
|
+
- tests/cpp/cpp_sources_glob/some/module/3/f3.cpp
|
78
|
+
- tests/cpp/cpp_sources_glob/some/module/3/o
|
79
|
+
- tests/cpp/cpp_sources_glob/some/module/4/f4.cpp
|
80
|
+
- tests/cpp/cpp_sources_glob/some/module/4/o
|
61
81
|
- tests/cpp/mswin_res_dll/build.rb
|
62
82
|
- tests/cpp/mswin_res_dll/dll.cpp
|
63
83
|
- tests/cpp/mswin_res_dll/dll.rb
|
@@ -120,6 +140,7 @@ files:
|
|
120
140
|
- tests/cpp/vc_cleanup/tc_vc_cleanup.rb
|
121
141
|
- tests/cpp/vc_cleanup/lib/simple_target_root
|
122
142
|
- tests/mxx_ru/change_default_value
|
143
|
+
- tests/mxx_ru/plural_form_methods
|
123
144
|
- tests/mxx_ru/tc_makestyle_generator.rb
|
124
145
|
- tests/mxx_ru/vc8
|
125
146
|
- tests/mxx_ru/change_default_value/ignoring_by_build_root
|
@@ -132,6 +153,7 @@ files:
|
|
132
153
|
- tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb
|
133
154
|
- tests/mxx_ru/change_default_value/ok/build.rb
|
134
155
|
- tests/mxx_ru/change_default_value/ok/child_1.rb
|
156
|
+
- tests/mxx_ru/plural_form_methods/tc.rb
|
135
157
|
- tests/mxx_ru/vc8/tc_actual_manifest.rb
|
136
158
|
- tests/mxx_ru/vc8/tc_append_mt_commands.rb
|
137
159
|
- tests/mxx_ru/vc8/tc_default_manifest.rb
|
@@ -145,10 +167,12 @@ files:
|
|
145
167
|
- tests/qt/aclock/aclock.cpp
|
146
168
|
- tests/qt/aclock/aclock.h
|
147
169
|
- tests/qt/aclock/main.cpp
|
170
|
+
- tests/qt/aclock/o
|
148
171
|
- tests/qt/aclock/prj.rb
|
149
172
|
- tests/qt/iconview/main.cpp
|
150
173
|
- tests/qt/iconview/prj.rb
|
151
174
|
- tests/qt/toplevel/main.cpp
|
175
|
+
- tests/qt/toplevel/o
|
152
176
|
- tests/qt/toplevel/options.ui
|
153
177
|
- tests/qt/toplevel/options.ui.h
|
154
178
|
- tests/qt/toplevel/prj.rb
|
@@ -221,6 +245,7 @@ files:
|
|
221
245
|
- examples/exe_dll_lib_2/say/say.hpp
|
222
246
|
- examples/simple_exe/main.cpp
|
223
247
|
- examples/simple_exe/prj.rb
|
248
|
+
- THANKS
|
224
249
|
- README
|
225
250
|
- Rakefile
|
226
251
|
- COPYING
|