bake-toolkit 2.31.7 → 2.32.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: 10d3b39f49f8131ccf46ff3d5e6a9415ef68446d
4
- data.tar.gz: 0d7be58ecb2d6852d4bb0818ad35065a656af6db
3
+ metadata.gz: 6cea1feff9772952716a20f61fe4bad3a94c4bb2
4
+ data.tar.gz: 58225bbd87e4288b92a801bff0888caab841c9dc
5
5
  SHA512:
6
- metadata.gz: 2f2879786b3ea60fd4941dc146c239beb085664018ba58cbcb12f5a4c4d27415890008175b4a38c0534e6cb8808742c8ee3eab8b506bf98d8ea59a25b3d44482
7
- data.tar.gz: dbfdc935821bc679b102388632c41f69fa2e2d07ec8cd32b11c8d0ba9b923ce42ca268a1a79f265dd1e2d47e661fef941319889a74c48f43321473f429bfe668
6
+ metadata.gz: f80bf3ca98efcd734e9786a8a0cf4f15361837572900afddd0c1bdb2d76e971cde688e92ceb39089f81c3e53f965467519007a42b425acbc5f9dda8fa567a27d
7
+ data.tar.gz: bfefc83c40ce2fef0571f5a5bb1508e8fe9aca1757f3eaa1317ae42c8eaff3e7c4dfe9aedd207d3e1db5369ad523bca599db061499594371d03cf1063f9ae2f9
@@ -1,96 +1,108 @@
1
- require 'fileutils'
2
-
3
- module Bake
4
-
5
- class Create
6
-
7
- def self.exeTemplate
8
- "Project default: main {\n"+
9
- "\n"+
10
- " Responsible {\n"+
11
- " Person \"#{ENV["USER"]}\"\n"+
12
- " }\n"+
13
- "\n"+
14
- " ExecutableConfig main {\n"+
15
- " # Dependency ...\n"+
16
- " Files \"src/**/*.cpp\"\n"+
17
- " IncludeDir \"include\"\n"+
18
- " DefaultToolchain GCC\n"+
19
- " }\n"+
20
- "}\n"
21
- end
22
-
23
- def self.libTemplate
24
- "Project default: lib {\n"+
25
- "\n"+
26
- " Responsible {\n"+
27
- " Person \"#{ENV["USER"]}\"\n"+
28
- " }\n"+
29
- "\n"+
30
- " LibraryConfig lib {\n"+
31
- " Files \"src/**/*.cpp\"\n"+
32
- " IncludeDir \"include\"\n"+
33
- " }\n"+
34
- "\n"+
35
- " ExecutableConfig UnitTest {\n"+
36
- " Dependency config: lib\n"+
37
- " Files \"test/src/**/*.cpp\"\n"+
38
- " IncludeDir \"include\"\n"+
39
- " DefaultToolchain GCC\n"+
40
- " }\n"+
41
- "}\n"
42
- end
43
-
44
- def self.customTemplate
45
- "Project default: lib {\n"+
46
- "\n"+
47
- " Responsible {\n"+
48
- " Person \"#{ENV["USER"]}\"\n"+
49
- " }\n"+
50
- "\n"+
51
- " CustomConfig lib {\n"+
52
- " Files \"src/**/*.cpp\"\n"+
53
- " IncludeDir \"include\"\n"+
54
- " }\n"+
55
- "}\n"
56
- end
57
-
58
- def self.mainTemplate
59
- "int main()\n"+
60
- "{\n"+
61
- " return 0;\n"+
62
- "}\n"
63
- end
64
-
65
- def self.checkFile(name)
66
- if File.exists?(name)
67
- puts "#{name} already exists"
68
- ExitHelper.exit(1)
69
- end
70
- end
71
-
72
- def self.proj(type)
73
- checkFile("Project.meta")
74
- checkFile("src/main.cpp") if (type == "exe")
75
- FileUtils::mkdir_p "src"
76
- FileUtils::mkdir_p "include"
77
-
78
- if (type == "lib")
79
- File.write("Project.meta", libTemplate);
80
- elsif (type == "exe")
81
- File.write("Project.meta", exeTemplate);
82
- File.write("src/main.cpp", mainTemplate);
83
- elsif (type == "custom")
84
- File.write("Project.meta", customTemplate);
85
- else
86
- puts "'--create' must be followed by 'lib', 'exe' or 'custom'"
87
- ExitHelper.exit(1)
88
- end
89
-
90
- puts "Project created."
91
- ExitHelper.exit(1)
92
- end
93
-
94
- end
95
-
96
- end
1
+ require 'fileutils'
2
+ require 'common/version'
3
+
4
+ module Bake
5
+
6
+ class Create
7
+
8
+ def self.header
9
+ "\n"+
10
+ " RequiredBakeVersion minimum: \"#{Bake::Version.number}\"\n"+
11
+ "\n"+
12
+ " Responsible {\n"+
13
+ " Person \"#{ENV["USER"]}\"\n"+
14
+ " }\n"
15
+ end
16
+
17
+ def self.includeOnly
18
+ "\n"+
19
+ " CustomConfig IncludeOnly {\n"+
20
+ " IncludeDir include, inherit: true\n"+
21
+ " }\n"
22
+ end
23
+
24
+ def self.unitTestBase
25
+ "\n"+
26
+ " ExecutableConfig UnitTestBase {\n"+
27
+ " Files \"test/src/**/*.cpp\"\n"+
28
+ " Dependency config: Lib\n"+
29
+ " DefaultToolchain GCC\n"+
30
+ " }\n"
31
+ end
32
+
33
+ def self.exeTemplate
34
+ "Project default: Main {\n"+
35
+ self.header +
36
+ self.includeOnly+
37
+ "\n"+
38
+ " ExecutableConfig Main {\n"+
39
+ " Files \"src/**/*.cpp\"\n"+
40
+ " Dependency config: IncludeOnly\n"+
41
+ " DefaultToolchain GCC\n"+
42
+ " }\n"+
43
+ "\n}\n"
44
+ end
45
+
46
+ def self.libTemplate
47
+ "Project default: Lib {\n"+
48
+ self.header +
49
+ self.includeOnly+
50
+ "\n"+
51
+ " LibraryConfig Lib {\n"+
52
+ " Files \"src/**/*.cpp\"\n"+
53
+ " Dependency config: IncludeOnly\n"+
54
+ " }\n"+
55
+ self.unitTestBase +
56
+ "\n}\n"
57
+ end
58
+
59
+ def self.customTemplate
60
+ "Project default: Lib {\n"+
61
+ self.header+
62
+ "\n"+
63
+ " CustomConfig Lib {\n"+
64
+ " Dependency config: IncludeOnly\n"+
65
+ " }\n"+
66
+ self.unitTestBase +
67
+ "\n}\n"
68
+ end
69
+
70
+ def self.mainTemplate
71
+ "int main()\n"+
72
+ "{\n"+
73
+ " return 0;\n"+
74
+ "}\n"
75
+ end
76
+
77
+ def self.checkFile(name)
78
+ if File.exists?(name)
79
+ puts "#{name} already exists"
80
+ ExitHelper.exit(1)
81
+ end
82
+ end
83
+
84
+ def self.proj(type)
85
+ checkFile("Project.meta")
86
+ checkFile("src/main.cpp") if (type == "exe")
87
+ FileUtils::mkdir_p "src"
88
+ FileUtils::mkdir_p "include"
89
+
90
+ if (type == "lib")
91
+ File.write("Project.meta", libTemplate);
92
+ elsif (type == "exe")
93
+ File.write("Project.meta", exeTemplate);
94
+ File.write("src/main.cpp", mainTemplate);
95
+ elsif (type == "custom")
96
+ File.write("Project.meta", customTemplate);
97
+ else
98
+ puts "'--create' must be followed by 'lib', 'exe' or 'custom'"
99
+ ExitHelper.exit(1)
100
+ end
101
+
102
+ puts "Project created."
103
+ ExitHelper.exit(0)
104
+ end
105
+
106
+ end
107
+
108
+ end
data/lib/blocks/block.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bake/libElement'
2
+ require 'bake/model/metamodel'
2
3
  require 'common/abortException'
3
4
 
4
5
  module Bake
@@ -86,77 +87,112 @@ module Bake
86
87
  end
87
88
 
88
89
  def convPath(dir, elem=nil, warnIfLocal=false)
89
- if dir.respond_to?("name")
90
- d = dir.name
91
- elem = dir
92
- else
93
- d = dir
94
- end
95
-
96
- return d if Bake.options.no_autodir
97
-
98
- inc = d.split("/")
99
- if (inc[0] == "..") # very simple check, but should be okay for 99.9 % of the cases
100
- if elem and Bake.options.verbose >= 2
101
- Bake.formatter.printInfo("path starts with \"..\"", elem)
102
- end
103
- end
104
-
105
- res = []
106
-
107
- return d if (inc[0] == "." || inc[0] == "..") # prio 0: force local
108
-
109
- if (inc[0] == @projectName) # prio 1: the real path magic
110
- resPathMagic = inc[1..-1].join("/") # within self
111
- resPathMagic = "." if resPathMagic == ""
112
- res << resPathMagic
113
- elsif @referencedConfigs.include?(inc[0])
114
- dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
115
- resPathMagic = File.rel_from_to_project(@projectDir, dirOther, false)
116
- postfix = inc[1..-1].join("/")
117
- resPathMagic = resPathMagic + "/" + postfix if postfix != ""
118
- resPathMagic = "." if resPathMagic == ""
119
- res << resPathMagic
120
- end
121
-
122
- if File.exists?(@projectDir + "/" + d) # prio 2: local, e.g. "include"
123
- res << d
124
- end
125
-
126
- # prioo 3: check if dir exists without Project.meta entry
127
- Bake.options.roots.each do |r|
128
- absIncDir = r+"/"+d
129
- if File.exists?(absIncDir)
130
- res << File.rel_from_to_project(@projectDir,absIncDir,false)
131
- end
132
- end
133
-
134
- return d if res.empty? # prio 4: fallback, no path found
135
-
136
- res = res.map{ |r| Pathname.new(r).cleanpath.to_s }.uniq
137
-
138
- if warnIfLocal && res.length > 1
139
- if elem and Bake.options.verbose >= 2
140
- Bake.formatter.printInfo("#{d} matches several paths:", elem)
141
- puts " #{res[0]} (chosen)"
142
- res[1..-1].each { |r| puts " #{r}" }
143
- end
144
- end
145
-
146
- res[0]
147
- end
90
+ if dir.respond_to?("name")
91
+ d = dir.name
92
+ elem = dir
93
+ else
94
+ d = dir
95
+ end
148
96
 
97
+ return d if Bake.options.no_autodir
149
98
 
150
- def self.block_counter
99
+ inc = d.split("/")
100
+ if (inc[0] == "..") # very simple check, but should be okay for 99.9 % of the cases
101
+ if elem and Bake.options.verbose >= 2
102
+ Bake.formatter.printInfo("path starts with \"..\"", elem)
103
+ end
104
+ end
105
+
106
+ res = []
107
+
108
+ return d if (inc[0] == "." || inc[0] == "..") # prio 0: force local
109
+
110
+ if (inc[0] == @projectName) # prio 1: the real path magic
111
+ resPathMagic = inc[1..-1].join("/") # within self
112
+ resPathMagic = "." if resPathMagic == ""
113
+ res << resPathMagic
114
+ elsif @referencedConfigs.include?(inc[0])
115
+ dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
116
+ resPathMagic = File.rel_from_to_project(@projectDir, dirOther, false)
117
+ postfix = inc[1..-1].join("/")
118
+ resPathMagic = resPathMagic + "/" + postfix if postfix != ""
119
+ resPathMagic = "." if resPathMagic == ""
120
+ res << resPathMagic
121
+ end
122
+
123
+ if File.exists?(@projectDir + "/" + d) # prio 2: local, e.g. "include"
124
+ res << d
125
+ end
126
+
127
+ # prioo 3: check if dir exists without Project.meta entry
128
+ Bake.options.roots.each do |r|
129
+ absIncDir = r+"/"+d
130
+ if File.exists?(absIncDir)
131
+ res << File.rel_from_to_project(@projectDir,absIncDir,false)
132
+ end
133
+ end
134
+
135
+ return d if res.empty? # prio 4: fallback, no path found
136
+
137
+ res = res.map{ |r| Pathname.new(r).cleanpath.to_s }.uniq
138
+
139
+ if warnIfLocal && res.length > 1
140
+ if elem and Bake.options.verbose >= 2
141
+ Bake.formatter.printInfo("#{d} matches several paths:", elem)
142
+ puts " #{res[0]} (chosen)"
143
+ res[1..-1].each { |r| puts " #{r}" }
144
+ end
145
+ end
146
+
147
+ res[0]
148
+ end
149
+
150
+ def self.inc_block_counter()
151
151
  @@block_counter += 1
152
152
  end
153
153
 
154
+ def self.block_counter
155
+ @@block_counter
156
+ end
157
+
154
158
  def self.reset_block_counter
155
159
  @@block_counter = 0
156
160
  end
157
161
 
158
- def self.set_num_projects(num)
159
- @@num_projects = num
162
+ def calcIsBuildBlock
163
+ @startupSteps ||= []
164
+
165
+ return true if Metamodel::ExecutableConfig === @config
166
+ if Metamodel::CustomConfig === @config
167
+ return true if @config.step
168
+ else
169
+ return true if @config.files.length > 0
170
+ if ((@config.startupSteps && @config.startupSteps.step.length > 0) ||
171
+ (@config.preSteps && @config.preSteps.step.length > 0) ||
172
+ (@config.postSteps && @config.postSteps.step.length > 0) ||
173
+ (@config.exitSteps && @config.exitSteps.step.length > 0) ||
174
+ (@config.cleanSteps && @config.cleanSteps.step.length > 0) ||
175
+ (@config.preSteps && @config.preSteps.step.length > 0))
176
+ return true
177
+ end
178
+ end
179
+ return false
180
+ end
181
+
182
+ def isBuildBlock?
183
+ @isBuildBlock ||= calcIsBuildBlock
184
+ end
185
+
186
+ def self.set_num_projects(blocks)
187
+ if Bake.options.verbose >= 2
188
+ @@num_projects = blocks.length
189
+ else
190
+ counter = 0
191
+ blocks.each do |b|
192
+ counter += 1 if b.isBuildBlock? || b.prebuild
193
+ end
194
+ @@num_projects = counter
195
+ end
160
196
  end
161
197
 
162
198
  def executeStep(step, method)
@@ -255,8 +291,14 @@ module Bake
255
291
 
256
292
  Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
257
293
 
258
- if Bake.options.verbose >= 1
259
- typeStr = @prebuild ? "Using" : "Building"
294
+ if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
295
+ typeStr = "Building"
296
+ if @prebuild
297
+ typeStr = "Using"
298
+ elsif not isBuildBlock?
299
+ typeStr = "Applying"
300
+ end
301
+ Block.inc_block_counter()
260
302
  Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
261
303
  end
262
304
  puts "Project path: #{@projectDir}" if Bake.options.projectPaths
@@ -272,8 +314,14 @@ module Bake
272
314
  depResult = callDeps(:clean)
273
315
  return false if not depResult and Bake.options.stopOnFirstError
274
316
 
275
- if Bake.options.verbose >= 2 or cleanSteps.length > 0
276
- typeStr = @prebuild ? "Checking" : "Cleaning"
317
+ if Bake.options.verbose >= 2 || isBuildBlock? || @prebuild
318
+ typeStr = "Cleaning"
319
+ if @prebuild
320
+ typeStr = "Checking"
321
+ elsif not isBuildBlock?
322
+ typeStr = "Skipping"
323
+ end
324
+ Block.inc_block_counter()
277
325
  Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
278
326
  end
279
327
 
@@ -453,7 +453,7 @@ module Bake
453
453
  @source_files.keep_if do |source|
454
454
  source.include?Bake.options.filename
455
455
  end
456
- if @source_files.length == 0 and cleaning == false
456
+ if @source_files.length == 0 and cleaning == false and @config.files.length > 0
457
457
  Bake.formatter.printInfo("#{Bake.options.filename} does not match to any source", @config)
458
458
  end
459
459
  end
@@ -91,8 +91,9 @@ module Bake
91
91
  end
92
92
  duplicateSources = allSources.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)
93
93
  duplicateSources.each do |d|
94
- Bake.formatter.printWarning("Source compiled more than once: #{d}")
94
+ Bake.formatter.printError("Source compiled more than once: #{d}")
95
95
  end
96
+ ExitHelper.exit(1) if duplicateSources.length > 0
96
97
 
97
98
  libs, linker_libs_array = LibElements.calc_linker_lib_string(@block, @block.tcs)
98
99
 
@@ -1,7 +1,7 @@
1
1
  module Bake
2
2
  class Version
3
3
  def self.number
4
- "2.31.7"
4
+ "2.32.0"
5
5
  end
6
6
 
7
7
  def self.printBakeVersion(ry = "")
data/lib/tocxx.rb CHANGED
@@ -374,7 +374,7 @@ module Bake
374
374
  ExitHelper.exit(1)
375
375
  end
376
376
  startBlocks = [Blocks::ALL_BLOCKS[startProjectName+","+startConfigName]]
377
- Blocks::Block.set_num_projects(1)
377
+ Blocks::Block.set_num_projects(startBlocks)
378
378
  elsif startProjectName
379
379
  startBlocks = []
380
380
  Blocks::ALL_BLOCKS.each do |blockName, block|
@@ -387,10 +387,10 @@ module Bake
387
387
  ExitHelper.exit(1)
388
388
  end
389
389
  startBlocks.reverse! # most probably the order of dependencies if any
390
- Blocks::Block.set_num_projects(startBlocks.length)
390
+ Blocks::Block.set_num_projects(startBlocks)
391
391
  else
392
392
  startBlocks = [Blocks::ALL_BLOCKS[Bake.options.main_project_name+","+Bake.options.build_config]]
393
- Blocks::Block.set_num_projects(Blocks::ALL_BLOCKS.length)
393
+ Blocks::Block.set_num_projects(Blocks::ALL_BLOCKS.values)
394
394
  end
395
395
  return startBlocks
396
396
  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.31.7
4
+ version: 2.32.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-02-23 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtext