cxxproject 0.5.61 → 0.5.62

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.
@@ -180,8 +180,8 @@ module Cxxproject
180
180
  end
181
181
 
182
182
 
183
- def process_result(cmd, console_output, error_parser, alternate)
184
- hasError = ($?.success? == false)
183
+ def process_result(cmd, console_output, error_parser, alternate, success)
184
+ hasError = (success == false)
185
185
  if (cmd != @lastCommand) or (@printedCmdAlternate and hasError)
186
186
  printCmd(cmd, alternate, hasError)
187
187
  end
@@ -161,8 +161,10 @@ module Cxxproject
161
161
  strCmd = "#{cmd.join(" ") + mapfileStr + " 2>" + get_temp_filename}"
162
162
  end
163
163
  printCmd(cmdLinePrint, "Linking #{get_executable_name}", false)
164
- consoleOutput = `#{strCmd}`
165
- consoleOutput.concat(read_file_or_empty_string(get_temp_filename))
164
+
165
+ success, consoleOutput, exceptionThrown = ProcessHelper.safeExecute() { `#{strCmd}` }
166
+ consoleOutput.concat(read_file_or_empty_string(get_temp_filename)) unless exceptionThrown
167
+
166
168
  else
167
169
  rd, wr = IO.pipe
168
170
  cmdLinePrint = cmd
@@ -171,15 +173,15 @@ module Cxxproject
171
173
  :out=> @mapfile ? "#{@mapfile}" : wr, # > xy.map
172
174
  :err=>wr
173
175
  }
174
- sp = spawn(*cmd)
176
+
177
+ success, consoleOutput = ProcessHelper.safeExecute() { sp = spawn(*cmd); ProcessHelper.readOutput(sp, rd, wr) }
175
178
  cmd.pop
176
179
 
177
180
  # for console print
178
181
  cmd << " >#{@mapfile}" if @mapfile
179
- consoleOutput = ProcessHelper.readOutput(sp, rd, wr)
180
182
  end
181
183
 
182
- process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil)
184
+ process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, success)
183
185
 
184
186
  check_config_file()
185
187
  end
@@ -105,7 +105,7 @@ module Cxxproject
105
105
  parts << @name
106
106
  end
107
107
 
108
- parts << sourceRel.chomp(File.extname(sourceRel))
108
+ parts << sourceRel.chomp(File.extname(sourceRel)).gsub(/\.\./, "##")
109
109
  File.join(parts) + (Rake::application.preproFlags ? ".i" : ".o")
110
110
  end
111
111
 
@@ -167,26 +167,15 @@ module Cxxproject
167
167
  end
168
168
 
169
169
  def create_object_file_tasks()
170
-
171
170
  sources_to_build = {}
172
171
 
173
172
  exclude_files = Set.new
174
173
  exclude_sources.each do |p|
175
- if p.include?".."
176
- Printer.printError "Error: Exclude source file pattern '#{p}' must not include '..'"
177
- return nil
178
- end
179
-
180
174
  Dir.glob(p).each {|f| exclude_files << f}
181
175
  end
182
176
  files = Set.new # do not build the same file twice
183
177
 
184
178
  sources.each do |f|
185
- if f.include?".."
186
- Printer.printError "Error: Source file '#{f}' must not include '..'"
187
- return nil
188
- end
189
-
190
179
  next if exclude_files.include?(f)
191
180
  next if files.include?(f)
192
181
  files << f
@@ -194,11 +183,6 @@ module Cxxproject
194
183
  end
195
184
 
196
185
  source_patterns.each do |p|
197
- if p.include?".."
198
- Printer.printError "Error: Source file pattern '#{p}' must not include '..'"
199
- return nil
200
- end
201
-
202
186
  globRes = Dir.glob(p)
203
187
  if (globRes.length == 0)
204
188
  Printer.printWarning "Warning: Source file pattern '#{p}' did not match to any file"
@@ -291,9 +275,9 @@ module Cxxproject
291
275
  inputName = objectRel+".tmp"
292
276
  File.open(inputName,"wb") { |f| f.write(cmd[1..-1].join(" ")) }
293
277
  inputName = "\""+inputName+"\"" if inputName.include?" "
294
- consoleOutput = `#{compiler[:COMMAND] + " @" + inputName}`
278
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{compiler[:COMMAND] + " @" + inputName}` }
295
279
  else
296
- consoleOutput = `#{cmd.join(" ")} 2>&1`
280
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{cmd.join(" ")} 2>&1` }
297
281
  end
298
282
  else
299
283
  rd, wr = IO.pipe
@@ -301,12 +285,11 @@ module Cxxproject
301
285
  :err=>wr,
302
286
  :out=>wr
303
287
  }
304
- sp = spawn(*cmd)
288
+ success, consoleOutput = ProcessHelper.safeExecute() { sp = spawn(*cmd); ProcessHelper.readOutput(sp, rd, wr) }
305
289
  cmd.pop
306
- consoleOutput = ProcessHelper.readOutput(sp, rd, wr)
307
290
  end
308
291
 
309
- process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "Compiling #{sourceRel}")
292
+ process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "Compiling #{sourceRel}", success)
310
293
 
311
294
  convert_depfile(dep_file) if dep_file
312
295
 
@@ -84,9 +84,9 @@ module Cxxproject
84
84
  if cmdLine.length > 8000
85
85
  inputName = aname+".tmp"
86
86
  File.open(inputName,"wb") { |f| f.write(cmd[1..-1].join(" ")) }
87
- consoleOutput = `#{archiver[:COMMAND] + " @" + inputName}`
87
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{archiver[:COMMAND] + " @" + inputName}` }
88
88
  else
89
- consoleOutput = `#{cmd.join(" ")} 2>&1`
89
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{cmd.join(" ")} 2>&1` }
90
90
  end
91
91
  else
92
92
  rd, wr = IO.pipe
@@ -94,13 +94,11 @@ module Cxxproject
94
94
  :err=>wr,
95
95
  :out=>wr
96
96
  }
97
- sp = spawn(*cmd)
97
+ success, consoleOutput = ProcessHelper.safeExecute() { sp = spawn(*cmd); ProcessHelper.readOutput(sp, rd, wr) }
98
98
  cmd.pop
99
-
100
- consoleOutput = ProcessHelper.readOutput(sp, rd, wr)
101
99
  end
102
100
 
103
- process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{aname}")
101
+ process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{aname}", success)
104
102
 
105
103
  check_config_file()
106
104
  end
@@ -25,15 +25,14 @@ module Cxxproject
25
25
  rd.close
26
26
 
27
27
  # seems that pipe cannot handle non-ascii characters right on windows (even with correct encoding)
28
- consoleOutput.gsub!(/\xE2\x80\x98/,"`") # ���
29
- consoleOutput.gsub!(/\xE2\x80\x99/,"'") # ���
28
+ consoleOutput.gsub!(/\xE2\x80\x98/,"`") # ÔÇÿ
29
+ consoleOutput.gsub!(/\xE2\x80\x99/,"'") # ÔÇÖ
30
30
 
31
31
  consoleOutput
32
32
  end
33
33
 
34
34
  def self.spawnProcess(cmdLine)
35
35
  return system(cmdLine) if Cxxproject::Utils.old_ruby?
36
-
37
36
  @@pid = spawn(cmdLine)
38
37
  pid, status = Process.wait2(@@pid)
39
38
  @@pid = nil
@@ -48,6 +47,14 @@ module Cxxproject
48
47
  @@pid = nil
49
48
  end
50
49
 
50
+ def self.safeExecute
51
+ begin
52
+ consoleOutput = yield
53
+ [$?.success?, consoleOutput, false]
54
+ rescue Exception => e
55
+ [false, e.message, true]
56
+ end
57
+ end
51
58
  end
52
59
 
53
60
  end
@@ -1,7 +1,7 @@
1
1
  module Cxxproject
2
2
  class Version
3
3
  def self.cxxproject
4
- "0.5.61"
4
+ "0.5.62"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cxxproject
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.61
5
+ version: 0.5.62
6
6
  platform: ruby
7
7
  authors:
8
8
  - oliver mueller
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-01-21 00:00:00 Z
13
+ date: 2013-04-02 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline