bake-toolkit 2.31.7 → 2.32.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 +4 -4
- data/lib/bake/options/create.rb +108 -96
- data/lib/blocks/block.rb +114 -66
- data/lib/blocks/compile.rb +1 -1
- data/lib/blocks/executable.rb +2 -1
- data/lib/common/version.rb +1 -1
- data/lib/tocxx.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cea1feff9772952716a20f61fe4bad3a94c4bb2
|
4
|
+
data.tar.gz: 58225bbd87e4288b92a801bff0888caab841c9dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f80bf3ca98efcd734e9786a8a0cf4f15361837572900afddd0c1bdb2d76e971cde688e92ceb39089f81c3e53f965467519007a42b425acbc5f9dda8fa567a27d
|
7
|
+
data.tar.gz: bfefc83c40ce2fef0571f5a5bb1508e8fe9aca1757f3eaa1317ae42c8eaff3e7c4dfe9aedd207d3e1db5369ad523bca599db061499594371d03cf1063f9ae2f9
|
data/lib/bake/options/create.rb
CHANGED
@@ -1,96 +1,108 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
"\n"+
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"\n"+
|
14
|
-
"
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
"\n"+
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"\n"+
|
30
|
-
"
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"\n"+
|
35
|
-
|
36
|
-
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
"
|
48
|
-
|
49
|
-
|
50
|
-
"\n"+
|
51
|
-
"
|
52
|
-
" Files \"src/**/*.cpp\"\n"+
|
53
|
-
"
|
54
|
-
" }\n"+
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
"{\n"+
|
61
|
-
|
62
|
-
"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
if (
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
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
|
159
|
-
|
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 >=
|
259
|
-
typeStr =
|
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
|
276
|
-
typeStr =
|
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
|
|
data/lib/blocks/compile.rb
CHANGED
@@ -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
|
data/lib/blocks/executable.rb
CHANGED
@@ -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.
|
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
|
|
data/lib/common/version.rb
CHANGED
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(
|
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
|
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.
|
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.
|
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-
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|