bake-toolkit 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bake/cache.rb +9 -0
- data/lib/bake/model/metamodel.rb +1 -1
- data/lib/bake/options.rb +23 -11
- data/lib/bake/version.rb +2 -2
- data/lib/option/parser.rb +21 -13
- data/lib/tocxx.rb +17 -16
- metadata +3 -3
data/lib/bake/cache.rb
CHANGED
@@ -15,6 +15,7 @@ module Cxxproject
|
|
15
15
|
attr_accessor :exclude_filter
|
16
16
|
attr_accessor :defaultToolchain
|
17
17
|
attr_accessor :defaultToolchainTime
|
18
|
+
attr_accessor :no_autodir
|
18
19
|
end
|
19
20
|
|
20
21
|
class CacheAccess
|
@@ -107,6 +108,13 @@ module Cxxproject
|
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
111
|
+
if cache != nil
|
112
|
+
if (not @options.no_autodir.eql?(cache.no_autodir))
|
113
|
+
cache = nil
|
114
|
+
Printer.printInfo "Info: no_autodir option differs in cache, reloading meta information"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
110
118
|
else
|
111
119
|
Printer.printInfo("Info: cache not found, reloading meta information")
|
112
120
|
end
|
@@ -133,6 +141,7 @@ module Cxxproject
|
|
133
141
|
cache.cache_file = @cacheFilename
|
134
142
|
cache.version = Version.bake
|
135
143
|
cache.include_filter = @options.include_filter
|
144
|
+
cache.no_autodir = @options.no_autodir
|
136
145
|
cache.exclude_filter = @options.exclude_filter
|
137
146
|
cache.workspace_roots = @options.roots
|
138
147
|
cache.defaultToolchain = defaultToolchain
|
data/lib/bake/model/metamodel.rb
CHANGED
@@ -121,7 +121,7 @@ module Cxxproject
|
|
121
121
|
has_attr 'lib', String, :defaultValueLiteral => ""
|
122
122
|
has_attr 'target', String, :defaultValueLiteral => ""
|
123
123
|
has_attr 'pathTo', String, :defaultValueLiteral => ""
|
124
|
-
|
124
|
+
contains_many 'flags', Flags, 'parent'
|
125
125
|
end
|
126
126
|
|
127
127
|
class CommandLine < Step
|
data/lib/bake/options.rb
CHANGED
@@ -8,7 +8,7 @@ module Cxxproject
|
|
8
8
|
class Options < Parser
|
9
9
|
attr_reader :build_config, :main_dir, :project, :filename, :eclipse_version, :alias_filename # String
|
10
10
|
attr_reader :roots, :include_filter, :exclude_filter # String List
|
11
|
-
attr_reader :clean, :rebuild, :single, :verbose, :nocache, :color, :show_includes, :linkOnly, :check_uninc, :printLess # Boolean
|
11
|
+
attr_reader :clean, :rebuild, :single, :verbose, :nocache, :color, :show_includes, :linkOnly, :check_uninc, :printLess, :no_autodir # Boolean
|
12
12
|
attr_reader :threads, :socket # Fixnum
|
13
13
|
|
14
14
|
def initialize(argv)
|
@@ -28,6 +28,7 @@ module Cxxproject
|
|
28
28
|
@show_includes = false
|
29
29
|
@linkOnly = false
|
30
30
|
@printLess = false
|
31
|
+
@no_autodir = false
|
31
32
|
@threads = 8
|
32
33
|
@roots = []
|
33
34
|
@socket = 0
|
@@ -37,6 +38,8 @@ module Cxxproject
|
|
37
38
|
@eclipse_version = ""
|
38
39
|
@alias_filename = ""
|
39
40
|
|
41
|
+
add_default(Proc.new{ |x| set_build_config_default(x) })
|
42
|
+
|
40
43
|
add_option(Option.new("-m",true) { |x| set_main_dir(x) })
|
41
44
|
add_option(Option.new("-b",true) { |x| set_build_config(x) })
|
42
45
|
add_option(Option.new("-p",true) { |x| set_project(x); set_single })
|
@@ -48,6 +51,7 @@ module Cxxproject
|
|
48
51
|
add_option(Option.new("--rebuild",false) { set_rebuild })
|
49
52
|
add_option(Option.new("--prepro",false) { set_prepro })
|
50
53
|
add_option(Option.new("--link_only",false) { set_linkOnly })
|
54
|
+
add_option(Option.new("--no_autodir",false) { set_no_autodir })
|
51
55
|
|
52
56
|
add_option(Option.new("-v0",false) { set_v(0) })
|
53
57
|
add_option(Option.new("-v1",false) { set_v(1) })
|
@@ -57,7 +61,7 @@ module Cxxproject
|
|
57
61
|
add_option(Option.new("--threads",true) { |x| set_threads(x) })
|
58
62
|
add_option(Option.new("--socket",true) { |x| set_socket(x) })
|
59
63
|
add_option(Option.new("--toolchain_info",true) { |x| print_toolchain(x) })
|
60
|
-
add_option(Option.new("--
|
64
|
+
add_option(Option.new("--toolchain_names",false) { print_toolchains })
|
61
65
|
add_option(Option.new("--include_filter",true) { |x| set_include_filter(x) })
|
62
66
|
add_option(Option.new("--exclude_filter",true) { |x| set_exclude_filter(x) })
|
63
67
|
add_option(Option.new("--show_abs_paths",false) { set_show_fullnames })
|
@@ -74,8 +78,8 @@ module Cxxproject
|
|
74
78
|
|
75
79
|
def usage
|
76
80
|
puts "\nUsage: bake [options]"
|
81
|
+
puts " [-b] <name> Config name of main project"
|
77
82
|
puts " -m <dir> Directory of main project (default is current directory)."
|
78
|
-
puts " -b <name> Config name of main project"
|
79
83
|
puts " -p <dir> Project to build/clean (default is main project)"
|
80
84
|
puts " -f <name> Build/Clean this file only."
|
81
85
|
puts " -c Clean the file/project."
|
@@ -99,6 +103,7 @@ module Cxxproject
|
|
99
103
|
puts " --exclude_filter <name> Excludes steps with this filter name (can be used multiple times)."
|
100
104
|
puts " 'PRE' or 'POST' excludes all PreSteps respectively PostSteps."
|
101
105
|
puts " --show_abs_paths Compiler prints absolute filename paths instead of relative paths."
|
106
|
+
puts " --no_autodir Disable auto completion of paths like in IncludeDir"
|
102
107
|
puts ""
|
103
108
|
puts " -h, --help Print this help."
|
104
109
|
puts " --show_license Print the license."
|
@@ -143,7 +148,18 @@ module Cxxproject
|
|
143
148
|
@exclude_filter << x
|
144
149
|
end
|
145
150
|
|
151
|
+
def set_build_config_default(config)
|
152
|
+
index = config.index('-')
|
153
|
+
return false if (index != nil and index == 0)
|
154
|
+
set_build_config(config)
|
155
|
+
return true
|
156
|
+
end
|
157
|
+
|
146
158
|
def set_build_config(config)
|
159
|
+
if not @build_config.empty?
|
160
|
+
Printer.printError "Error: Cannot set build config '#{config}', because build config is already set to '#{@build_config}'"
|
161
|
+
ExitHelper.exit(1)
|
162
|
+
end
|
147
163
|
@build_config = config
|
148
164
|
end
|
149
165
|
|
@@ -184,6 +200,10 @@ module Cxxproject
|
|
184
200
|
@linkOnly = true
|
185
201
|
set_single()
|
186
202
|
end
|
203
|
+
|
204
|
+
def set_no_autodir()
|
205
|
+
@no_autodir = true
|
206
|
+
end
|
187
207
|
|
188
208
|
def set_v(num)
|
189
209
|
if num == 0
|
@@ -198,14 +218,6 @@ module Cxxproject
|
|
198
218
|
end
|
199
219
|
end
|
200
220
|
|
201
|
-
def set_printLess()
|
202
|
-
@printLess = true
|
203
|
-
end
|
204
|
-
def set_verbose()
|
205
|
-
@verbose = true
|
206
|
-
end
|
207
|
-
|
208
|
-
|
209
221
|
def set_color(x)
|
210
222
|
if (x != "black" and x != "white")
|
211
223
|
Printer.printError "Error: color scheme must be 'black' or 'white'"
|
data/lib/bake/version.rb
CHANGED
data/lib/option/parser.rb
CHANGED
@@ -21,33 +21,41 @@ class Parser
|
|
21
21
|
def initialize(argv)
|
22
22
|
@options = {}
|
23
23
|
@argv = argv
|
24
|
+
@default = nil
|
24
25
|
end
|
25
26
|
|
26
27
|
def add_option(opt)
|
27
28
|
@options[opt.param] = opt
|
28
29
|
end
|
29
30
|
|
31
|
+
def add_default(opt)
|
32
|
+
@default = opt
|
33
|
+
end
|
34
|
+
|
30
35
|
def parse_internal(ignoreInvalid = true)
|
31
36
|
pos = 0
|
32
37
|
begin
|
33
38
|
while pos < @argv.length do
|
34
39
|
if not @options.include?@argv[pos]
|
35
|
-
if
|
36
|
-
|
37
|
-
|
40
|
+
if @default
|
41
|
+
if not @default.call(@argv[pos])
|
42
|
+
raise "Option #{@argv[pos]} unknown"
|
43
|
+
end
|
44
|
+
elsif not ignoreInvalid
|
45
|
+
raise "Option #{@argv[pos]} unknown"
|
38
46
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
else
|
48
|
+
option = @options[@argv[pos]]
|
49
|
+
if option.arg
|
50
|
+
if pos+1 < @argv.length and @argv[pos+1][0] != "-"
|
51
|
+
option.block.call(@argv[pos+1])
|
52
|
+
pos = pos + 1
|
53
|
+
else
|
54
|
+
raise "Argument for option #{@argv[pos]} missing"
|
55
|
+
end
|
46
56
|
else
|
47
|
-
|
57
|
+
option.block.call()
|
48
58
|
end
|
49
|
-
else
|
50
|
-
option.block.call()
|
51
59
|
end
|
52
60
|
pos = pos + 1
|
53
61
|
end
|
data/lib/tocxx.rb
CHANGED
@@ -81,7 +81,7 @@ module Cxxproject
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# PRE and POST CONDITIONS
|
84
|
-
def addSteps(steps, bbModule, projDir, globalFilterStr
|
84
|
+
def addSteps(steps, bbModule, projDir, globalFilterStr, tcs)
|
85
85
|
if steps
|
86
86
|
array = (Metamodel::Step === steps ? [steps] : steps.step)
|
87
87
|
array.reverse.each do |m|
|
@@ -131,7 +131,8 @@ module Cxxproject
|
|
131
131
|
bb.set_path_to(pathHash)
|
132
132
|
bb.pre_step = true if globalFilterStr
|
133
133
|
end
|
134
|
-
bb.set_flags(m.flags)
|
134
|
+
bb.set_flags(adjustFlags(tcs[:MAKE][:FLAGS],m.flags)) if m.flags
|
135
|
+
|
135
136
|
@lib_elements[m.line_number] = [HasLibraries::LIB_WITH_PATH, m.lib] if m.lib != ""
|
136
137
|
elsif Cxxproject::Metamodel::CommandLine === m
|
137
138
|
nameOfBB = m.name
|
@@ -154,6 +155,8 @@ module Cxxproject
|
|
154
155
|
projDir = config.parent.get_project_dir
|
155
156
|
|
156
157
|
d = dir.respond_to?("name") ? dir.name : dir
|
158
|
+
return d if @options.no_autodir
|
159
|
+
|
157
160
|
inc = d.split("/")
|
158
161
|
if (inc[0] == projName)
|
159
162
|
res = inc[1..-1].join("/") # within self
|
@@ -178,7 +181,7 @@ module Cxxproject
|
|
178
181
|
end
|
179
182
|
end
|
180
183
|
else
|
181
|
-
Printer.printInfo "Info: #{projName} uses \"..\" in path name #{d}"
|
184
|
+
Printer.printInfo "Info: #{projName} uses \"..\" in path name #{d}" if @options.verbose
|
182
185
|
end
|
183
186
|
|
184
187
|
res = d # relative from self as last resort
|
@@ -358,7 +361,15 @@ module Cxxproject
|
|
358
361
|
bbModule = ModuleBuildingBlock.new("Project "+projName)
|
359
362
|
bbModule.contents = []
|
360
363
|
|
361
|
-
|
364
|
+
tcs = nil
|
365
|
+
if not Metamodel::CustomConfig === config
|
366
|
+
tcs = Utils.deep_copy(@defaultToolchain)
|
367
|
+
integrateToolchain(tcs, config.toolchain)
|
368
|
+
else
|
369
|
+
tcs = Utils.deep_copy(Cxxproject::Toolchain::Provider.default)
|
370
|
+
end
|
371
|
+
|
372
|
+
addSteps(config.postSteps, bbModule, projDir, "POST", tcs) if not @options.linkOnly
|
362
373
|
|
363
374
|
# LIB, EXE
|
364
375
|
if Metamodel::LibraryConfig === config
|
@@ -380,7 +391,7 @@ module Cxxproject
|
|
380
391
|
Printer.printError "Error: #{config.file_name}(#{config.step.line_number}): attribute default not allowed here"
|
381
392
|
ExitHelper.exit(1)
|
382
393
|
end
|
383
|
-
addSteps(config.step, bbModule, projDir)
|
394
|
+
addSteps(config.step, bbModule, projDir, nil, tcs)
|
384
395
|
end
|
385
396
|
bbModule.main_content = BinaryLibrary.new(projName, false)
|
386
397
|
end
|
@@ -389,17 +400,7 @@ module Cxxproject
|
|
389
400
|
bbModule.contents << bbModule.main_content
|
390
401
|
|
391
402
|
# PRE CONDITIONS
|
392
|
-
addSteps(config.preSteps, bbModule, projDir, "PRE") if not @options.linkOnly
|
393
|
-
|
394
|
-
|
395
|
-
tcs = nil
|
396
|
-
if not Metamodel::CustomConfig === config
|
397
|
-
tcs = Utils.deep_copy(@defaultToolchain)
|
398
|
-
integrateToolchain(tcs, config.toolchain)
|
399
|
-
else
|
400
|
-
tcs = Utils.deep_copy(Cxxproject::Toolchain::Provider.default)
|
401
|
-
end
|
402
|
-
|
403
|
+
addSteps(config.preSteps, bbModule, projDir, "PRE", tcs) if not @options.linkOnly
|
403
404
|
|
404
405
|
([bbModule] + bbModule.contents).each do |c|
|
405
406
|
c.set_tcs(tcs)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: bake-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.10
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alexander Schaal
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-02 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cxxproject
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.5.
|
23
|
+
version: 0.5.62
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|