cxxproject_diabtoolchain 0.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.
@@ -0,0 +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]+): (?!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
@@ -0,0 +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
+ @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
data/lib/plugin.rb ADDED
@@ -0,0 +1,60 @@
1
+
2
+ cxx_plugin do |cxx,bbs,log|
3
+
4
+ require 'errorparser/diab_compiler_error_parser'
5
+ require 'errorparser/diab_linker_error_parser'
6
+ diabCompilerErrorParser = DiabCompilerErrorParser.new
7
+ toolchain "diab",
8
+ :COMPILER =>
9
+ {
10
+ :C =>
11
+ {
12
+ :COMMAND => "dcc",
13
+ :FLAGS => "",
14
+ :DEFINE_FLAG => "-D",
15
+ :OBJECT_FILE_FLAG => "-o ",
16
+ :INCLUDE_PATH_FLAG => "-I",
17
+ :COMPILE_FLAGS => "-c",
18
+ :DEP_FLAGS => "-Xmake-dependency=6 -Xmake-dependency-savefile=",
19
+ :DEP_FLAGS_SPACE => false,
20
+ :PREPRO_FLAGS => "-P",
21
+ :ERROR_PARSER => diabCompilerErrorParser
22
+ },
23
+ :CPP =>
24
+ {
25
+ :BASED_ON => :C,
26
+ :COMPILE_FLAGS => "-c ",
27
+ :DEP_FLAGS => "-MMD -MF ", # empty space at the end is important!
28
+ :SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"],
29
+ :ERROR_PARSER => ClangCompilerErrorParser.new
30
+ },
31
+ :ASM =>
32
+ {
33
+ :BASED_ON => :C,
34
+ :COMMAND => "das",
35
+ :COMPILE_FLAGS => "",
36
+ :SOURCE_FILE_ENDINGS => Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS],
37
+ :PREPRO_FLAGS => ""
38
+ }
39
+ },
40
+ :LINKER =>
41
+ {
42
+ :COMMAND => "dcc",
43
+ :SCRIPT => "-Wm",
44
+ :USER_LIB_FLAG => "-l:",
45
+ :EXE_FLAG => "-o",
46
+ :LIB_FLAG => "-l",
47
+ :LIB_PATH_FLAG => "-L",
48
+ :MAP_FILE_FLAG => "-Wl,-m6", # no map file if this string is empty, otherwise -Wl,-m6>abc.map,
49
+ :OUTPUT_ENDING => ".elf",
50
+ :ERROR_PARSER => DiabLinkerErrorParser.new
51
+ },
52
+ :ARCHIVER =>
53
+ {
54
+ :COMMAND => "dar",
55
+ :ARCHIVE_FLAGS => "-rc",
56
+ :ERROR_PARSER => diabCompilerErrorParser
57
+ }
58
+
59
+ end
60
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cxxproject_diabtoolchain
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - oliver mueller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-04 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cxxproject
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.6.2
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: " Toolchain supporting diab\n"
27
+ email: oliver.mueller@gmail.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/errorparser/diab_linker_error_parser.rb
36
+ - lib/errorparser/diab_compiler_error_parser.rb
37
+ - lib/plugin.rb
38
+ homepage: https://github.com/marcmo/cxxproject
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.24
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: toolchain support for diab.
65
+ test_files: []
66
+