bake-toolkit 2.34.4 → 2.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a509502821070f924447f0e5690dac7a98efcf3c
4
- data.tar.gz: d3ea565246f0a2e940d0cda680edc07cb6807e92
3
+ metadata.gz: 2bdce1be8c9d734fc44596c799f18524eca9f3c9
4
+ data.tar.gz: 4a9302c6b3fd75f2888311246cc304d10e807c86
5
5
  SHA512:
6
- metadata.gz: 9c91af0ff514ce5a5c92b501e73246ce2f4b0981427f0e30cc60febc899f06849a7df4a02689e4d07a86f4c9a38f6eee154b3730383ce8c8760dbbcc0e63f91b
7
- data.tar.gz: 76c5d9412bf476a6eb41916a556bf844cf231c9213b2a7edfb528f161cfe9599d11651cae884e009432c078c67eabc628c8cb7109ada25a7c21da659ff748be7
6
+ metadata.gz: 0c2b3cebcf34dc1910f32cf45e50eb743d2045daf0ac055984159287bee694966220cf21dbca3196b0bdfaa398d4e7a7a4f2d7bf17bf71357c3c3746c7e98907
7
+ data.tar.gz: 6cf22898b9cb33808f930929bd4dd74347ce01f6d80828b11a853ab7462dc565362078357598104db71d2ddece9bb64d8729fdc97ad52b32464a745231446d68
@@ -53,16 +53,16 @@ module Bake
53
53
 
54
54
  def getPotentialAdaptionProjects()
55
55
  potentialAdapts = []
56
- Bake.options.roots.each do |r|
56
+ Bake.options.roots.each do |root|
57
+ r = root.dir
57
58
  if (r.length == 3 && r.include?(":/"))
58
59
  r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
59
60
  end
60
61
  Bake.options.adapt.each do |a|
61
62
  adaptBaseName = a + "/Adapt.meta"
62
63
  potentialAdapts << adaptBaseName if File.exists?adaptBaseName
63
- fn = r+"/**{,/*/**}/#{adaptBaseName}"
64
- potentialAdapts.concat(Dir.glob(fn).sort)
65
64
  end
65
+ potentialAdapts.concat(Root.search_to_depth(r, "Adapt.meta", root.depth))
66
66
  end
67
67
 
68
68
  potentialAdapts.uniq
@@ -71,7 +71,7 @@ module Bake
71
71
  def chooseProjectFilenames(potentialAdapts)
72
72
  @@filenames = []
73
73
  Bake.options.adapt.each do |a|
74
- adapts = potentialAdapts.find_all { |p| p.include?(a+"/Adapt.meta") }
74
+ adapts = potentialAdapts.find_all { |p| p.include?("/"+a+"/Adapt.meta") or p == a+"/Adapt.meta" }
75
75
  if adapts.empty?
76
76
  Bake.formatter.printError("Adaption project #{a} not found")
77
77
  ExitHelper.exit(1)
@@ -113,9 +113,7 @@ module Bake
113
113
 
114
114
  if cache != nil
115
115
  puts "Cache: Checking root options: #{cache.workspace_roots.inspect} vs. #{Bake.options.roots.inspect}" if Bake.options.debug
116
- if (cache.workspace_roots.length != Bake.options.roots.length) ||
117
- (cache.workspace_roots.any? { |a| !Bake.options.roots.include?(a) }) ||
118
- (Bake.options.roots.any? { |a| !cache.workspace_roots.include?(a) })
116
+ if (!Root.equal(cache.workspace_roots, Bake.options.roots))
119
117
  Bake.formatter.printInfo("Info: specified roots differ from cached roots, reloading meta information") if cache.nil?
120
118
  cache = nil
121
119
  end
@@ -331,19 +331,18 @@ module Bake
331
331
 
332
332
  def checkRoots()
333
333
  @potentialProjs = []
334
- Bake.options.roots.each do |r|
334
+ Bake.options.roots.each do |root|
335
+ r = root.dir
335
336
  if (r.length == 3 && r.include?(":/"))
336
337
  r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
337
338
  end
338
- puts "Checking root #{r}" if Bake.options.verbose >= 1
339
- r = r+"/**{,/*/**}/Project.meta"
340
- @potentialProjs.concat(Dir.glob(r).sort)
339
+ depthStr = root.depth.nil? ? "max" : root.depth.to_s
340
+ puts "Checking root #{r} (depth: #{depthStr})" if Bake.options.verbose >= 1
341
+ @potentialProjs.concat(Root.search_to_depth(r, "Project.meta", root.depth))
341
342
  end
342
-
343
- @potentialProjs = @potentialProjs.uniq
343
+ @potentialProjs.uniq!
344
344
  end
345
345
 
346
-
347
346
  def filterStep(step, globalFilterStr)
348
347
 
349
348
  # 1st prio: explicit single filter
@@ -6,6 +6,7 @@ require 'bake/options/showDoc'
6
6
  require 'bake/options/usage'
7
7
  require 'bake/options/create'
8
8
  require 'common/options/finder'
9
+ require 'common/root'
9
10
 
10
11
  module Bake
11
12
 
@@ -19,7 +20,7 @@ module Bake
19
20
  class Options < Parser
20
21
  attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :envToolchain, :showConfigs
21
22
  attr_reader :main_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :cc2j_filename # String
22
- attr_reader :roots, :include_filter, :exclude_filter, :adapt # String List
23
+ attr_reader :include_filter, :exclude_filter, :adapt # String List
23
24
  attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :projectPaths, :qac, :dry, :syncedOutput, :debug_threads # Boolean
24
25
  attr_reader :linkOnly, :compileOnly, :no_autodir, :clobber, :docu, :debug, :prepro, :oldLinkOrder, :prebuild, :printTime, :json, :wparse # Boolean
25
26
  attr_reader :threads, :socket # Fixnum
@@ -27,6 +28,7 @@ module Bake
27
28
  attr_reader :verbose
28
29
  attr_reader :filelist # set
29
30
  attr_reader :consoleOutput_fullnames, :consoleOutput_visualStudio
31
+ attr_reader :roots # Root array
30
32
 
31
33
 
32
34
  def initialize(argv)
@@ -76,13 +78,12 @@ module Bake
76
78
  @socket = 0
77
79
  @include_filter = []
78
80
  @exclude_filter = []
79
- @def_roots = []
80
81
  @main_project_name = ""
81
82
  @adapt = []
82
83
  @syncedOutput = false
83
84
 
84
85
  add_option(["-b", "" ], lambda { |x| set_build_config(x) })
85
- add_option(["-m" ], lambda { |x| set_main_dir(x) })
86
+ add_option(["-m" ], lambda { |x| @main_dir = x })
86
87
  add_option(["-p" ], lambda { |x| @project = x })
87
88
  add_option(["-f" ], lambda { |x| @filename = x.gsub(/[\\]/,'/') })
88
89
  add_option(["-c" ], lambda { @clean = true })
@@ -164,8 +165,16 @@ module Bake
164
165
  ExitHelper.exit(1)
165
166
  end
166
167
 
167
- @roots += @def_roots
168
- @roots.uniq!
168
+ def_roots = Root.calc_roots_bake(@main_dir)
169
+ @roots += def_roots
170
+
171
+ if @roots.empty?
172
+ @roots = []
173
+ @roots = Root.calc_def_roots(@main_dir)
174
+ end
175
+
176
+ @roots = Root.uniq(@roots)
177
+
169
178
  @adapt.uniq!
170
179
 
171
180
  if @project
@@ -270,13 +279,13 @@ module Bake
270
279
  check_valid_dir(dir)
271
280
  @main_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
272
281
  @main_project_name = File::basename(@main_dir)
273
- @def_roots = calc_def_roots(@main_dir)
274
282
  end
275
283
 
276
284
  def set_root(dir)
277
- check_valid_dir(dir)
278
- r = File.expand_path(dir.gsub(/[\\]/,'/'))
279
- @roots << r if not @roots.include?r
285
+ root = Root.extract_depth(dir)
286
+ check_valid_dir(root.dir)
287
+ root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
288
+ @roots << root
280
289
  end
281
290
 
282
291
  def set_adapt(name)
@@ -21,7 +21,7 @@ module Bake
21
21
  puts " -a <scheme> Use ansi color sequences (console must-- support it). Possible values are 'white' and 'black'."
22
22
  puts " -v<level> Verbose level from 0 to 3, whereas -v0 is less, -v1 is normal (default) and -v2 and -v3 are more verbose."
23
23
  puts " -r Stop on first error."
24
- puts " -w <root> Add a workspace root (can be used multiple times)."
24
+ puts " -w <root>[,<depth>] Add a workspace root (can be used multiple times). Additionally the search depth can be specified (>=0)."
25
25
  puts " If no root is specified, the parent directory of the main project is added automatically."
26
26
  puts " --list Lists all configs with a DefaultToolchain."
27
27
  puts " --rebuild Clean before build."
@@ -112,36 +112,6 @@ def sanitize_filename(filename)
112
112
  end
113
113
  end
114
114
 
115
- def searchRootsFile(dir)
116
- rootsFile = dir+"/roots.bake"
117
- return rootsFile if File.exist?(rootsFile)
118
-
119
- parent = File.dirname(dir)
120
- return searchRootsFile(parent) if parent != dir
121
-
122
- return nil
123
- end
124
-
125
- def calc_def_roots(dir)
126
- def_roots = []
127
- rootsFile = searchRootsFile(dir)
128
- if (rootsFile)
129
- File.open(rootsFile).each do |line|
130
- line = line.split("#")[0].strip.gsub(/[\\]/,'/')
131
- if line != ""
132
- if File.is_absolute?(line)
133
- def_roots << line
134
- else
135
- def_roots << File.expand_path(File.dirname(rootsFile) + "/" + line)
136
- end
137
- end
138
- end
139
- else
140
- def_roots << File.dirname(dir)
141
- end
142
- def_roots
143
- end
144
-
145
115
  def add_line_if_no_comment(array, str)
146
116
  s = str.split("#")[0].strip
147
117
  array << s unless s.empty?
@@ -1,12 +1,13 @@
1
1
  require 'bake/toolchain/colorizing_formatter'
2
2
  require 'common/options/parser'
3
3
  require 'common/options/finder'
4
+ require 'common/root'
4
5
 
5
6
  module Bake
6
7
 
7
8
  class BakeryOptions < Parser
8
9
  attr_reader :collection_name, :collection_dir # String
9
- attr_reader :roots # String List
10
+ attr_reader :roots # Root list
10
11
  attr_reader :color, :error # Boolean
11
12
  attr_reader :socket # Fixnum
12
13
 
@@ -19,10 +20,9 @@ module Bake
19
20
  @error = false
20
21
  @roots = []
21
22
  @socket = 0
22
- @def_roots = []
23
23
 
24
24
  add_option(["-b", "" ], lambda { |x| set_collection_name(x) })
25
- add_option(["-m" ], lambda { |x| set_collection_dir(x) })
25
+ add_option(["-m" ], lambda { |x| @collection_dir = x })
26
26
  add_option(["-r" ], lambda { @error = true })
27
27
  add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
28
28
  add_option(["-w" ], lambda { |x| set_root(x) })
@@ -32,14 +32,14 @@ module Bake
32
32
 
33
33
  def usage
34
34
  puts "\nUsage: bake <name> [options]"
35
- puts " [-b] <name> Name of the collection to build."
36
- puts " -m <dir> Directory containing the collection file (default is current directory)."
37
- puts " -r Stop on first error."
38
- puts " -a <scheme> Use ansi color sequences (console must support it). Possible values are 'white' and 'black'."
39
- puts " -h, --help Print this help."
40
- puts " -w <root> Add a workspace root (can be used multiple times)."
41
- puts " If no root is specified, the parent directory of Collection.meta is added automatically."
42
- puts " --socket <num> Set socket for sending errors, receiving commands, etc. - used by e.g. Eclipse."
35
+ puts " [-b] <name> Name of the collection to build."
36
+ puts " -m <dir> Directory containing the collection file (default is current directory)."
37
+ puts " -r Stop on first error."
38
+ puts " -a <scheme> Use ansi color sequences (console must support it). Possible values are 'white' and 'black'."
39
+ puts " -h, --help Print this help."
40
+ puts " -w <root>[,<depth>] Add a workspace root (can be used multiple times). Additionally the search depth can be specified (>=0)."
41
+ puts " If no root is specified, the parent directory of Collection.meta is added automatically."
42
+ puts " --socket <num> Set socket for sending errors, receiving commands, etc. - used by e.g. Eclipse."
43
43
  puts "Note: all parameters except -b, -m and -h will be passed to bake - see bake help for more options."
44
44
  end
45
45
 
@@ -55,8 +55,15 @@ module Bake
55
55
  ExitHelper.exit(1)
56
56
  end
57
57
 
58
- @roots += @def_roots
59
- @roots.uniq!
58
+ def_roots = Root.calc_roots_bake(@collection_dir)
59
+ @roots += def_roots
60
+
61
+ if @roots.empty?
62
+ @roots = []
63
+ @roots = Root.calc_def_roots(@collection_dir)
64
+ end
65
+
66
+ @roots = Root.uniq(@roots)
60
67
  end
61
68
 
62
69
  def check_valid_dir(dir)
@@ -81,16 +88,15 @@ module Bake
81
88
  def set_collection_dir(dir)
82
89
  check_valid_dir(dir)
83
90
  @collection_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
84
- @def_roots = calc_def_roots(@collection_dir)
85
91
  end
86
92
 
87
93
  def set_root(dir)
88
- check_valid_dir(dir)
89
- r = File.expand_path(dir.gsub(/[\\]/,'/'))
90
- @roots << r if not @roots.include?r
94
+ root = Root.extract_depth(dir)
95
+ check_valid_dir(root.dir)
96
+ root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
97
+ @roots << root
91
98
  end
92
99
 
93
-
94
100
  end
95
101
 
96
102
  end
@@ -28,9 +28,9 @@ module Bake
28
28
  end
29
29
 
30
30
  toBuildPattern = []
31
- @options.roots.each do |r|
31
+ @options.roots.each do |root|
32
32
  col.project.each do |p|
33
- projs = Dir.glob(r+"/**/"+p.name+"/Project.meta")
33
+ projs = Root.search_to_depth(root.dir,p.name + "/Project.meta", root.depth)
34
34
  if projs.length == 0
35
35
  toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout
36
36
  end
@@ -133,7 +133,7 @@ module Bake
133
133
 
134
134
  # prioo 3: check if dir exists without Project.meta entry
135
135
  Bake.options.roots.each do |r|
136
- absIncDir = r+"/"+d
136
+ absIncDir = r.dir+"/"+d
137
137
  if File.exists?(absIncDir)
138
138
  res << File.rel_from_to_project(@projectDir,absIncDir,false)
139
139
  end
@@ -262,16 +262,17 @@ module Bake
262
262
  # not true for Windows RubyInstaller packages.
263
263
  ctrl_c_found = false
264
264
  begin
265
- while IO.select([$stdin],nil,nil,0) do
266
- nextChar = $stdin.sysread(1)
267
- if nextChar == "\x03"
268
- ctrl_c_found = true
265
+ @@mutexStdinSelect.synchronize do
266
+ while IO.select([$stdin],nil,nil,0) do
267
+ nextChar = $stdin.sysread(1)
268
+ if nextChar == "\x03"
269
+ ctrl_c_found = true
270
+ end
269
271
  end
270
272
  end
271
273
  rescue Exception => e
272
274
  end
273
275
  raise AbortException.new if ctrl_c_found
274
-
275
276
  return @result
276
277
  end
277
278
 
@@ -320,6 +321,7 @@ module Bake
320
321
  Bake.formatter.printError("Error: #{ex1.message}")
321
322
  puts ex1.backtrace if Bake.options.debug
322
323
  end
324
+
323
325
  end
324
326
  end
325
327
  if !exceptionOccured
@@ -494,6 +496,7 @@ module Bake
494
496
  @@threads = []
495
497
  @@result = true
496
498
  @@mutex = Mutex.new
499
+ @@mutexStdinSelect = Mutex.new
497
500
  Bake::Multithread::Jobs.init_semaphore()
498
501
  end
499
502
 
@@ -463,7 +463,7 @@ module Bake
463
463
  def mapInclude(inc, orgBlock)
464
464
 
465
465
  if inc.name == "___ROOTS___"
466
- return Bake.options.roots.map { |r| File.rel_from_to_project(@projectDir,r,false) }
466
+ return Bake.options.roots.map { |r| File.rel_from_to_project(@projectDir,r.dir,false) }
467
467
  end
468
468
 
469
469
  i = orgBlock.convPath(inc,nil,true)
@@ -54,7 +54,7 @@ module Bake
54
54
  dirOfP = referencedConfigs[nameOfP].first.get_project_dir
55
55
  else
56
56
  Bake.options.roots.each do |r|
57
- absIncDir = r+"/"+nameOfP
57
+ absIncDir = r.dir+"/"+nameOfP
58
58
  if File.exists?(absIncDir)
59
59
  dirOfP = absIncDir
60
60
  break
@@ -0,0 +1,92 @@
1
+ module Bake
2
+
3
+ class Root
4
+ attr_accessor :dir
5
+ attr_accessor :depth
6
+
7
+ def initialize(directory,search_depth)
8
+ @dir = directory
9
+ @depth = search_depth
10
+ end
11
+
12
+ def self.uniq(array)
13
+ maxDepth = {}
14
+ newArray = []
15
+ array.each do |r|
16
+ if maxDepth.has_key?r.dir
17
+ d = maxDepth[r.dir]
18
+ if !d.nil? && (r.depth.nil? || d < r.depth) # not covered yet
19
+ newArray << r
20
+ maxDepth[r.dir] = r.depth
21
+ end
22
+ else
23
+ newArray << r
24
+ maxDepth[r.dir] = r.depth
25
+ end
26
+ end
27
+ return newArray
28
+ end
29
+
30
+ def self.extract_depth(str)
31
+ regex = /(.*)\s*,\s*(\d+)\s*\z/
32
+ scan_res = str.scan(regex)
33
+ if scan_res.length > 0
34
+ return Root.new(scan_res[0][0],scan_res[0][1].to_i)
35
+ else
36
+ return Root.new(str, nil)
37
+ end
38
+ end
39
+
40
+ def self.equal(rootArrayA, rootArrayB)
41
+ return false if rootArrayA.length != rootArrayB.length
42
+ rootArrayA.each_with_index do |a, i|
43
+ b = rootArrayB[i]
44
+ return false if (a.dir != b.dir) || (a.depth != b.depth)
45
+ end
46
+ return true
47
+ end
48
+
49
+ def self.searchRootsFile(dir)
50
+ rootsFile = dir+"/roots.bake"
51
+ return rootsFile if File.exist?(rootsFile)
52
+
53
+ parent = File.dirname(dir)
54
+ return searchRootsFile(parent) if parent != dir
55
+
56
+ return nil
57
+ end
58
+
59
+ def self.calc_roots_bake(dir)
60
+ def_roots = []
61
+ rootsFile = searchRootsFile(dir)
62
+ if (rootsFile)
63
+ File.open(rootsFile).each do |line|
64
+ line = line.split("#")[0].strip.gsub(/[\\]/,'/')
65
+ if line != ""
66
+ root = Root.extract_depth(line)
67
+ if !File.is_absolute?(root.dir)
68
+ root.dir = File.expand_path(File.dirname(rootsFile) + "/" + root.dir)
69
+ end
70
+ def_roots << root
71
+ end
72
+ end
73
+ end
74
+ return def_roots
75
+ end
76
+
77
+ def self.calc_def_roots(dir)
78
+ return [Root.new(File.dirname(dir), nil)]
79
+ end
80
+
81
+ def self.search_to_depth(root, baseName, depth)
82
+ if depth != nil
83
+ array = Array.new(depth+1) {|i| root + '/*'*i + '/' + baseName}
84
+ return Dir.glob(array).sort
85
+ else
86
+ str = "#{root}/**/#{baseName}"
87
+ return Dir.glob(str).sort
88
+ end
89
+ end
90
+
91
+ end
92
+ end
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.34.4"
4
+ "2.35.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.4
4
+ version: 2.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext
@@ -219,6 +219,7 @@ files:
219
219
  - lib/common/options/finder.rb
220
220
  - lib/common/options/parser.rb
221
221
  - lib/common/process.rb
222
+ - lib/common/root.rb
222
223
  - lib/common/utils.rb
223
224
  - lib/common/version.rb
224
225
  - lib/format/bake_format.rb