bake-toolkit 2.60.2 → 2.61.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 196c55cc08919bff9381fc2c148d1cd4ec295667eb6fa90f4af8ae3080c3b9cc
4
- data.tar.gz: 271409c11aeb347eaf6a3d6110a9e3d4aca6ce9f45cc144324f7bbaf63e3162f
3
+ metadata.gz: 3b7e3e8cf8a2ce67781a4f5701c0c7a3323ebe2d6b3a3b026bfd496655b3c545
4
+ data.tar.gz: 148d025bfbf226d78986655c586c6291c1f18c5f4925cc5c700324483db1ed58
5
5
  SHA512:
6
- metadata.gz: 3902c531628b8cdaf2ce297b9be23b5bd1daaa7009e451797f28df16ff074624ff9c78a2599ae66590ca5fcff7d992e06ffe3e52daa4e937650134c33c2fb3dc
7
- data.tar.gz: efb3178b80e2c48a164f1b5d8f6d16661ccffb3a795bb451afe3c64956b5f08315a38798dc7267575cda11633779875ae8f353c741bcee73e0c3234341ba0dcf
6
+ metadata.gz: 0b9fe89d71c63358256e78d1d5aa196a7d6606361fe833dfd01169dbb520c327f62ba7cd4033505b84af3c9c7430f4f64d49fc2e677b9c0836b229d300246860
7
+ data.tar.gz: a4b40affee87172e2b69cbb03896b112999ff578bf49cc48f53e010f181e123aa0e301e4c0f0ae35529f1abce1f200d0593c519da69cc9e8a14ef92390855bc1
@@ -15,6 +15,7 @@ module Bake
15
15
  def loadProjMeta(filename, filenum)
16
16
 
17
17
  Bake::Configs::Checks.symlinkCheck(filename)
18
+ Bake::Configs::Checks.sanityFolderName(filename)
18
19
 
19
20
  f = @loader.load(filename)
20
21
 
@@ -3,6 +3,12 @@ module Bake
3
3
 
4
4
  class Checks
5
5
 
6
+ @@warnedCase = []
7
+
8
+ def self.cleanupWarnings
9
+ @@warnedCase.clear
10
+ end
11
+
6
12
  def self.symlinkCheck(filename)
7
13
  dirOfProjMeta = File.dirname(filename)
8
14
  Dir.chdir(dirOfProjMeta) do
@@ -19,6 +25,27 @@ module Bake
19
25
  end
20
26
  end
21
27
  end
28
+
29
+ def self.sanityFolderName(dorg)
30
+ return if !Bake.options.caseSensitivityCheck
31
+ return if Bake.options.verbose < 1
32
+ d = dorg
33
+ while (d != File.dirname(d))
34
+ b = File.basename(d)
35
+ dnew = File.dirname(d)
36
+ Dir.chdir(dnew) do
37
+ files = Dir.glob("*")
38
+ if !files.include?(b)
39
+ possible = files.select{ |f| f.casecmp(b)==0 }
40
+ if possible.length > 0 && !@@warnedCase.include?(d)
41
+ @@warnedCase << d
42
+ Bake.formatter.printWarning("Warning: '#{b}' not found in '#{dnew}'. Alternatives: #{possible.map{|p| "'#{p}'"}.join(", ")}. Maybe a typo happened while entering a folder in the shell?")
43
+ end
44
+ end
45
+ end
46
+ d = dnew
47
+ end
48
+ end
22
49
 
23
50
  def self.commonMetamodelCheck(configs, filename, isAdapt = false)
24
51
 
@@ -70,6 +70,7 @@ module Bake
70
70
  end
71
71
 
72
72
  def getFullProject(projName, configs, configname, isMain)
73
+
73
74
 
74
75
  configname = resolveConfigName(configs, configname)
75
76
 
@@ -83,6 +84,7 @@ module Bake
83
84
  @defaultToolchainName = config.defaultToolchain.basedOn unless config.defaultToolchain.nil?
84
85
  @mainProjectName = config.parent.name
85
86
  @mainConfigName = config.name
87
+ @configHashMain = {}
86
88
  end
87
89
 
88
90
  # check if config has to be manipulated
@@ -113,7 +115,18 @@ module Bake
113
115
  configHash[s.name] = [] unless configHash.has_key?(s.name)
114
116
  configHash[s.name] += s.value.split(";")
115
117
  end
116
-
118
+
119
+ if !isMain
120
+ @configHashMain.each do |k,v|
121
+ if configHash.has_key?(k)
122
+ configHash[k] += v
123
+ configHash[k].uniq!
124
+ else
125
+ configHash[k] = v
126
+ end
127
+ end
128
+ end
129
+
117
130
  checkCondition = lambda {|name,value|
118
131
  return true if adaptHash[name].empty?
119
132
  if !configHash.has_key?(name)
@@ -137,25 +150,15 @@ module Bake
137
150
  end
138
151
  end
139
152
 
140
- @fullProjects[projName + "," + configname] = [config, configname]
141
- [config, configname]
142
- end
143
-
144
- def symlinkCheck(filename)
145
- dirOfProjMeta = File.dirname(filename)
146
- Dir.chdir(dirOfProjMeta) do
147
- if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
148
- isSym = false
149
- begin
150
- isSym = File.symlink?(dirOfProjMeta)
151
- rescue
152
- end
153
- if isSym
154
- Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
155
- ExitHelper.exit(1)
156
- end
153
+ if isMain
154
+ config.scopes.each do |s|
155
+ @configHashMain[s.name] = [] unless @configHashMain.has_key?(s.name)
156
+ @configHashMain[s.name] += s.value.split(";")
157
157
  end
158
158
  end
159
+
160
+ @fullProjects[projName + "," + configname] = [config, configname]
161
+ [config, configname]
159
162
  end
160
163
 
161
164
  def checkVerFormat(ver)
@@ -200,6 +203,7 @@ module Bake
200
203
  def loadProjMeta(filename)
201
204
 
202
205
  Bake::Configs::Checks.symlinkCheck(filename)
206
+ Bake::Configs::Checks.sanityFolderName(filename)
203
207
 
204
208
  f = @loader.load(filename)
205
209
 
@@ -131,6 +131,10 @@ module Bake
131
131
  has_attr 'text', String, :defaultValueLiteral => ""
132
132
  end
133
133
 
134
+ class CompilationDB < ModelElement
135
+ has_attr 'name', String, :defaultValueLiteral => "$(WorkingDir)/compile_commands.json"
136
+ end
137
+
134
138
  class RequiredBakeVersion < ModelElement
135
139
  has_attr 'minimum', String, :defaultValueLiteral => ""
136
140
  has_attr 'maximum', String, :defaultValueLiteral => ""
@@ -299,6 +303,7 @@ module Bake
299
303
  contains_one 'toolchain', Toolchain, 'parent'
300
304
  contains_many 'set', Set, 'parent'
301
305
  contains_many 'prebuild', Prebuild, 'parent'
306
+ contains_one 'cdb', CompilationDB, 'parent'
302
307
 
303
308
  module ClassModule
304
309
  def ident
@@ -19,8 +19,8 @@ module Bake
19
19
  end
20
20
 
21
21
  class Options < Parser
22
- attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :showConfigs
23
- attr_reader :main_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :dotFilename, :cc2j_filename # String
22
+ attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :showConfigs, :cc2j_filename
23
+ attr_reader :main_dir, :working_dir, :project, :filename, :main_project_name, :buildDirDelimiter, :dot, :dotFilename # String
24
24
  attr_reader :include_filter, :exclude_filter, :adapt # String List
25
25
  attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :projectPaths, :qac, :dry, :syncedOutput, :debug_threads, :skipBuildingLine # Boolean
26
26
  attr_reader :linkOnly, :compileOnly, :no_autodir, :clobber, :docu, :debug, :prepro, :prebuild, :printTime, :json, :wparse, :caseSensitivityCheck, :fileCmd, :profiling # Boolean
@@ -193,6 +193,7 @@ module Bake
193
193
  Bake.formatter.printError("Error: Project.meta not found in #{searchDir} or upwards")
194
194
  ExitHelper.exit(1)
195
195
  end
196
+ set_working_dir()
196
197
 
197
198
  def_roots = Root.calc_roots_bake(@main_dir)
198
199
  @roots += def_roots
@@ -323,11 +324,19 @@ module Bake
323
324
  @main_project_name = File::basename(@main_dir)
324
325
  end
325
326
 
327
+ def set_working_dir()
328
+ @working_dir = File.expand_path(Dir.pwd.gsub(/[\\]/,'/'))
329
+ end
330
+
326
331
  def set_root(dir)
327
- root = Root.extract_depth(dir)
328
- check_valid_dir(root.dir)
329
- root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
330
- @roots << root
332
+ if File.file?(dir)
333
+ @roots += Root.calc_roots_bake(dir)
334
+ else
335
+ root = Root.extract_depth(dir)
336
+ check_valid_dir(root.dir)
337
+ root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
338
+ @roots << root
339
+ end
331
340
  end
332
341
 
333
342
  def set_adapt(name)
@@ -336,16 +345,21 @@ module Bake
336
345
  end
337
346
  end
338
347
 
339
- def checkNum(num)
348
+ def checkNum(num, quite = false)
340
349
  if String === num && !/\A\d+\z/.match(num)
341
- Bake.formatter.printError("Error: #{num} is not a positive number")
342
- ExitHelper.exit(1)
350
+ if !quite
351
+ Bake.formatter.printError("Error: #{num} is not a positive number")
352
+ ExitHelper.exit(1)
353
+ else
354
+ return false
355
+ end
343
356
  end
357
+ return true
344
358
  end
345
359
 
346
360
  def set_threads(num)
347
361
  return if num == nil # -j without number shall behave the same as not set
348
- checkNum(num)
362
+ return :ignore if !checkNum(num, true)
349
363
  @threads = String === num ? num.to_i : num
350
364
  if @threads <= 0
351
365
  Bake.formatter.printError("Error: number of threads must be > 0")
@@ -202,6 +202,8 @@ module Bake
202
202
  substStr << Bake.options.main_project_name
203
203
  elsif var == "MainProjectDir"
204
204
  substStr << Bake.options.main_dir
205
+ elsif var == "WorkingDir"
206
+ substStr << Bake.options.working_dir
205
207
  elsif var == "ConfigName"
206
208
  substStr << @@configName
207
209
  elsif var == "ToolchainName" and defined?@@toolchainName
@@ -91,10 +91,14 @@ module Bake
91
91
  end
92
92
 
93
93
  def set_root(dir)
94
- root = Root.extract_depth(dir)
95
- check_valid_dir(root.dir)
96
- root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
97
- @roots << root
94
+ if File.file?(dir)
95
+ @roots += Root.calc_roots_bake(dir)
96
+ else
97
+ root = Root.extract_depth(dir)
98
+ check_valid_dir(root.dir)
99
+ root.dir = File.expand_path(root.dir.gsub(/[\\]/,'/'))
100
+ @roots << root
101
+ end
98
102
  end
99
103
 
100
104
  end
@@ -1,5 +1,6 @@
1
1
  require_relative "../blocks/block"
2
2
  require_relative "ext/file"
3
+ require_relative "../bake/config/checks"
3
4
 
4
5
  module Bake
5
6
 
@@ -10,7 +11,8 @@ module Bake
10
11
  Bake::IDEInterface.instance.set_abort(false)
11
12
  Blocks::Block.reset_block_counter
12
13
  Blocks::Block.reset_delayed_result
13
- File.cleanupWarnings
14
+ Configs::Checks.cleanupWarnings
15
+
14
16
  end
15
17
 
16
18
  end
@@ -52,7 +52,7 @@ class File
52
52
 
53
53
  while i < max
54
54
  if toSplitted[i] != fromSplitted[i]
55
- if Bake.options.verbose >= 1
55
+ if Bake.options.verbose >= 1 && Bake.options.caseSensitivityCheck
56
56
  if toSplitted[i].casecmp(fromSplitted[i]) == 0
57
57
  if !@@warnedCase.include?(fromSplitted[0..i].join("/"))
58
58
  fromsj = fromSplitted[0..i].join("/")
@@ -81,8 +81,8 @@ module Bake
81
81
  if inPlaceArg
82
82
  option.call(inPlaceArg, nil, nil)
83
83
  else
84
- option.call(@argv[pos+1], nil, nil) # do not use inplace value
85
- pos = pos + 1
84
+ ignore = option.call(@argv[pos+1], nil, nil) # do not use inplace value
85
+ pos = pos + 1 if ignore != :ignore
86
86
  end
87
87
  else
88
88
  option.call(nil, nil, nil)
@@ -58,7 +58,7 @@ module Bake
58
58
 
59
59
  def self.calc_roots_bake(dir)
60
60
  def_roots = []
61
- rootsFile = searchRootsFile(dir)
61
+ rootsFile = (File.file?(dir) ? dir : searchRootsFile(dir))
62
62
  if (rootsFile)
63
63
  File.open(rootsFile).each do |line|
64
64
  line = line.split("#")[0].strip.gsub(/[\\]/,'/')
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.60.2"
4
+ "2.61.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -701,7 +701,17 @@ module Bake
701
701
  makeDot
702
702
  end
703
703
 
704
-
704
+ if !Bake.options.cc2j_filename
705
+ if !@mainConfig.cdb.nil?
706
+ Bake.options.cc2j_filename = @mainConfig.cdb.name
707
+ if !File.is_absolute?(Bake.options.cc2j_filename)
708
+ Bake.options.cc2j_filename = File.join(
709
+ File.rel_from_to_project(Dir.pwd, @mainConfig.parent.get_project_dir, false),
710
+ Bake.options.cc2j_filename)
711
+ end
712
+ end
713
+ end
714
+
705
715
  metadata_json = Bake.options.dev_features.detect { |x| x.start_with?("metadata=") }
706
716
  if metadata_json
707
717
  metadata_file = metadata_json[9..-1]
@@ -730,7 +740,7 @@ module Bake
730
740
  puts "File #{metadata_file} written."
731
741
  ExitHelper.exit(0)
732
742
  else
733
- Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig for ExecutableConfig.")
743
+ Bake.formatter.printError("Error: dev-feature metadata is only for LibraryConfig or ExecutableConfig.")
734
744
  ExitHelper.exit(1)
735
745
  end
736
746
  end
@@ -785,7 +795,14 @@ module Bake
785
795
 
786
796
  if Bake.options.cc2j_filename
787
797
  require "json"
788
- File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
798
+ begin
799
+ Bake.formatter.printInfo("Info: writing compilation database #{Bake.options.cc2j_filename}") if Bake.options.verbose >= 1
800
+ File.write(Bake.options.cc2j_filename, JSON.pretty_generate(Blocks::CC2J))
801
+ rescue Exception => ex
802
+ Bake.formatter.printError("Error: could not write compilation database: #{ex.message}")
803
+ puts ex.backtrace if Bake.options.debug
804
+ result = false
805
+ end
789
806
  end
790
807
 
791
808
  if Bake.options.filelist && !Bake.options.dry
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.60.2
4
+ version: 2.61.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: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext