cxxproject_clangtoolchain 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ require 'cxxproject/errorparser/error_parser'
2
+
3
+ module Cxxproject
4
+ class ClangCompilerErrorParser < 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 ClangLinkerErrorParser < 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
@@ -0,0 +1,46 @@
1
+
2
+ cxx_plugin do |cxx,bbs,log|
3
+
4
+ require 'errorparser/clang_compiler_error_parser'
5
+ toolchain "clang",
6
+ :COMPILER =>
7
+ {
8
+ :CPP =>
9
+ {
10
+ :COMMAND => "clang++",
11
+ :DEFINE_FLAG => "-D",
12
+ :OBJECT_FILE_FLAG => "-o",
13
+ :INCLUDE_PATH_FLAG => "-I",
14
+ :COMPILE_FLAGS => "-c ",
15
+ :DEP_FLAGS => "-MMD -MF ", # empty space at the end is important!
16
+ :ERROR_PARSER => ClangCompilerErrorParser.new
17
+ },
18
+ :C =>
19
+ {
20
+ :BASED_ON => :CPP,
21
+ :COMMAND => "clang",
22
+ :COMPILE_FLAGS => "-c ",
23
+ :DEP_FLAGS => "-MMD -MF ", # empty space at the end is important!
24
+ :ERROR_PARSER => ClangCompilerErrorParser.new
25
+ },
26
+ :ASM =>
27
+ {
28
+ :BASED_ON => :C,
29
+ }
30
+ },
31
+ :LINKER =>
32
+ {
33
+ :COMMAND => "clang++",
34
+ :SCRIPT => "-T",
35
+ :USER_LIB_FLAG => "-l:",
36
+ :EXE_FLAG => "-o",
37
+ :LIB_FLAG => "-l",
38
+ :LIB_PATH_FLAG => "-L"
39
+ },
40
+ :ARCHIVER =>
41
+ {
42
+ :COMMAND => "ar",
43
+ :ARCHIVE_FLAGS => "r"
44
+ }
45
+
46
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cxxproject_clangtoolchain
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.1
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: " Toolchain supporting clang\n"
27
+ email: oliver.mueller@gmail.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/errorparser/clang_linker_error_parser.rb
36
+ - lib/errorparser/clang_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 clang.
65
+ test_files: []
66
+