cxxproject 0.5.47 → 0.5.48

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile.rb CHANGED
@@ -52,7 +52,7 @@ begin
52
52
  puts 'please gem install roodi'
53
53
  end
54
54
  rescue LoadError => e
55
- puts "please missing gems #{e}"
55
+ puts "please missing gems #{e}"
56
56
  end
57
57
 
58
58
  def two_digits(x)
@@ -67,7 +67,7 @@ begin
67
67
  require 'grit'
68
68
  include Grit
69
69
 
70
- def git_history
70
+ def git_history
71
71
  repo = Repo.new('.')
72
72
  tag_names = repo.tags.collect {|t| t.name }
73
73
  relevant_tags = repo.tags.reject {|t| !t.name.start_with?("v_")}
@@ -83,7 +83,7 @@ begin
83
83
  change_text << "#{a.name} => #{b.name}"
84
84
  change_text << ""
85
85
  cs = repo.commits_between(a.commit, b.commit)
86
- cm = cs.each do |c|
86
+ cm = cs.each do |c|
87
87
  change_lines = c.message.lines.to_a
88
88
  first = change_lines.first
89
89
  change_text << " * " + first + "#{change_lines[1..-1].collect {|l| " #{l}"}.join("")}"
@@ -91,7 +91,7 @@ begin
91
91
  end
92
92
  change_text
93
93
  end
94
-
94
+
95
95
  desc 'generate version history'
96
96
  task :generate_history do
97
97
  puts git_history
@@ -25,7 +25,7 @@ module Cxxproject
25
25
  @mapfile = x
26
26
  self
27
27
  end
28
-
28
+
29
29
  def initialize(name)
30
30
  super(name)
31
31
  @linker_script = nil
@@ -85,14 +85,14 @@ module Cxxproject
85
85
 
86
86
  def calc_linker_lib_string_recursive(d)
87
87
  res = []
88
-
88
+
89
89
  return res if @dep_set.include?d
90
90
  @dep_set << d
91
-
91
+
92
92
  if HasLibraries === d
93
93
  prefix = nil
94
94
  linker = @tcs[:LINKER]
95
-
95
+
96
96
  d.lib_elements.each do |elem|
97
97
  case elem[0]
98
98
  when HasLibraries::LIB
@@ -116,7 +116,7 @@ module Cxxproject
116
116
  end
117
117
  end
118
118
  end
119
-
119
+
120
120
  res
121
121
  end
122
122
 
@@ -145,7 +145,7 @@ module Cxxproject
145
145
 
146
146
  mapfileStr = @mapfile ? " >#{@mapfile}" : ""
147
147
  if Cxxproject::Utils.old_ruby?
148
- cmd.map! {|c| ((c.include?" ") ? ("\""+c+"\"") : c )}
148
+ cmd.map! {|c| ((c.include?(" ")) ? ("\""+c+"\"") : c )}
149
149
 
150
150
  # TempFile used, because some compilers, e.g. diab, uses ">" for piping to map files:
151
151
  cmdLine = cmd.join(" ") + " 2>" + get_temp_filename
@@ -157,7 +157,7 @@ module Cxxproject
157
157
  else
158
158
  consoleOutput = `#{cmd.join(" ") + mapfileStr + " 2>" + get_temp_filename}`
159
159
  end
160
- consoleOutput.concat(read_file_or_empty_string(get_temp_filename))
160
+ consoleOutput.concat(read_file_or_empty_string(get_temp_filename))
161
161
  else
162
162
  rd, wr = IO.pipe
163
163
  cmd << {
@@ -171,9 +171,9 @@ module Cxxproject
171
171
  cmd << " >#{@mapfile}" if @mapfile
172
172
  consoleOutput = ProcessHelper.readOutput(sp, rd, wr)
173
173
  end
174
-
174
+
175
175
  process_result(cmd, consoleOutput, linker[:ERROR_PARSER], "Linking #{get_executable_name}")
176
-
176
+
177
177
  check_config_file()
178
178
  end
179
179
  end
@@ -183,7 +183,7 @@ module Cxxproject
183
183
  add_output_dir_dependency(get_task_name, res, true)
184
184
  add_grouping_tasks(get_task_name)
185
185
  setup_rake_dependencies(res, object_multitask)
186
-
186
+
187
187
  # check that all source libs are checked even if they are not a real rake dependency (can happen if "build this project only")
188
188
  begin
189
189
  libChecker = task get_task_name+"LibChecker" do
@@ -209,7 +209,6 @@ module Cxxproject
209
209
  libChecker.transparent_timestamp = true
210
210
  res.enhance([libChecker])
211
211
 
212
-
213
212
  return res
214
213
  end
215
214
 
@@ -225,15 +224,21 @@ module Cxxproject
225
224
  namespace 'run' do
226
225
  desc "run executable #{executable}"
227
226
  res = task name => executable do |t|
228
- run_command(t, executable)
227
+ sh executable
229
228
  end
230
229
  res.type = Rake::Task::RUN
231
230
  res
232
231
  end
233
- end
234
-
235
- def run_command(task, command)
236
- sh "#{command}"
232
+ if Valgrind::available?
233
+ namespace 'valgrind' do
234
+ desc "run executable #{executable} with valgrind"
235
+ res = task name => executable do |t|
236
+ sh "valgrind #{executable}"
237
+ end
238
+ res.type = Rake::Task::RUN
239
+ res
240
+ end
241
+ end
237
242
  end
238
243
 
239
244
  def get_temp_filename
@@ -12,6 +12,7 @@ require 'cxxproject/buildingblocks/custom_building_block'
12
12
  require 'cxxproject/buildingblocks/command_line'
13
13
  require 'cxxproject/toolchain/colorizing_formatter'
14
14
  require 'cxxproject/eval_context'
15
+ require 'cxxproject/utils/valgrind'
15
16
 
16
17
  module Cxxproject
17
18
  class CxxProject2Rake
@@ -30,7 +31,7 @@ module Cxxproject
30
31
  toolchain[:LINKER][:LIB_PREFIX_FLAGS] = "-Wl,--whole-archive"
31
32
  toolchain[:LINKER][:LIB_POSTFIX_FLAGS] = "-Wl,--no-whole-archive"
32
33
  end
33
-
34
+
34
35
  Rake::application.deriveIncludes = true
35
36
 
36
37
  initialize_logging
@@ -93,7 +94,12 @@ module Cxxproject
93
94
  end
94
95
 
95
96
  def create_generic_tasks
96
- [:lib, :exe, :run, nil].each { |i| create_filter_task_with_namespace(i) }
97
+ tasks = [:lib, :exe, :run]
98
+ if Cxxproject::Valgrind::available?
99
+ tasks << :valgrind
100
+ end
101
+ tasks << nil
102
+ tasks.each { |i| create_filter_task_with_namespace(i) }
97
103
  end
98
104
 
99
105
  def create_filter_task_with_namespace(basename)
@@ -0,0 +1,11 @@
1
+ module Cxxproject
2
+ class Valgrind
3
+ @@valgrind_available = nil
4
+ def self.available?
5
+ if @@valgrind_available == nil
6
+ @@valgrind_available = `which valgrind`.strip.length > 0
7
+ end
8
+ return @@valgrind_available
9
+ end
10
+ end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Cxxproject
2
2
  class Version
3
3
  def self.cxxproject
4
- "0.5.47"
4
+ "0.5.48"
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.47
5
+ version: 0.5.48
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: 2011-12-13 00:00:00 Z
13
+ date: 2011-12-16 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -67,6 +67,7 @@ files:
67
67
  - lib/cxxproject/utils/graphstream.rb
68
68
  - lib/cxxproject/utils/progress.rb
69
69
  - lib/cxxproject/utils/rbcurse_executable_ext.rb
70
+ - lib/cxxproject/utils/valgrind.rb
70
71
  - lib/cxxproject/utils/progress_helper.rb
71
72
  - lib/cxxproject/utils/stats.rb
72
73
  - lib/cxxproject/utils/optional.rb
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  requirements: []
158
159
 
159
160
  rubyforge_project:
160
- rubygems_version: 1.8.12
161
+ rubygems_version: 1.8.10
161
162
  signing_key:
162
163
  specification_version: 3
163
164
  summary: Cpp Support for Rake.