cxxproject 0.5.48 → 0.5.59

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.
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,40 +1,40 @@
1
- require 'cxxproject/errorparser/error_parser'
2
-
3
- module Cxxproject
4
- class DiabCompilerErrorParser < ErrorParser
5
-
6
- def initialize()
7
- @error_expression_start = /\"(.+)\", line ([0-9]+): (catastrophic |fatal )*([A-Za-z]+) (.+)/
8
- @error_expression_end = /^[ \t]*\^/ # well, it may end without "^"... in this case the error will last the next one starts or console text ends
9
- end
10
-
11
- def scan_lines(consoleOutput, proj_dir)
12
- res = []
13
- error_severity = 255
14
- consoleOutputFullnames = ""
15
- consoleOutput.each_line do |l|
16
- d = ErrorDesc.new
17
- lstripped = l.rstrip
18
- scan_res = lstripped.scan(@error_expression_start)
19
- if scan_res.length == 0
20
- d.severity = error_severity
21
- d.message = lstripped
22
- if lstripped.scan(@error_expression_end).length > 0
23
- error_severity = 255
24
- end
25
- else
26
- d.file_name = File.expand_path(scan_res[0][0])
27
- d.line_number = scan_res[0][1].to_i
28
- d.message = scan_res[0][4]
29
- d.severity = get_severity(scan_res[0][3])
30
- error_severity = d.severity
31
- l.gsub!(scan_res[0][0],d.file_name)
32
- end
33
- res << d
34
- consoleOutputFullnames << l
35
- end
36
- [res, consoleOutputFullnames]
37
- end
38
-
39
- end
40
- end
1
+ require 'cxxproject/errorparser/error_parser'
2
+
3
+ module Cxxproject
4
+ class DiabCompilerErrorParser < ErrorParser
5
+
6
+ def initialize()
7
+ @error_expression_start = /\"(.+)\", line ([0-9]+): (?!included)(catastrophic |fatal )*([A-Za-z]+)[:]* (.+)/
8
+ @error_expression_end = /^[ \t]*\^/ # well, it may end without "^"... in this case the error will last the next one starts or console text ends
9
+ end
10
+
11
+ def scan_lines(consoleOutput, proj_dir)
12
+ res = []
13
+ error_severity = 255
14
+ consoleOutputFullnames = ""
15
+ consoleOutput.each_line do |l|
16
+ d = ErrorDesc.new
17
+ lstripped = l.rstrip
18
+ scan_res = lstripped.scan(@error_expression_start)
19
+ if scan_res.length == 0
20
+ d.severity = error_severity
21
+ d.message = lstripped
22
+ if lstripped.scan(@error_expression_end).length > 0
23
+ error_severity = 255
24
+ end
25
+ else
26
+ d.file_name = File.expand_path(scan_res[0][0])
27
+ d.line_number = scan_res[0][1].to_i
28
+ d.message = scan_res[0][4]
29
+ d.severity = get_severity(scan_res[0][3])
30
+ error_severity = d.severity
31
+ l.gsub!(scan_res[0][0],d.file_name)
32
+ end
33
+ res << d
34
+ consoleOutputFullnames << l
35
+ end
36
+ [res, consoleOutputFullnames]
37
+ end
38
+
39
+ end
40
+ end
@@ -1,33 +1,41 @@
1
- require 'cxxproject/errorparser/error_parser'
2
-
3
- module Cxxproject
4
- class DiabLinkerErrorParser < ErrorParser
5
-
6
- def initialize()
7
- @error_expression = /dld: ([A-Za-z]+): (.+)/
8
- end
9
-
10
- def scan_lines(consoleOutput, proj_dir)
11
- res = []
12
- error_severity = 255
13
- consoleOutput.each_line do |l|
14
- l.rstrip!
15
- d = ErrorDesc.new
16
- scan_res = l.scan(@error_expression)
17
- if scan_res.length == 0 # msg will end with the beginning of the next message
18
- d.severity = error_severity
19
- d.message = l
20
- else
21
- d.file_name = proj_dir
22
- d.line_number = 0
23
- d.message = scan_res[0][1]
24
- d.severity = get_severity(scan_res[0][0])
25
- error_severity = d.severity
26
- end
27
- res << d
28
- end
29
- [res, consoleOutput]
30
- end
31
-
32
- end
33
- end
1
+ require 'cxxproject/errorparser/error_parser'
2
+
3
+ module Cxxproject
4
+ class DiabLinkerErrorParser < ErrorParser
5
+
6
+ def initialize()
7
+ @error_expression = /dld: ([A-Za-z]+): (.+)/
8
+ @error_expression_linkerscript = /dld: \"([^\"]+)\", line ([0-9]+): (.+)/
9
+ end
10
+
11
+ def scan_lines(consoleOutput, proj_dir)
12
+ res = []
13
+ error_severity = 255
14
+ consoleOutput.each_line do |l|
15
+ l.rstrip!
16
+ d = ErrorDesc.new
17
+ scan_res = l.scan(@error_expression)
18
+ scan_res2 = l.scan(@error_expression_linkerscript)
19
+ if scan_res.length == 0 and scan_res2.length == 0 # msg will end with the beginning of the next message
20
+ d.severity = error_severity
21
+ d.message = l
22
+ elsif scan_res.length > 0
23
+ d.file_name = proj_dir
24
+ d.line_number = 0
25
+ d.message = scan_res[0][1]
26
+ d.severity = get_severity(scan_res[0][0])
27
+ error_severity = d.severity
28
+ else
29
+ d.file_name = proj_dir+"/"+scan_res2[0][0]
30
+ d.line_number = scan_res2[0][1].to_i
31
+ d.message = scan_res2[0][2]
32
+ d.severity = SEVERITY_ERROR
33
+ error_severity = d.severity
34
+ end
35
+ res << d
36
+ end
37
+ [res, consoleOutput]
38
+ end
39
+
40
+ end
41
+ end
@@ -1,50 +1,50 @@
1
- module Cxxproject
2
-
3
- class ErrorDesc
4
- def initialize
5
- @severity = 255
6
- end
7
- attr_accessor :severity
8
- attr_accessor :line_number
9
- attr_accessor :message
10
- attr_accessor :file_name
11
- end
12
-
13
- class ErrorParser
14
-
15
- SEVERITY_INFO = 0
16
- SEVERITY_WARNING = 1
17
- SEVERITY_ERROR = 2
18
- SEVERITY_OK = 255
19
-
20
- def scan(consoleOutput, proj_dir)
21
- raise "Use specialized classes only"
22
- end
23
-
24
- def get_severity(str)
25
- if str == "info" || str == "note"
26
- SEVERITY_INFO
27
- elsif str == "warning"
28
- SEVERITY_WARNING
29
- elsif str == "error"
30
- SEVERITY_ERROR
31
- else
32
- raise "Unknown severity: #{str}"
33
- end
34
- end
35
-
36
- # scan the output from the console line by line and return a list of ErrorDesc objects.
37
- # for none-error/warning lines the description object will indicate that as severity 255
38
- # for single line errors/warnings: description will contain severity, line-number, message and file-name
39
- #
40
- # for multi-line errors/warnings:
41
- # one description object for each line, first one will contain all single line error information,
42
- # all following desc.objects will just repeat the severity and include the message
43
- #
44
- def scan_lines(consoleOutput, proj_dir)
45
- raise "Use specialized classes only"
46
- end
47
-
48
-
49
- end
50
- end
1
+ module Cxxproject
2
+
3
+ class ErrorDesc
4
+ def initialize
5
+ @severity = 255
6
+ end
7
+ attr_accessor :severity
8
+ attr_accessor :line_number
9
+ attr_accessor :message
10
+ attr_accessor :file_name
11
+ end
12
+
13
+ class ErrorParser
14
+
15
+ SEVERITY_INFO = 0
16
+ SEVERITY_WARNING = 1
17
+ SEVERITY_ERROR = 2
18
+ SEVERITY_OK = 255
19
+
20
+ def scan(consoleOutput, proj_dir)
21
+ raise "Use specialized classes only"
22
+ end
23
+
24
+ def get_severity(str)
25
+ if str == "info" || str == "note"
26
+ SEVERITY_INFO
27
+ elsif str == "warning"
28
+ SEVERITY_WARNING
29
+ elsif str == "error"
30
+ SEVERITY_ERROR
31
+ else
32
+ raise "Unknown severity: #{str}"
33
+ end
34
+ end
35
+
36
+ # scan the output from the console line by line and return a list of ErrorDesc objects.
37
+ # for none-error/warning lines the description object will indicate that as severity 255
38
+ # for single line errors/warnings: description will contain severity, line-number, message and file-name
39
+ #
40
+ # for multi-line errors/warnings:
41
+ # one description object for each line, first one will contain all single line error information,
42
+ # all following desc.objects will just repeat the severity and include the message
43
+ #
44
+ def scan_lines(consoleOutput, proj_dir)
45
+ raise "Use specialized classes only"
46
+ end
47
+
48
+
49
+ end
50
+ end
@@ -1,30 +1,35 @@
1
- require 'cxxproject/errorparser/error_parser'
2
-
3
- module Cxxproject
4
- class GCCCompilerErrorParser < ErrorParser
5
-
6
- def initialize()
7
- @error_expression = /([^:]+):([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 GCCCompilerErrorParser < ErrorParser
5
+
6
+ def initialize()
7
+ @error_expression = /([^:]+):([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
+ if (scan_res[0][3].include?".")
21
+ d.severity = SEVERITY_ERROR
22
+ d.message = scan_res[0][3] + ": " + d.message
23
+ else
24
+ d.severity = get_severity(scan_res[0][3])
25
+ end
26
+ l.gsub!(scan_res[0][0],d.file_name)
27
+ end
28
+ res << d
29
+ consoleOutputFullnames << l
30
+ end
31
+ [res, consoleOutputFullnames]
32
+ end
33
+
34
+ end
35
+ end
@@ -1,29 +1,35 @@
1
- require 'cxxproject/errorparser/error_parser'
2
-
3
- module Cxxproject
4
- class GCCLinkerErrorParser < 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
- d.file_name = proj_dir
19
- d.line_number = 0
20
- d.message = l
21
- d.severity = SEVERITY_ERROR
22
- res << d
23
- end
24
- [res, consoleOutput]
25
- end
26
-
27
-
28
- end
29
- end
1
+ require 'cxxproject/errorparser/error_parser'
2
+
3
+ module Cxxproject
4
+ class GCCLinkerErrorParser < 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
+ d.file_name = proj_dir
19
+ d.line_number = 0
20
+ d.message = l
21
+ if l.length == 0
22
+ d.severity = SEVERITY_OK
23
+ elsif l.include?" Warning:"
24
+ d.severity = SEVERITY_WARNING
25
+ else
26
+ d.severity = SEVERITY_ERROR
27
+ end
28
+ res << d
29
+ end
30
+ [res, consoleOutput]
31
+ end
32
+
33
+
34
+ end
35
+ end
@@ -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