cxxproject 0.5.48 → 0.5.59

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/Rakefile.rb +116 -116
  2. data/bin/cxx +10 -10
  3. data/lib/cxxproject.rb +23 -23
  4. data/lib/cxxproject/buildingblocks/binary_library.rb +39 -39
  5. data/lib/cxxproject/buildingblocks/building_block.rb +251 -239
  6. data/lib/cxxproject/buildingblocks/command_line.rb +79 -79
  7. data/lib/cxxproject/buildingblocks/custom_building_block.rb +39 -41
  8. data/lib/cxxproject/buildingblocks/executable.rb +257 -249
  9. data/lib/cxxproject/buildingblocks/has_dependencies_mixin.rb +83 -83
  10. data/lib/cxxproject/buildingblocks/has_includes_mixin.rb +20 -20
  11. data/lib/cxxproject/buildingblocks/has_libraries_mixin.rb +34 -34
  12. data/lib/cxxproject/buildingblocks/has_sources_mixin.rb +371 -364
  13. data/lib/cxxproject/buildingblocks/makefile.rb +153 -153
  14. data/lib/cxxproject/buildingblocks/module.rb +35 -35
  15. data/lib/cxxproject/buildingblocks/single_source.rb +33 -33
  16. data/lib/cxxproject/buildingblocks/source_library.rb +124 -124
  17. data/lib/cxxproject/errorparser/diab_compiler_error_parser.rb +40 -40
  18. data/lib/cxxproject/errorparser/diab_linker_error_parser.rb +41 -33
  19. data/lib/cxxproject/errorparser/error_parser.rb +50 -50
  20. data/lib/cxxproject/errorparser/gcc_compiler_error_parser.rb +35 -30
  21. data/lib/cxxproject/errorparser/gcc_linker_error_parser.rb +35 -29
  22. data/lib/cxxproject/errorparser/ti_compiler_error_parser.rb +30 -30
  23. data/lib/cxxproject/errorparser/ti_linker_error_parser.rb +30 -29
  24. data/lib/cxxproject/eval_context.rb +144 -136
  25. data/lib/cxxproject/ext/file.rb +71 -71
  26. data/lib/cxxproject/ext/filelist.rb +6 -6
  27. data/lib/cxxproject/ext/progressbar.rb +20 -20
  28. data/lib/cxxproject/ext/rake.rb +419 -397
  29. data/lib/cxxproject/ext/rake_dirty.rb +30 -30
  30. data/lib/cxxproject/ext/rake_listener.rb +59 -59
  31. data/lib/cxxproject/ext/stdout.rb +44 -44
  32. data/lib/cxxproject/ext/string.rb +9 -9
  33. data/lib/cxxproject/ide_interface.rb +187 -181
  34. data/lib/cxxproject/toolchain/clang.rb +39 -39
  35. data/lib/cxxproject/toolchain/colorizing_formatter.rb +99 -99
  36. data/lib/cxxproject/toolchain/diab.rb +3 -1
  37. data/lib/cxxproject/toolchain/gcc.rb +2 -1
  38. data/lib/cxxproject/toolchain/provider.rb +131 -128
  39. data/lib/cxxproject/toolchain/toolchain.rb +38 -38
  40. data/lib/cxxproject/toolchain/toolchain_benchmark.rb +23 -23
  41. data/lib/cxxproject/torake.rb +218 -216
  42. data/lib/cxxproject/utils/cleanup.rb +20 -20
  43. data/lib/cxxproject/utils/console.rb +6 -6
  44. data/lib/cxxproject/utils/exit_helper.rb +40 -40
  45. data/lib/cxxproject/utils/graphstream.rb +154 -154
  46. data/lib/cxxproject/utils/optional.rb +16 -16
  47. data/lib/cxxproject/utils/printer.rb +50 -50
  48. data/lib/cxxproject/utils/process.rb +52 -52
  49. data/lib/cxxproject/utils/progress.rb +66 -66
  50. data/lib/cxxproject/utils/progress_helper.rb +77 -77
  51. data/lib/cxxproject/utils/rbcurse.rb +284 -284
  52. data/lib/cxxproject/utils/rbcurse_executable_ext.rb +14 -14
  53. data/lib/cxxproject/utils/rbcurse_progress.rb +71 -71
  54. data/lib/cxxproject/utils/rbcurse_tasktable.rb +51 -51
  55. data/lib/cxxproject/utils/stats.rb +60 -60
  56. data/lib/cxxproject/utils/ubigraph.rb +228 -228
  57. data/lib/cxxproject/utils/utils.rb +60 -37
  58. data/lib/cxxproject/utils/valgrind.rb +11 -11
  59. data/lib/cxxproject/version.rb +7 -7
  60. data/lib/tools/Rakefile.rb.template +10 -10
  61. data/lib/tools/project.rb.template +6 -6
  62. data/lib/tools/project_wizard.rb +66 -66
  63. data/spec/building_block_spec.rb +56 -56
  64. data/spec/cxxproject_2_rake_spec.rb +186 -186
  65. data/spec/file_ext_spec.rb +30 -30
  66. data/spec/ide_interface_spec.rb +41 -41
  67. data/spec/object_dependency_spec.rb +83 -83
  68. data/spec/project_path_spec.rb +71 -71
  69. data/spec/rake_listener_ext_spec.rb +58 -58
  70. data/spec/spec_helper.rb +18 -18
  71. data/spec/string_spec.rb +11 -11
  72. data/spec/testdata/basic/exe12/project.rb +5 -5
  73. data/spec/testdata/basic/lib1/project.rb +5 -5
  74. data/spec/testdata/basic/lib2/project.rb +8 -8
  75. data/spec/testdata/multiple_levels/libs/lib1/project.rb +5 -5
  76. data/spec/testdata/multiple_levels/libs/lib2/project.rb +19 -19
  77. data/spec/testdata/multiple_levels/mainproject/basic/project.rb +8 -8
  78. data/spec/testdata/onlyOneHeader/Rakefile.rb +4 -4
  79. data/spec/testdata/onlyOneHeader/project.rb +4 -4
  80. data/spec/toolchain_spec.rb +29 -29
  81. metadata +58 -58
@@ -1,50 +1,50 @@
1
- require 'cxxproject/toolchain/colorizing_formatter'
2
-
3
- module Cxxproject
4
-
5
- class Printer
6
- @@cf = ColorizingFormatter.new
7
-
8
- def self.printInfo(str)
9
- if @@cf.enabled?
10
- puts @@cf.printInfo(str)
11
- else
12
- puts str
13
- end
14
- end
15
-
16
- def self.printAdditionalInfo(str)
17
- if @@cf.enabled?
18
- puts @@cf.printAdditionalInfo(str)
19
- else
20
- puts str
21
- end
22
- end
23
-
24
- def self.printWarning(str)
25
- if @@cf.enabled?
26
- puts @@cf.printWarning(str)
27
- else
28
- puts str
29
- end
30
- end
31
-
32
- def self.printError(str)
33
- if @@cf.enabled?
34
- puts @@cf.printError(str)
35
- else
36
- puts str
37
- end
38
- end
39
-
40
- def self.printSuccess(str)
41
- if @@cf.enabled?
42
- puts @@cf.printSuccess(str)
43
- else
44
- puts str
45
- end
46
- end
47
-
48
- end
49
-
50
- end
1
+ require 'cxxproject/toolchain/colorizing_formatter'
2
+
3
+ module Cxxproject
4
+
5
+ class Printer
6
+ @@cf = ColorizingFormatter.new
7
+
8
+ def self.printInfo(str)
9
+ if @@cf.enabled?
10
+ puts @@cf.printInfo(str)
11
+ else
12
+ puts str
13
+ end
14
+ end
15
+
16
+ def self.printAdditionalInfo(str)
17
+ if @@cf.enabled?
18
+ puts @@cf.printAdditionalInfo(str)
19
+ else
20
+ puts str
21
+ end
22
+ end
23
+
24
+ def self.printWarning(str)
25
+ if @@cf.enabled?
26
+ puts @@cf.printWarning(str)
27
+ else
28
+ puts str
29
+ end
30
+ end
31
+
32
+ def self.printError(str)
33
+ if @@cf.enabled?
34
+ puts @@cf.printError(str)
35
+ else
36
+ puts str
37
+ end
38
+ end
39
+
40
+ def self.printSuccess(str)
41
+ if @@cf.enabled?
42
+ puts @@cf.printSuccess(str)
43
+ else
44
+ puts str
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -1,53 +1,53 @@
1
- module Cxxproject
2
-
3
- class ProcessHelper
4
- @@pid = nil
5
-
6
- def self.readOutput(sp, rd, wr)
7
- wr.close
8
-
9
- consoleOutput = ""
10
- begin
11
- while not rd.eof?
12
- tmp = rd.read(1000)
13
- if (tmp != nil)
14
- consoleOutput << tmp
15
- end
16
- end
17
- rescue Exception=>e
18
- # Seems to be a bug in ruby: sometimes there is a bad file descriptor on Windows instead of eof, which causes
19
- # an exception on read(). However, this happens not before everything is read, so there is no practical difference
20
- # how to "break" the loop.
21
- # This problem occurs on Windows command shell and Cygwin.
22
- end
23
-
24
- Process.wait(sp)
25
- rd.close
26
-
27
- # seems that pipe cannot handle non-ascii characters right on windows (even with correct encoding)
28
- consoleOutput.gsub!(/\xE2\x80\x98/,"`") # ���
29
- consoleOutput.gsub!(/\xE2\x80\x99/,"'") # ���
30
-
31
- consoleOutput
32
- end
33
-
34
- def self.spawnProcess(cmdLine)
35
- return system cmdLine if Cxxproject::Utils.old_ruby?
36
-
37
- @@pid = spawn(cmdLine)
38
- pid, status = Process.wait2(@@pid)
39
- @@pid = nil
40
- status.success?
41
- end
42
-
43
- def self.killProcess
44
- begin
45
- Process.kill("KILL",@@pid)
46
- rescue
47
- end
48
- @@pid = nil
49
- end
50
-
51
- end
52
-
1
+ module Cxxproject
2
+
3
+ class ProcessHelper
4
+ @@pid = nil
5
+
6
+ def self.readOutput(sp, rd, wr)
7
+ wr.close
8
+
9
+ consoleOutput = ""
10
+ begin
11
+ while not rd.eof?
12
+ tmp = rd.read(1000)
13
+ if (tmp != nil)
14
+ consoleOutput << tmp
15
+ end
16
+ end
17
+ rescue Exception=>e
18
+ # Seems to be a bug in ruby: sometimes there is a bad file descriptor on Windows instead of eof, which causes
19
+ # an exception on read(). However, this happens not before everything is read, so there is no practical difference
20
+ # how to "break" the loop.
21
+ # This problem occurs on Windows command shell and Cygwin.
22
+ end
23
+
24
+ Process.wait(sp)
25
+ rd.close
26
+
27
+ # seems that pipe cannot handle non-ascii characters right on windows (even with correct encoding)
28
+ consoleOutput.gsub!(/\xE2\x80\x98/,"`") # ���
29
+ consoleOutput.gsub!(/\xE2\x80\x99/,"'") # ���
30
+
31
+ consoleOutput
32
+ end
33
+
34
+ def self.spawnProcess(cmdLine)
35
+ return system(cmdLine) if Cxxproject::Utils.old_ruby?
36
+
37
+ @@pid = spawn(cmdLine)
38
+ pid, status = Process.wait2(@@pid)
39
+ @@pid = nil
40
+ status.success?
41
+ end
42
+
43
+ def self.killProcess
44
+ begin
45
+ Process.kill("KILL",@@pid)
46
+ rescue
47
+ end
48
+ @@pid = nil
49
+ end
50
+
51
+ end
52
+
53
53
  end
@@ -1,66 +1,66 @@
1
- module Cxxproject
2
- module Utils
3
- define_progress = lambda do
4
- require 'rake'
5
- require 'cxxproject/ext/rake'
6
-
7
- require 'progressbar'
8
- require 'cxxproject/ext/progressbar'
9
- require 'colored'
10
- require 'cxxproject/utils/progress_helper'
11
-
12
- class ProgressListener
13
- def initialize
14
- @progress_helper = ProgressHelper.new
15
- Rake::application.top_level_tasks.each do |name|
16
- @progress_helper.count_with_filter(name)
17
- end
18
- @progress = ProgressBar.new('all tasks', @progress_helper.todo)
19
- @progress.title_width = 30
20
- @progress.unblock
21
- end
22
-
23
- def after_execute(name)
24
- needed_tasks = @progress_helper.needed_tasks
25
- if needed_tasks[name]
26
- task = Rake::Task[name]
27
- @progress.title = task.name
28
- @progress.inc(task.progress_count)
29
- if (@progress.total == @progress.current)
30
- puts
31
- end
32
- end
33
- end
34
- end
35
-
36
- require 'benchmark'
37
- class BenchmarkedProgressListener < ProgressListener
38
- def initialize
39
- Benchmark.bm do |x|
40
- x.report('ProgressListener.initialize') do
41
- super
42
- end
43
- end
44
- end
45
- end
46
-
47
- desc 'show a progressbar for the build (use with -s for best results)'
48
- task :progress do
49
- require 'cxxproject/ext/rake_listener'
50
- Rake::add_listener(ProgressListener.new)
51
- end
52
-
53
- task :benchmark_progress do
54
- require 'cxxproject/ext/rake_listener'
55
- Rake::add_listener(BenchmarkedProgressListener.new)
56
- end
57
- end
58
-
59
- could_not_define_progress = lambda {
60
- task :progress do
61
- puts 'could not define progress'
62
- end
63
- }
64
- optional_package(define_progress, could_not_define_progress)
65
- end
66
- end
1
+ module Cxxproject
2
+ module Utils
3
+ define_progress = lambda do
4
+ require 'rake'
5
+ require 'cxxproject/ext/rake'
6
+
7
+ require 'progressbar'
8
+ require 'cxxproject/ext/progressbar'
9
+ require 'colored'
10
+ require 'cxxproject/utils/progress_helper'
11
+
12
+ class ProgressListener
13
+ def initialize
14
+ @progress_helper = ProgressHelper.new
15
+ Rake::application.top_level_tasks.each do |name|
16
+ @progress_helper.count_with_filter(name)
17
+ end
18
+ @progress = ProgressBar.new('all tasks', @progress_helper.todo)
19
+ @progress.title_width = 30
20
+ @progress.unblock
21
+ end
22
+
23
+ def after_execute(name)
24
+ needed_tasks = @progress_helper.needed_tasks
25
+ if needed_tasks[name]
26
+ task = Rake::Task[name]
27
+ @progress.title = task.name
28
+ @progress.inc(task.progress_count)
29
+ if (@progress.total == @progress.current)
30
+ puts
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ require 'benchmark'
37
+ class BenchmarkedProgressListener < ProgressListener
38
+ def initialize
39
+ Benchmark.bm do |x|
40
+ x.report('ProgressListener.initialize') do
41
+ super
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ desc 'show a progressbar for the build (use with -s for best results)'
48
+ task :progress do
49
+ require 'cxxproject/ext/rake_listener'
50
+ Rake::add_listener(ProgressListener.new)
51
+ end
52
+
53
+ task :benchmark_progress do
54
+ require 'cxxproject/ext/rake_listener'
55
+ Rake::add_listener(BenchmarkedProgressListener.new)
56
+ end
57
+ end
58
+
59
+ could_not_define_progress = lambda {
60
+ task :progress do
61
+ puts 'could not define progress'
62
+ end
63
+ }
64
+ optional_package(define_progress, could_not_define_progress)
65
+ end
66
+ end
@@ -1,77 +1,77 @@
1
- module Cxxproject
2
- module Utils
3
- class ProgressHelper
4
-
5
- attr_reader :todo
6
-
7
- attr_reader :needed_tasks
8
-
9
- def initialize
10
- @todo = 0.0
11
- @needed_tasks = {}
12
- end
13
-
14
- def count_with_filter(name)
15
- tasks = find_tasks_for_toplevel_task(name)
16
- tasks.each do |t|
17
- count(t)
18
- end
19
- if @todo < 1
20
- @todo = 1
21
- end
22
- end
23
-
24
- def find_tasks_for_toplevel_task(name)
25
- regex = create_regex_for_name(name)
26
- return filter_all_tasks(regex)
27
- end
28
-
29
- def create_regex_for_name(name)
30
- res = Regexp.new(name)
31
- res = create_regex_for_filter(name, res)
32
- return res
33
- end
34
-
35
- def is_filter(name)
36
- return name.index('filter')
37
- end
38
-
39
- def create_regex_for_filter(name, res)
40
- return res unless is_filter(name)
41
-
42
- name = name.gsub('filter', '')
43
- if name.index('[') == nil
44
- name = name + '.*'
45
- else
46
- name = name.gsub('[', '')
47
- name = name.gsub(']', '')
48
- end
49
- return Regexp.new(name)
50
- end
51
-
52
- def filter_all_tasks(regex)
53
- return Rake::Task::tasks.find_all do |t|
54
- task_name = t.name
55
- res = ((task_name.index('filter') == nil) && regex.match(task_name)!=nil)
56
- end
57
- end
58
-
59
- def count(task)
60
- task.visit() do |t|
61
- count_needed_tasks(t)
62
- true
63
- end
64
- end
65
-
66
- def count_needed_tasks(t)
67
- c = t.progress_count
68
- if c && c > 0
69
- if t.needed? && @needed_tasks[t.name] == nil
70
- @needed_tasks[t.name] = true
71
- @todo += c
72
- end
73
- end
74
- end
75
- end
76
- end
77
- end
1
+ module Cxxproject
2
+ module Utils
3
+ class ProgressHelper
4
+
5
+ attr_reader :todo
6
+
7
+ attr_reader :needed_tasks
8
+
9
+ def initialize
10
+ @todo = 0.0
11
+ @needed_tasks = {}
12
+ end
13
+
14
+ def count_with_filter(name)
15
+ tasks = find_tasks_for_toplevel_task(name)
16
+ tasks.each do |t|
17
+ count(t)
18
+ end
19
+ if @todo < 1
20
+ @todo = 1
21
+ end
22
+ end
23
+
24
+ def find_tasks_for_toplevel_task(name)
25
+ regex = create_regex_for_name(name)
26
+ return filter_all_tasks(regex)
27
+ end
28
+
29
+ def create_regex_for_name(name)
30
+ res = Regexp.new(name)
31
+ res = create_regex_for_filter(name, res)
32
+ return res
33
+ end
34
+
35
+ def is_filter(name)
36
+ return name.index('filter')
37
+ end
38
+
39
+ def create_regex_for_filter(name, res)
40
+ return res unless is_filter(name)
41
+
42
+ name = name.gsub('filter', '')
43
+ if name.index('[') == nil
44
+ name = name + '.*'
45
+ else
46
+ name = name.gsub('[', '')
47
+ name = name.gsub(']', '')
48
+ end
49
+ return Regexp.new(name)
50
+ end
51
+
52
+ def filter_all_tasks(regex)
53
+ return Rake::Task::tasks.find_all do |t|
54
+ task_name = t.name
55
+ res = ((task_name.index('filter') == nil) && regex.match(task_name)!=nil)
56
+ end
57
+ end
58
+
59
+ def count(task)
60
+ task.visit() do |t|
61
+ count_needed_tasks(t)
62
+ true
63
+ end
64
+ end
65
+
66
+ def count_needed_tasks(t)
67
+ c = t.progress_count
68
+ if c && c > 0
69
+ if t.needed? && @needed_tasks[t.name] == nil
70
+ @needed_tasks[t.name] = true
71
+ @todo += c
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end