bake-toolkit 2.63.0 → 2.64.2

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
  SHA256:
3
- metadata.gz: 225fc376c9b3409d01e708f2ec67bb2d80f9c081d26de339d5b4bb3451141e50
4
- data.tar.gz: e3769b3550aee5ae45685d8445b0ea3bfec59eea4ffa885900a461c82269b16b
3
+ metadata.gz: 1241aa9fcd9ce24d5761701ddd95271bed509b193893143c277796f2d5ba5507
4
+ data.tar.gz: 7935527ed54346bca16a792df57c7933418c3072d19ac226b4dfbc3553e280ab
5
5
  SHA512:
6
- metadata.gz: 419125459eab7fb1ea49939389ff85c43ef6e7ddfd2fdc4bbd555e0a5b8d0e282d28e6e52da5ab3bac1d08d1b5cee4d163315d99bceab7700011aa5f3feda46f
7
- data.tar.gz: 3e273c6f6a16f89ba30b1d40c8a787a9439693ba50dd33d4667328c91894b7302ae3c1f6e9f2c4d48078fdbba545270fb5c73ff0158f0e6766bc640774808896
6
+ metadata.gz: c7a8521d57d7e25c52a84a18114fed44d7c64e817f16850727579e511b38cf46ddd05f87d9d74f0f37f44422e800c845055d27e64236714f0885d50d78a1e2cf
7
+ data.tar.gz: 45099b859072ff9dab75f24ee74680b6c69b157844a1143a5bb9c7bfb028683ba9379591430435e7efe535a983b2a818e9168a83cb3ff069b0047623dec7ef9c
@@ -1,4 +1,5 @@
1
1
  require_relative '../../bake/model/loader'
2
+ require_relative '../../bake/config/loader'
2
3
  require_relative '../../bake/config/checks'
3
4
 
4
5
  module Bake
@@ -24,6 +25,10 @@ module Bake
24
25
  ExitHelper.exit(1)
25
26
  end
26
27
 
28
+ f.root_elements.each do |a|
29
+ Bake::Config::checkVer(a.requiredBakeVersion)
30
+ end
31
+
27
32
  configs = []
28
33
  f.root_elements.each { |re| configs.concat(re.getConfig) }
29
34
  AdaptConfig::checkSyntax(configs, filename)
@@ -31,7 +31,7 @@ module Bake
31
31
  @cacheFilename = Bake.options.main_dir+"/.bake/Project.meta." + sanitize_filename(Bake.options.build_config) + qacStr + ".cache"
32
32
  end
33
33
  if !Bake.options.dry
34
- Utils.gitIgnore(File.dirname(@cacheFilename))
34
+ Utils.gitIgnore(File.dirname(@cacheFilename), :silent)
35
35
  end
36
36
  end
37
37
 
@@ -187,10 +187,16 @@ module Bake
187
187
  cache.adapt_filenames = AdaptConfig.filenames
188
188
  bbdump = Marshal.dump(cache)
189
189
  begin
190
- File.delete(@cacheFilename)
191
- rescue
190
+ File.open(@cacheFilename, 'wb') {|file| file.write(bbdump) }
191
+ rescue Exception=>e
192
+ if Bake.options.verbose >= 3
193
+ Bake.formatter.printWarning("Warning: Could not write cache file #{@cacheFilename}")
194
+ if Bake.options.debug
195
+ puts e.message
196
+ puts e.backtrace
197
+ end
198
+ end
192
199
  end
193
- File.open(@cacheFilename, 'wb') {|file| file.write(bbdump) }
194
200
  Bake.options.nocache = false
195
201
  end
196
202
 
@@ -161,7 +161,7 @@ module Bake
161
161
  [config, configname]
162
162
  end
163
163
 
164
- def checkVerFormat(ver)
164
+ def self.checkVerFormat(ver)
165
165
  return true if ver.empty?
166
166
  return false if ver.length > 3
167
167
  ver.each do |v|
@@ -170,7 +170,7 @@ module Bake
170
170
  true
171
171
  end
172
172
 
173
- def bailOutVer(reqVersion)
173
+ def self.bailOutVer(reqVersion)
174
174
  text1 = (reqVersion.minimum.empty? ? "" : "minimum = #{reqVersion.minimum}")
175
175
  text2 = ((reqVersion.minimum.empty? or reqVersion.maximum.empty?) ? "" : ", ")
176
176
  text3 = (reqVersion.maximum.empty? ? "" : "maximum = #{reqVersion.maximum}")
@@ -178,7 +178,7 @@ module Bake
178
178
  ExitHelper.exit(1)
179
179
  end
180
180
 
181
- def checkVer(reqVersion)
181
+ def self.checkVer(reqVersion)
182
182
  return if reqVersion.nil?
183
183
  min = reqVersion.minimum.split(".")
184
184
  max = reqVersion.maximum.split(".")
@@ -217,7 +217,7 @@ module Bake
217
217
  proj = projRoots[0]
218
218
 
219
219
  reqVersion = proj.getRequiredBakeVersion
220
- checkVer(reqVersion)
220
+ Bake::Config::checkVer(reqVersion)
221
221
 
222
222
  configs = proj.getConfig
223
223
  Bake::Configs::Checks::commonMetamodelCheck(configs, filename)
@@ -236,6 +236,7 @@ module Bake
236
236
  adaptRoots = f.root_elements.select { |re| Metamodel::Adapt === re }
237
237
  if adaptRoots.length > 0
238
238
  adaptRoots.each do |adapt|
239
+ Bake::Config::checkVer(adapt.requiredBakeVersion)
239
240
  adapt.mainProject = @mainProjectName if adapt.mainProject == "__THIS__"
240
241
  adaptConfigs = adapt.getConfig
241
242
  AdaptConfig.checkSyntax(adaptConfigs, filename, true)
@@ -9,6 +9,7 @@ require 'rgen/util/file_cache_map'
9
9
 
10
10
  require 'rtext/default_loader'
11
11
 
12
+ require_relative '../../common/ext/rgen'
12
13
  require_relative '../../common/exit_helper'
13
14
  require_relative '../toolchain/colorizing_formatter'
14
15
  require_relative '../options/options'
@@ -284,6 +284,12 @@ module Bake
284
284
  has_attr 'env', Boolean, :defaultValueLiteral => "false"
285
285
  end
286
286
 
287
+ class CompilationCheck < ModelElement
288
+ has_attr 'exclude', String, :defaultValueLiteral => ""
289
+ has_attr 'include', String, :defaultValueLiteral => ""
290
+ has_attr 'ignore', String, :defaultValueLiteral => ""
291
+ end
292
+
287
293
  class BaseConfig_INTERNAL < ModelElement
288
294
  has_attr 'name', String, :defaultValueLiteral => ""
289
295
  has_attr 'extends', String, :defaultValueLiteral => ""
@@ -305,6 +311,7 @@ module Bake
305
311
  contains_many 'set', Set, 'parent'
306
312
  contains_many 'prebuild', Prebuild, 'parent'
307
313
  contains_one 'cdb', CompilationDB, 'parent'
314
+ contains_many 'compilationCheck', CompilationCheck, 'parent'
308
315
 
309
316
  module ClassModule
310
317
  def ident
@@ -356,6 +363,7 @@ module Bake
356
363
  has_attr 'mainConfig', String, :defaultValueLiteral => ""
357
364
  contains_many 'config', BaseConfig_INTERNAL, 'parent'
358
365
  contains_many 'scopes', Scope, 'parent'
366
+ contains_one 'requiredBakeVersion', RequiredBakeVersion, 'parent'
359
367
  end
360
368
 
361
369
  class If < Adapt
@@ -361,6 +361,10 @@ module Bake
361
361
  end
362
362
 
363
363
  def set_verbose(num)
364
+ if num.nil?
365
+ Bake.formatter.printError("Error: verbose must be between 0 and 3")
366
+ ExitHelper.exit(1)
367
+ end
364
368
  checkNum(num)
365
369
  @verbose = String === num ? num.to_i : num
366
370
  if @verbose < 0 || verbose > 3
@@ -7,6 +7,7 @@ require 'rgen/fragment/fragmented_model'
7
7
 
8
8
  require 'rtext/default_loader'
9
9
 
10
+ require_relative '../../common/ext/rgen'
10
11
  require_relative '../../common/exit_helper'
11
12
  require_relative '../../bake/toolchain/colorizing_formatter'
12
13
 
@@ -35,7 +35,7 @@ module Bake
35
35
  projs << root.dir + "/Project.meta"
36
36
  end
37
37
  if projs.length == 0
38
- toBuildPattern << BuildPattern.new(nil, nil, p.args, p) # remember it for sorted info printout
38
+ Bake.formatter.printWarning("pattern does not match any project: #{p.name}", p)
39
39
  end
40
40
  projs.each do |f|
41
41
  toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p.args, p)
@@ -58,6 +58,10 @@ module Bake
58
58
  end
59
59
  end
60
60
 
61
+ toBuildPattern.select {|bp| !bp.coll_p.isFound}.map {|bp| bp.coll_p}.uniq.each do |p|
62
+ Bake.formatter.printWarning("pattern does not match any config: #{p.config}", p)
63
+ end
64
+
61
65
  col.exclude.each do |p|
62
66
  p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
63
67
  p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
@@ -7,47 +7,52 @@ require_relative '../common/utils'
7
7
  require_relative '../bake/toolchain/colorizing_formatter'
8
8
  require_relative '../bake/config/loader'
9
9
 
10
-
11
10
  begin
12
- require 'Win32API'
11
+ module Kernel32
12
+ require 'fiddle'
13
+ require 'fiddle/import'
14
+ require 'fiddle/types'
15
+ extend Fiddle::Importer
16
+ dlload 'kernel32'
17
+ include Fiddle::Win32Types
18
+ extern 'DWORD GetLongPathName(LPCSTR, LPSTR, DWORD)'
19
+ extern 'DWORD GetShortPathName(LPCSTR, LPSTR, DWORD)'
20
+ end
13
21
 
14
- def longname short_name
15
- max_path = 1024
16
- long_name = " " * max_path
17
- lfn_size = Win32API.new("kernel32", "GetLongPathName", ['P','P','L'],'L').call(short_name, long_name, max_path)
18
- return long_name[0..lfn_size-1]
19
- end
22
+ def longname short_name
23
+ max_path = 1024
24
+ long_name = " " * max_path
25
+ lfn_size = Kernel32.GetLongPathName(short_name, long_name, max_path)
26
+ return long_name[0..lfn_size-1]
27
+ end
20
28
 
21
- def shortname long_name
22
- max_path = 1024
23
- short_name = " " * max_path
24
- lfn_size = Win32API.new("kernel32", "GetShortPathName", ['P','P','L'],'L').call(long_name, short_name, max_path)
25
- return short_name[0..lfn_size-1]
26
- end
29
+ def shortname long_name
30
+ max_path = 1024
31
+ short_name = " " * max_path
32
+ lfn_size = Kernel32.GetShortPathName(long_name, short_name, max_path)
33
+ return short_name[0..lfn_size-1]
34
+ end
27
35
 
28
- def realname file
29
- longname(shortname(file))
30
- end
36
+ def realname file
37
+ x = longname(shortname(file))
38
+ end
31
39
 
32
- rescue LoadError
40
+ rescue Fiddle::DLError
33
41
 
34
- def realname file
42
+ def realname file
35
43
  file
36
- end
44
+ end
37
45
 
38
46
  end
39
47
 
40
48
 
41
-
42
-
43
-
44
49
  module Bake
45
50
 
46
51
  module Blocks
47
52
 
48
53
  class Compile < BlockBase
49
54
 
50
- attr_reader :objects, :include_list, :source_files_ignored_in_lib, :object_files_ignored_in_lib
55
+ attr_reader :objects, :source_files, :source_files_compiled, :include_list, :source_files_ignored_in_lib, :object_files_ignored_in_lib
51
56
 
52
57
  def mutex
53
58
  @mutex ||= Mutex.new
@@ -421,6 +426,7 @@ module Bake
421
426
  Utils.gitIgnore(odir) if !Bake.options.dry
422
427
 
423
428
  fileListBlock = Set.new if Bake.options.filelist
429
+ @source_files_compiled = @source_files.dup
424
430
  compileJobs = Multithread::Jobs.new(@source_files) do |jobs|
425
431
  while source = jobs.get_next_or_nil do
426
432
 
@@ -539,7 +545,7 @@ module Bake
539
545
  end
540
546
 
541
547
  def calcSources(cleaning = false, keep = false)
542
- return @source_files if @source_files and not @source_files.empty?
548
+ return @source_files if @source_files && !@source_files.empty?
543
549
  @source_files = []
544
550
  @source_files_ignored_in_lib = []
545
551
  @source_files_link_directly = []
@@ -190,9 +190,15 @@ module Bake
190
190
  BlockBase.writeCmdLineFile(cmd, cmdLineFile)
191
191
  success = true
192
192
  consoleOutput = ""
193
- success, consoleOutput = ProcessHelper.run(realCmd, false, false, outPipe) if !Bake.options.dry
194
- process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, reason, success)
195
-
193
+ retry_linking = Bake.options.dev_features.include?("retry-linking") ? 5 : 1
194
+ begin
195
+ success, consoleOutput = ProcessHelper.run(realCmd, false, false, outPipe) if !Bake.options.dry
196
+ process_result(cmdLinePrint, consoleOutput, linker[:ERROR_PARSER], nil, reason, success)
197
+ rescue Exception
198
+ retry_linking -= 1
199
+ retry if !success && retry_linking > 0
200
+ raise
201
+ end
196
202
  check_config_file()
197
203
  end
198
204
 
@@ -0,0 +1,23 @@
1
+ module RGen
2
+ module Util
3
+
4
+ class FileCacheMap
5
+ alias_method :orig_store_data, :store_data
6
+ def store_data(key_path, value_data)
7
+ begin
8
+ orig_store_data(key_path, value_data)
9
+ rescue Exception=>e
10
+ if Bake.options.verbose >= 3
11
+ cf = cache_file(key_path)
12
+ Bake.formatter.printWarning("Warning: Could not write cache file #{cf}")
13
+ if Bake.options.debug
14
+ puts e.message
15
+ puts e.backtrace
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -4,11 +4,21 @@ module Bake
4
4
 
5
5
  module Utils
6
6
 
7
- def self.gitIgnore(folder)
8
- FileUtils::mkdir_p(folder)
7
+ def self.gitIgnore(folder, mode = :report)
9
8
  gitignore = folder + "/.gitignore"
10
- if !File.exist?(gitignore)
11
- File.write(gitignore, ".\n")
9
+ begin
10
+ FileUtils::mkdir_p(folder)
11
+ if !File.exist?(gitignore)
12
+ File.write(gitignore, ".\n")
13
+ end
14
+ rescue Exception=>e
15
+ if mode != :silent && Bake.options.verbose >= 3
16
+ Bake.formatter.printWarning("Warning: Could not write file #{gitignore}")
17
+ if Bake.options.debug
18
+ puts e.message
19
+ puts e.backtrace
20
+ end
21
+ end
12
22
  end
13
23
  end
14
24
 
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.63.0"
4
+ "2.64.2"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
@@ -36,6 +36,7 @@ require_relative 'common/abortException'
36
36
 
37
37
  require_relative 'adapt/config/loader'
38
38
  require "thwait"
39
+ require 'pathname'
39
40
 
40
41
  module Bake
41
42
 
@@ -254,6 +255,7 @@ module Bake
254
255
  end
255
256
  end
256
257
  end
258
+ ExitHelper.exit(0)
257
259
  end
258
260
 
259
261
  def makeIncs
@@ -851,6 +853,84 @@ module Bake
851
853
  if Bake.options.linkOnly and @@linkBlock == 0
852
854
  Bake.formatter.printSuccess("\nNothing to link.")
853
855
  else
856
+ # CompilationCheck
857
+ if !Bake.options.project &&
858
+ !Bake.options.filename &&
859
+ !Bake.options.linkOnly &&
860
+ !Bake.options.prepro &&
861
+ !Bake.options.compileOnly &&
862
+ !Bake.options.clean
863
+
864
+ ccChecks = []
865
+ ccIncludes = Set.new
866
+ ccExcludes = Set.new
867
+ ccIgnores = Set.new
868
+ @referencedConfigs.each do |projName, configs|
869
+ configs.compilationCheck.each do |cc|
870
+ ccChecks << cc
871
+ end
872
+ end
873
+ ccChecks.each do |cc|
874
+ Dir.chdir(cc.parent.parent.get_project_dir) do
875
+ Dir.glob(cc.include).select {|f| File.file?(f)}.each {|f| ccIncludes << File.expand_path(f)}
876
+ Dir.glob(cc.exclude).select {|f| File.file?(f)}.each {|f| ccExcludes << File.expand_path(f)}
877
+ Dir.glob(cc.ignore). select {|f| File.file?(f)}.each {|f| ccIgnores << File.expand_path(f)}
878
+ end
879
+ end
880
+ ccIncludes -= ccIgnores
881
+ ccExcludes -= ccIgnores
882
+ ccIncludes -= ccExcludes
883
+
884
+ if !ccIncludes.empty? || !ccExcludes.empty?
885
+ inCompilation = Set.new
886
+ Blocks::ALL_BLOCKS.each do |name,block|
887
+ block.mainSteps.each do |b|
888
+ if Blocks::Compile === b && !b.source_files_compiled.nil?
889
+ b.source_files_compiled.each do |s|
890
+ inCompilation << File.expand_path(s, b.projectDir)
891
+ type = b.get_source_type(s)
892
+ if type != :ASM
893
+ b.objects.each do |o|
894
+ dep_filename = b.calcDepFile(o, type)
895
+ dep_filename_conv = b.calcDepFileConv(dep_filename)
896
+ File.readlines(File.expand_path(dep_filename_conv, b.projectDir)).map{|line| line.strip}.each do |dep|
897
+ header = File.expand_path(dep, b.projectDir)
898
+ if File.exist?(header)
899
+ inCompilation << header
900
+ end
901
+ end
902
+ end
903
+ end
904
+ end
905
+ end
906
+ end
907
+ end
908
+ pnPwd = Pathname.new(Dir.pwd)
909
+ ccNotIncluded = (ccIncludes - inCompilation).to_a
910
+ ccNotExcluded = inCompilation.select {|i| ccExcludes.include?(i) }
911
+ ccNotIncluded.each do |cc|
912
+ cc = Pathname.new(cc).relative_path_from(pnPwd)
913
+ Bake.formatter.printWarning("Warning: file not included in build: #{cc}")
914
+ end
915
+ ccNotExcluded.each do |cc|
916
+ cc = Pathname.new(cc).relative_path_from(pnPwd)
917
+ Bake.formatter.printWarning("Warning: file not excluded from build: #{cc}")
918
+ end
919
+
920
+ if Bake.options.verbose >= 3
921
+ if ccNotIncluded.empty? && ccNotExcluded.empty?
922
+ Bake.formatter.printInfo("Info: CompilationCheck passed")
923
+ end
924
+ end
925
+
926
+ elsif !ccChecks.empty?
927
+ if Bake.options.verbose >= 3
928
+ Bake.formatter.printInfo("Info: CompilationCheck passed")
929
+ end
930
+ end
931
+ end
932
+
933
+
854
934
  Bake.formatter.printSuccess("\n#{taskType} done.")
855
935
  end
856
936
  end
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.63.0
4
+ version: 2.64.2
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-06-10 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 12.2.1
117
+ version: 12.3.3
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 12.2.1
124
+ version: 12.3.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -262,6 +262,7 @@ files:
262
262
  - lib/common/exit_helper.rb
263
263
  - lib/common/ext/dir.rb
264
264
  - lib/common/ext/file.rb
265
+ - lib/common/ext/rgen.rb
265
266
  - lib/common/ext/rtext.rb
266
267
  - lib/common/ext/stdout.rb
267
268
  - lib/common/ide_interface.rb