cxxproject 0.5.63 → 0.5.64

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.
@@ -151,7 +151,6 @@ module Cxxproject
151
151
  taskOfFile.enhance([d])
152
152
 
153
153
  if addDirToCleanTask
154
- CLOBBER.include(complete_output_dir)
155
154
  if (@output_dir_abs)
156
155
  CLEAN.include(file)
157
156
  else
@@ -166,7 +166,7 @@ module Cxxproject
166
166
  end
167
167
  end
168
168
 
169
- def create_object_file_tasks()
169
+ def calc_sources_to_build(quiet = false)
170
170
  sources_to_build = {}
171
171
 
172
172
  exclude_files = Set.new
@@ -184,8 +184,8 @@ module Cxxproject
184
184
 
185
185
  source_patterns.each do |p|
186
186
  globRes = Dir.glob(p)
187
- if (globRes.length == 0)
188
- Printer.printWarning "Warning: Source file pattern '#{p}' did not match to any file"
187
+ if (globRes.length == 0 and RakeFileUtils.verbose and not quiet)
188
+ Printer.printInfo "Info: Source file pattern '#{p}' did not match to any file"
189
189
  end
190
190
  globRes.each do |f|
191
191
  next if exclude_files.include?(f)
@@ -196,6 +196,11 @@ module Cxxproject
196
196
  sources_to_build[f] = t
197
197
  end
198
198
  end
199
+ sources_to_build
200
+ end
201
+
202
+ def create_object_file_tasks()
203
+ sources_to_build = calc_sources_to_build
199
204
 
200
205
  ordered = sources_to_build.keys.sort()
201
206
  dirs = []
@@ -50,7 +50,7 @@ module Cxxproject
50
50
  @task_name = @project_dir + "/" + @task_name unless @output_dir_abs
51
51
  @task_name
52
52
  end
53
-
53
+
54
54
  # task that will link the given object files to a static lib
55
55
  #
56
56
  def convert_to_rake()
@@ -60,52 +60,75 @@ module Cxxproject
60
60
  res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do
61
61
  dir = @project_dir
62
62
  objs = @objects
63
- aname = get_archive_name
64
-
63
+ aname = get_archive_name
64
+
65
65
  if @output_dir_abs
66
66
  dir = @output_dir
67
67
  prefix = File.rel_from_to_project(@project_dir, @output_dir)
68
68
  objs.map! { |m| m[prefix.length..-1] }
69
69
  aname = aname[prefix.length..-1]
70
70
  end
71
-
72
- Dir.chdir(dir) do
73
- FileUtils.rm(aname) if File.exists?(aname)
74
- cmd = [archiver[:COMMAND]] # ar
75
- cmd += archiver[:ARCHIVE_FLAGS].split(" ")
76
- cmd += Cxxproject::Utils::flagSplit(archiver[:FLAGS]) # --all_load
77
- cmd << aname # -o debug/x.exe
78
- cmd += objs
79
-
80
- if Cxxproject::Utils.old_ruby?
81
- cmd.map! {|c| ((c.include?" ") ? ("\""+c+"\"") : c )}
82
-
83
- cmdLine = cmd.join(" ")
84
- if cmdLine.length > 8000
85
- inputName = aname+".tmp"
86
- File.open(inputName,"wb") { |f| f.write(cmd[1..-1].join(" ")) }
87
- success, consoleOutput = ProcessHelper.safeExecute() { `#{archiver[:COMMAND] + " @" + inputName}` }
71
+
72
+ if (objs.length != 0 or not File.exist?(get_task_name))
73
+ Dir.chdir(dir) do
74
+ if File.exists?(aname)
75
+ FileUtils.rm(aname)
76
+ else
77
+ d = File.dirname(aname)
78
+ FileUtils.mkdir_p(d)
79
+ end
80
+
81
+ cmd = [archiver[:COMMAND]] # ar
82
+ cmd += archiver[:ARCHIVE_FLAGS].split(" ")
83
+ cmd += Cxxproject::Utils::flagSplit(archiver[:FLAGS]) # --all_load
84
+ cmd << aname # -o debug/x.exe
85
+ cmd += objs
86
+
87
+ if Cxxproject::Utils.old_ruby?
88
+ cmd.map! {|c| ((c.include?" ") ? ("\""+c+"\"") : c )}
89
+
90
+ cmdLine = cmd.join(" ")
91
+ if cmdLine.length > 8000
92
+ inputName = aname+".tmp"
93
+ File.open(inputName,"wb") { |f| f.write(cmd[1..-1].join(" ")) }
94
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{archiver[:COMMAND] + " @" + inputName}` }
95
+ else
96
+ success, consoleOutput = ProcessHelper.safeExecute() { `#{cmd.join(" ")} 2>&1` }
97
+ end
88
98
  else
89
- success, consoleOutput = ProcessHelper.safeExecute() { `#{cmd.join(" ")} 2>&1` }
99
+ rd, wr = IO.pipe
100
+ cmd << {
101
+ :err=>wr,
102
+ :out=>wr
103
+ }
104
+ success, consoleOutput = ProcessHelper.safeExecute() { sp = spawn(*cmd); ProcessHelper.readOutput(sp, rd, wr) }
105
+ cmd.pop
90
106
  end
91
- else
92
- rd, wr = IO.pipe
93
- cmd << {
94
- :err=>wr,
95
- :out=>wr
96
- }
97
- success, consoleOutput = ProcessHelper.safeExecute() { sp = spawn(*cmd); ProcessHelper.readOutput(sp, rd, wr) }
98
- cmd.pop
107
+
108
+ process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{aname}", success)
109
+
110
+ check_config_file()
99
111
  end
100
-
101
- process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{aname}", success)
102
-
103
- check_config_file()
104
112
  end
105
113
  end
106
114
  enhance_with_additional_files(res)
107
- add_output_dir_dependency(get_task_name, res, true)
108
-
115
+
116
+ if not Rake.application["clean"].prerequisites.include?(get_task_name+"Clean")
117
+ cleanTask = task get_task_name+"Clean" do
118
+ Dir.chdir(@project_dir) do
119
+ if (calc_sources_to_build(true).length != 0 or not File.exist?(get_task_name))
120
+ if (@output_dir_abs)
121
+ FileUtils.rm_rf(file)
122
+ else
123
+ FileUtils.rm_rf(complete_output_dir)
124
+ end
125
+ end
126
+ end
127
+ end
128
+
129
+ Rake.application["clean"].enhance([cleanTask])
130
+ end
131
+
109
132
  add_grouping_tasks(get_task_name)
110
133
 
111
134
  setup_rake_dependencies(res, object_multitask)
@@ -14,6 +14,9 @@ module Cxxproject
14
14
  task :clean do
15
15
  CLEAN.each { |fn| rm_r fn rescue nil }
16
16
  end
17
+ task :clobber => [:clean] do
18
+ CLOBBER.each { |fn| rm_r fn rescue nil }
19
+ end
17
20
  end
18
21
 
19
22
  end
@@ -1,7 +1,7 @@
1
1
  module Cxxproject
2
2
  class Version
3
3
  def self.cxxproject
4
- "0.5.63"
4
+ "0.5.64"
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.63
5
+ version: 0.5.64
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-04-04 00:00:00 Z
13
+ date: 2013-04-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline