cxxproject_gcctoolchain 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,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
+ 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
@@ -0,0 +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
+ 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
data/lib/plugin.rb ADDED
@@ -0,0 +1,51 @@
1
+ cxx_plugin do |cxx,bbs,log|
2
+
3
+ require 'errorparser/gcc_compiler_error_parser'
4
+ require 'errorparser/gcc_linker_error_parser'
5
+ gccCompilerErrorParser = GCCCompilerErrorParser.new
6
+
7
+ toolchain "gcc",
8
+ :COMPILER =>
9
+ {
10
+ :CPP =>
11
+ {
12
+ :COMMAND => "g++",
13
+ :DEFINE_FLAG => "-D",
14
+ :OBJECT_FILE_FLAG => "-o",
15
+ :INCLUDE_PATH_FLAG => "-I",
16
+ :COMPILE_FLAGS => "-c ",
17
+ :DEP_FLAGS => "-MMD -MF ", # empty space at the end is important!
18
+ :PREPRO_FLAGS => "-E -P",
19
+ :ERROR_PARSER => gccCompilerErrorParser
20
+ },
21
+ :C =>
22
+ {
23
+ :BASED_ON => :CPP,
24
+ :SOURCE_FILE_ENDINGS => [".c"],
25
+ :COMMAND => "gcc"
26
+ },
27
+ :ASM =>
28
+ {
29
+ :BASED_ON => :C,
30
+ :SOURCE_FILE_ENDINGS => [".asm", ".s", ".S"]
31
+ }
32
+ },
33
+ :LINKER =>
34
+ {
35
+ :COMMAND => "g++",
36
+ :SCRIPT => "-T",
37
+ :USER_LIB_FLAG => "-l:",
38
+ :EXE_FLAG => "-o",
39
+ :LIB_FLAG => "-l",
40
+ :LIB_PATH_FLAG => "-L",
41
+ :ERROR_PARSER => gccCompilerErrorParser
42
+ },
43
+ :ARCHIVER =>
44
+ {
45
+ :COMMAND => "ar",
46
+ :ARCHIVE_FLAGS => "rc",
47
+ :ERROR_PARSER => gccCompilerErrorParser
48
+ }
49
+
50
+ end
51
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cxxproject_gcctoolchain
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 GCC\n"
27
+ email: oliver.mueller@gmail.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/errorparser/gcc_compiler_error_parser.rb
36
+ - lib/errorparser/gcc_linker_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 gcc.
65
+ test_files: []
66
+