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.
- data/Rakefile.rb +116 -116
- data/bin/cxx +10 -10
- data/lib/cxxproject.rb +23 -23
- data/lib/cxxproject/buildingblocks/binary_library.rb +39 -39
- data/lib/cxxproject/buildingblocks/building_block.rb +251 -239
- data/lib/cxxproject/buildingblocks/command_line.rb +79 -79
- data/lib/cxxproject/buildingblocks/custom_building_block.rb +39 -41
- data/lib/cxxproject/buildingblocks/executable.rb +257 -249
- data/lib/cxxproject/buildingblocks/has_dependencies_mixin.rb +83 -83
- data/lib/cxxproject/buildingblocks/has_includes_mixin.rb +20 -20
- data/lib/cxxproject/buildingblocks/has_libraries_mixin.rb +34 -34
- data/lib/cxxproject/buildingblocks/has_sources_mixin.rb +371 -364
- data/lib/cxxproject/buildingblocks/makefile.rb +153 -153
- data/lib/cxxproject/buildingblocks/module.rb +35 -35
- data/lib/cxxproject/buildingblocks/single_source.rb +33 -33
- data/lib/cxxproject/buildingblocks/source_library.rb +124 -124
- data/lib/cxxproject/errorparser/diab_compiler_error_parser.rb +40 -40
- data/lib/cxxproject/errorparser/diab_linker_error_parser.rb +41 -33
- data/lib/cxxproject/errorparser/error_parser.rb +50 -50
- data/lib/cxxproject/errorparser/gcc_compiler_error_parser.rb +35 -30
- data/lib/cxxproject/errorparser/gcc_linker_error_parser.rb +35 -29
- data/lib/cxxproject/errorparser/ti_compiler_error_parser.rb +30 -30
- data/lib/cxxproject/errorparser/ti_linker_error_parser.rb +30 -29
- data/lib/cxxproject/eval_context.rb +144 -136
- data/lib/cxxproject/ext/file.rb +71 -71
- data/lib/cxxproject/ext/filelist.rb +6 -6
- data/lib/cxxproject/ext/progressbar.rb +20 -20
- data/lib/cxxproject/ext/rake.rb +419 -397
- data/lib/cxxproject/ext/rake_dirty.rb +30 -30
- data/lib/cxxproject/ext/rake_listener.rb +59 -59
- data/lib/cxxproject/ext/stdout.rb +44 -44
- data/lib/cxxproject/ext/string.rb +9 -9
- data/lib/cxxproject/ide_interface.rb +187 -181
- data/lib/cxxproject/toolchain/clang.rb +39 -39
- data/lib/cxxproject/toolchain/colorizing_formatter.rb +99 -99
- data/lib/cxxproject/toolchain/diab.rb +3 -1
- data/lib/cxxproject/toolchain/gcc.rb +2 -1
- data/lib/cxxproject/toolchain/provider.rb +131 -128
- data/lib/cxxproject/toolchain/toolchain.rb +38 -38
- data/lib/cxxproject/toolchain/toolchain_benchmark.rb +23 -23
- data/lib/cxxproject/torake.rb +218 -216
- data/lib/cxxproject/utils/cleanup.rb +20 -20
- data/lib/cxxproject/utils/console.rb +6 -6
- data/lib/cxxproject/utils/exit_helper.rb +40 -40
- data/lib/cxxproject/utils/graphstream.rb +154 -154
- data/lib/cxxproject/utils/optional.rb +16 -16
- data/lib/cxxproject/utils/printer.rb +50 -50
- data/lib/cxxproject/utils/process.rb +52 -52
- data/lib/cxxproject/utils/progress.rb +66 -66
- data/lib/cxxproject/utils/progress_helper.rb +77 -77
- data/lib/cxxproject/utils/rbcurse.rb +284 -284
- data/lib/cxxproject/utils/rbcurse_executable_ext.rb +14 -14
- data/lib/cxxproject/utils/rbcurse_progress.rb +71 -71
- data/lib/cxxproject/utils/rbcurse_tasktable.rb +51 -51
- data/lib/cxxproject/utils/stats.rb +60 -60
- data/lib/cxxproject/utils/ubigraph.rb +228 -228
- data/lib/cxxproject/utils/utils.rb +60 -37
- data/lib/cxxproject/utils/valgrind.rb +11 -11
- data/lib/cxxproject/version.rb +7 -7
- data/lib/tools/Rakefile.rb.template +10 -10
- data/lib/tools/project.rb.template +6 -6
- data/lib/tools/project_wizard.rb +66 -66
- data/spec/building_block_spec.rb +56 -56
- data/spec/cxxproject_2_rake_spec.rb +186 -186
- data/spec/file_ext_spec.rb +30 -30
- data/spec/ide_interface_spec.rb +41 -41
- data/spec/object_dependency_spec.rb +83 -83
- data/spec/project_path_spec.rb +71 -71
- data/spec/rake_listener_ext_spec.rb +58 -58
- data/spec/spec_helper.rb +18 -18
- data/spec/string_spec.rb +11 -11
- data/spec/testdata/basic/exe12/project.rb +5 -5
- data/spec/testdata/basic/lib1/project.rb +5 -5
- data/spec/testdata/basic/lib2/project.rb +8 -8
- data/spec/testdata/multiple_levels/libs/lib1/project.rb +5 -5
- data/spec/testdata/multiple_levels/libs/lib2/project.rb +19 -19
- data/spec/testdata/multiple_levels/mainproject/basic/project.rb +8 -8
- data/spec/testdata/onlyOneHeader/Rakefile.rb +4 -4
- data/spec/testdata/onlyOneHeader/project.rb +4 -4
- data/spec/toolchain_spec.rb +29 -29
- metadata +58 -58
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'rake'
|
2
|
-
module Rake
|
3
|
-
class Task
|
4
|
-
# return true if this or one of the prerequisites is dirty
|
5
|
-
def dirty?
|
6
|
-
return calc_dirty_for_prerequsites if apply?(name)
|
7
|
-
|
8
|
-
if needed?
|
9
|
-
return true
|
10
|
-
end
|
11
|
-
return calc_dirty_for_prerequsites
|
12
|
-
end
|
13
|
-
|
14
|
-
def calc_dirty_for_prerequsites
|
15
|
-
res = prerequisites.find do |p|
|
16
|
-
t = Task[p]
|
17
|
-
if t != nil
|
18
|
-
if t.dirty?
|
19
|
-
true
|
20
|
-
else
|
21
|
-
false
|
22
|
-
end
|
23
|
-
else
|
24
|
-
false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
return res != nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
require 'rake'
|
2
|
+
module Rake
|
3
|
+
class Task
|
4
|
+
# return true if this or one of the prerequisites is dirty
|
5
|
+
def dirty?
|
6
|
+
return calc_dirty_for_prerequsites if apply?(name)
|
7
|
+
|
8
|
+
if needed?
|
9
|
+
return true
|
10
|
+
end
|
11
|
+
return calc_dirty_for_prerequsites
|
12
|
+
end
|
13
|
+
|
14
|
+
def calc_dirty_for_prerequsites
|
15
|
+
res = prerequisites.find do |p|
|
16
|
+
t = Task[p]
|
17
|
+
if t != nil
|
18
|
+
if t.dirty?
|
19
|
+
true
|
20
|
+
else
|
21
|
+
false
|
22
|
+
end
|
23
|
+
else
|
24
|
+
false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
return res != nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,59 +1,59 @@
|
|
1
|
-
require 'rake'
|
2
|
-
|
3
|
-
module Rake
|
4
|
-
|
5
|
-
def self.add_listener(l)
|
6
|
-
get_listener() << l
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.get_listener
|
10
|
-
@listener ||= []
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.remove_listener(l)
|
14
|
-
get_listener().delete(l)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.notify_listener(symbol, name)
|
18
|
-
Rake::get_listener().each do |l|
|
19
|
-
if l.respond_to?(symbol)
|
20
|
-
l.send(symbol, name)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class MultiTask
|
26
|
-
invoke_prerequisites_original = self.instance_method(:invoke_prerequisites)
|
27
|
-
define_method(:invoke_prerequisites) do |task_args, invocation_chain|
|
28
|
-
Rake::notify_listener(:before_prerequisites, name)
|
29
|
-
invoke_prerequisites_original.bind(self).call(task_args, invocation_chain)
|
30
|
-
Rake::notify_listener(:after_prerequisites, name)
|
31
|
-
if !needed?
|
32
|
-
Rake::notify_listener(:after_execute, name)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class Task
|
38
|
-
invoke_prerequisites_original = self.instance_method(:invoke_prerequisites)
|
39
|
-
execute_original = self.instance_method(:execute)
|
40
|
-
|
41
|
-
define_method (:invoke_prerequisites) do |task_args, invocation_chain|
|
42
|
-
Rake::notify_listener(:before_prerequisites, name)
|
43
|
-
invoke_prerequisites_original.bind(self).call(task_args, invocation_chain)
|
44
|
-
Rake::notify_listener(:after_prerequisites, name)
|
45
|
-
if !needed?
|
46
|
-
Rake::notify_listener(:after_execute, name)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
define_method(:execute) do |args|
|
51
|
-
Rake::notify_listener(:before_execute, name)
|
52
|
-
execute_original.bind(self).call(args)
|
53
|
-
Rake::notify_listener(:after_execute, name)
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
|
5
|
+
def self.add_listener(l)
|
6
|
+
get_listener() << l
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.get_listener
|
10
|
+
@listener ||= []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.remove_listener(l)
|
14
|
+
get_listener().delete(l)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.notify_listener(symbol, name)
|
18
|
+
Rake::get_listener().each do |l|
|
19
|
+
if l.respond_to?(symbol)
|
20
|
+
l.send(symbol, name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class MultiTask
|
26
|
+
invoke_prerequisites_original = self.instance_method(:invoke_prerequisites)
|
27
|
+
define_method(:invoke_prerequisites) do |task_args, invocation_chain|
|
28
|
+
Rake::notify_listener(:before_prerequisites, name)
|
29
|
+
invoke_prerequisites_original.bind(self).call(task_args, invocation_chain)
|
30
|
+
Rake::notify_listener(:after_prerequisites, name)
|
31
|
+
if !needed?
|
32
|
+
Rake::notify_listener(:after_execute, name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Task
|
38
|
+
invoke_prerequisites_original = self.instance_method(:invoke_prerequisites)
|
39
|
+
execute_original = self.instance_method(:execute)
|
40
|
+
|
41
|
+
define_method (:invoke_prerequisites) do |task_args, invocation_chain|
|
42
|
+
Rake::notify_listener(:before_prerequisites, name)
|
43
|
+
invoke_prerequisites_original.bind(self).call(task_args, invocation_chain)
|
44
|
+
Rake::notify_listener(:after_prerequisites, name)
|
45
|
+
if !needed?
|
46
|
+
Rake::notify_listener(:after_execute, name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
define_method(:execute) do |args|
|
51
|
+
Rake::notify_listener(:before_execute, name)
|
52
|
+
execute_original.bind(self).call(args)
|
53
|
+
Rake::notify_listener(:after_execute, name)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
@@ -1,44 +1,44 @@
|
|
1
|
-
require 'stringio'
|
2
|
-
|
3
|
-
class ThreadOut
|
4
|
-
|
5
|
-
def initialize(out)
|
6
|
-
@out = out
|
7
|
-
end
|
8
|
-
|
9
|
-
def write(stuff='')
|
10
|
-
if Thread.current[:stdout] then
|
11
|
-
Thread.current[:stdout].write stuff
|
12
|
-
else
|
13
|
-
@out.write stuff
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def puts(stuff='')
|
18
|
-
if Thread.current[:stdout] then
|
19
|
-
Thread.current[:stdout].puts stuff
|
20
|
-
else
|
21
|
-
@out.puts stuff
|
22
|
-
end
|
23
|
-
end
|
24
|
-
def print(stuff='')
|
25
|
-
if Thread.current[:stdout] then
|
26
|
-
Thread.current[:stdout].puts stuff
|
27
|
-
else
|
28
|
-
@out.print stuff
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def flush
|
33
|
-
if Thread.current[:stdout] then
|
34
|
-
Thread.current[:stdout].flush
|
35
|
-
else
|
36
|
-
@out.flush
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
STDOUT.sync = true
|
42
|
-
STDERR.sync = true
|
43
|
-
$stdout = ThreadOut.new(STDOUT)
|
44
|
-
$stderr = ThreadOut.new(STDERR)
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
class ThreadOut
|
4
|
+
|
5
|
+
def initialize(out)
|
6
|
+
@out = out
|
7
|
+
end
|
8
|
+
|
9
|
+
def write(stuff='')
|
10
|
+
if Thread.current[:stdout] then
|
11
|
+
Thread.current[:stdout].write stuff
|
12
|
+
else
|
13
|
+
@out.write stuff
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def puts(stuff='')
|
18
|
+
if Thread.current[:stdout] then
|
19
|
+
Thread.current[:stdout].puts stuff
|
20
|
+
else
|
21
|
+
@out.puts stuff
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def print(stuff='')
|
25
|
+
if Thread.current[:stdout] then
|
26
|
+
Thread.current[:stdout].puts stuff
|
27
|
+
else
|
28
|
+
@out.print stuff
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def flush
|
33
|
+
if Thread.current[:stdout] then
|
34
|
+
Thread.current[:stdout].flush
|
35
|
+
else
|
36
|
+
@out.flush
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
STDOUT.sync = true
|
42
|
+
STDERR.sync = true
|
43
|
+
$stdout = ThreadOut.new(STDOUT)
|
44
|
+
$stderr = ThreadOut.new(STDERR)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class String
|
2
|
-
def remove_from_start(text)
|
3
|
-
if index(text) == 0
|
4
|
-
self[text.size..-1]
|
5
|
-
else
|
6
|
-
self
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class String
|
2
|
+
def remove_from_start(text)
|
3
|
+
if index(text) == 0
|
4
|
+
self[text.size..-1]
|
5
|
+
else
|
6
|
+
self
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,181 +1,187 @@
|
|
1
|
-
require 'cxxproject/errorparser/error_parser'
|
2
|
-
require 'cxxproject/utils/printer'
|
3
|
-
require 'thread'
|
4
|
-
|
5
|
-
module Cxxproject
|
6
|
-
|
7
|
-
# header of tcp msg from lake to eclipse:
|
8
|
-
# 1 byte = type (problem = 0x01)
|
9
|
-
# 4 bytes = length of msg
|
10
|
-
|
11
|
-
# payload of problem type:
|
12
|
-
# 4 bytes = length filename
|
13
|
-
# x bytes = filename
|
14
|
-
# 4 bytes = linenumber
|
15
|
-
# 1 byte = severity (0..2)
|
16
|
-
# rest = error msg
|
17
|
-
class IDEInterface < ErrorParser
|
18
|
-
|
19
|
-
def initialize()
|
20
|
-
@socket = nil
|
21
|
-
@abort = false
|
22
|
-
@thread = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def mutex
|
26
|
-
@mutex ||= Mutex.new
|
27
|
-
end
|
28
|
-
|
29
|
-
def connect(port)
|
30
|
-
begin
|
31
|
-
@socket = TCPSocket.new('localhost', port)
|
32
|
-
|
33
|
-
@thread = Thread.new do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
packet
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
packet
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
1
|
+
require 'cxxproject/errorparser/error_parser'
|
2
|
+
require 'cxxproject/utils/printer'
|
3
|
+
require 'thread'
|
4
|
+
|
5
|
+
module Cxxproject
|
6
|
+
|
7
|
+
# header of tcp msg from lake to eclipse:
|
8
|
+
# 1 byte = type (problem = 0x01)
|
9
|
+
# 4 bytes = length of msg
|
10
|
+
|
11
|
+
# payload of problem type:
|
12
|
+
# 4 bytes = length filename
|
13
|
+
# x bytes = filename
|
14
|
+
# 4 bytes = linenumber
|
15
|
+
# 1 byte = severity (0..2)
|
16
|
+
# rest = error msg
|
17
|
+
class IDEInterface < ErrorParser
|
18
|
+
|
19
|
+
def initialize()
|
20
|
+
@socket = nil
|
21
|
+
@abort = false
|
22
|
+
@thread = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def mutex
|
26
|
+
@mutex ||= Mutex.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def connect(port)
|
30
|
+
begin
|
31
|
+
@socket = TCPSocket.new('localhost', port)
|
32
|
+
|
33
|
+
@thread = Thread.new do
|
34
|
+
while true do
|
35
|
+
begin
|
36
|
+
@socket.recv_nonblock(1)
|
37
|
+
set_abort(true)
|
38
|
+
break
|
39
|
+
rescue Errno::EWOULDBLOCK
|
40
|
+
sleep 0.1
|
41
|
+
rescue Errno::EAGAIN
|
42
|
+
sleep 0.1
|
43
|
+
rescue Exception => e
|
44
|
+
break
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue Exception => e
|
50
|
+
Printer.printError "Error: #{e.message}"
|
51
|
+
ExitHelper.exit(1)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def disconnect()
|
56
|
+
if @socket
|
57
|
+
sleep 0.1 # hack to let ruby send all data via streams before closing ... strange .. perhaps this should be synchronized!
|
58
|
+
begin
|
59
|
+
@socket.close
|
60
|
+
rescue Exception => e
|
61
|
+
Printer.printError "Error: #{e.message}"
|
62
|
+
ExitHelper.exit(1)
|
63
|
+
end
|
64
|
+
@socket = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
begin
|
68
|
+
@thread.join if @thread
|
69
|
+
rescue
|
70
|
+
end
|
71
|
+
@thread = nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def write_long(packet, l)
|
75
|
+
4.times do
|
76
|
+
packet << (l & 0xff)
|
77
|
+
l = l >> 8
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def force_encoding(s)
|
82
|
+
s.force_encoding("binary") if s.respond_to?("force_encoding") # for ruby >= 1.9
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_length_in_header(packet)
|
86
|
+
l = packet.length - 5
|
87
|
+
if packet.respond_to?("setbyte")
|
88
|
+
(1..4).each { |i| packet.setbyte(i, (l & 0xFF)); l = l >> 8 } # ruby >= 1.9
|
89
|
+
else
|
90
|
+
(1..4).each { |i| packet[i] = (l & 0xFF); l = l >> 8 } # ruby < 1.9
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def write_string(packet, s)
|
95
|
+
write_long(packet, s.length)
|
96
|
+
packet << s
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_errors(error_array)
|
100
|
+
if @socket
|
101
|
+
|
102
|
+
merged_messages = []
|
103
|
+
last_msg = nil
|
104
|
+
error_array.each do |msg|
|
105
|
+
if msg.file_name.nil?
|
106
|
+
last_msg.message += "\r\n#{msg.message}" if last_msg
|
107
|
+
else
|
108
|
+
last_msg = msg.dup
|
109
|
+
merged_messages << last_msg
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
merged_messages.each do |msg|
|
114
|
+
msg.message.rstrip!
|
115
|
+
packet = create_error_packet(msg)
|
116
|
+
begin
|
117
|
+
mutex.synchronize { @socket.write(packet) }
|
118
|
+
rescue Exception => e
|
119
|
+
Printer.printError "Error: #{e.message}"
|
120
|
+
set_abort(true)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def create_error_packet(msg)
|
128
|
+
packet = ""
|
129
|
+
[packet, msg.file_name, msg.message].each {|s|force_encoding(s)}
|
130
|
+
|
131
|
+
packet << 1 # error type
|
132
|
+
write_long(packet,0) # length (will be corrected below)
|
133
|
+
|
134
|
+
write_string(packet, msg.file_name)
|
135
|
+
write_long(packet,msg.line_number)
|
136
|
+
packet << (msg.severity & 0xFF)
|
137
|
+
packet << msg.message
|
138
|
+
|
139
|
+
set_length_in_header(packet)
|
140
|
+
packet
|
141
|
+
end
|
142
|
+
|
143
|
+
def set_build_info(name_attr, config_name_attr, num = -1)
|
144
|
+
@num = num if (num >= 0)
|
145
|
+
name = String.new(name_attr)
|
146
|
+
config_name = String.new(config_name_attr)
|
147
|
+
|
148
|
+
packet = ""
|
149
|
+
[packet, name, config_name].each {|s|force_encoding(s)}
|
150
|
+
|
151
|
+
lname = name.length
|
152
|
+
lconfig = config_name.length
|
153
|
+
lsum = 4 + lname + 4 + lconfig + 4
|
154
|
+
|
155
|
+
packet << 10 # build info type
|
156
|
+
|
157
|
+
write_long(packet, lsum)
|
158
|
+
write_long(packet, lname)
|
159
|
+
packet << name
|
160
|
+
write_long(packet, lconfig)
|
161
|
+
packet << config_name
|
162
|
+
write_long(packet, num >=0 ? num : 0)
|
163
|
+
|
164
|
+
begin
|
165
|
+
mutex.synchronize { @socket.write(packet) if @socket }
|
166
|
+
rescue Exception => e
|
167
|
+
Printer.printError "Error: #{e.message}"
|
168
|
+
set_abort(true)
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
def get_number_of_projects
|
174
|
+
@num ||= 0
|
175
|
+
end
|
176
|
+
|
177
|
+
def get_abort()
|
178
|
+
@abort
|
179
|
+
end
|
180
|
+
|
181
|
+
def set_abort(value)
|
182
|
+
@abort = value
|
183
|
+
ProcessHelper.killProcess if @abort
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|