bake-toolkit 2.12.2 → 2.13.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bake +0 -1
  3. data/bin/bake-doc +2 -2
  4. data/documentation/_build/html/_sources/changelog.txt +29 -2
  5. data/documentation/_build/html/_sources/ide/vs/how_to_create_vs_projects.txt +1 -1
  6. data/documentation/_build/html/_sources/index.txt +1 -1
  7. data/documentation/_build/html/_sources/tips_and_tricks/static_code_analysis.txt +4 -4
  8. data/documentation/_build/html/_sources/tips_and_tricks/the_bakery.txt +7 -1
  9. data/documentation/_build/html/_static/syntax.html +10 -2
  10. data/documentation/_build/html/changelog.html +80 -5
  11. data/documentation/_build/html/commandline/commandline.html +3 -3
  12. data/documentation/_build/html/concepts/build_hierarchy.html +3 -3
  13. data/documentation/_build/html/concepts/concepts.html +3 -3
  14. data/documentation/_build/html/concepts/the_main_project.html +3 -3
  15. data/documentation/_build/html/concepts/the_project_meta_file.html +3 -3
  16. data/documentation/_build/html/genindex.html +3 -3
  17. data/documentation/_build/html/ide/eclipse/eclipse.html +3 -3
  18. data/documentation/_build/html/ide/eclipse/how_to_convert_existing_cdt_workspace.html +3 -3
  19. data/documentation/_build/html/ide/eclipse/how_to_create_a_new_project_in_eclipse.html +3 -3
  20. data/documentation/_build/html/ide/eclipse/how_to_create_a_workspace_in_eclipse.html +3 -3
  21. data/documentation/_build/html/ide/eclipse/how_to_install_eclipse_plugin.html +3 -3
  22. data/documentation/_build/html/ide/eclipse/how_to_use_bake_in_eclipse.html +3 -3
  23. data/documentation/_build/html/ide/ide_integrations.html +3 -3
  24. data/documentation/_build/html/ide/vs/how_to_create_vs_projects.html +4 -4
  25. data/documentation/_build/html/ide/vs/how_to_debug_in_vs.html +3 -3
  26. data/documentation/_build/html/ide/vs/how_to_used_bake_in_vs.html +3 -3
  27. data/documentation/_build/html/ide/vs/vs.html +3 -3
  28. data/documentation/_build/html/ide/vs/vs_install.html +3 -3
  29. data/documentation/_build/html/index.html +6 -6
  30. data/documentation/_build/html/install/install_bake.html +3 -3
  31. data/documentation/_build/html/internal.html +3 -3
  32. data/documentation/_build/html/known_issues.html +3 -3
  33. data/documentation/_build/html/license.html +3 -3
  34. data/documentation/_build/html/performance/performance.html +3 -3
  35. data/documentation/_build/html/quickstart/quickstart.html +3 -3
  36. data/documentation/_build/html/search.html +3 -3
  37. data/documentation/_build/html/searchindex.js +1 -1
  38. data/documentation/_build/html/syntax/derive_configs.html +3 -3
  39. data/documentation/_build/html/syntax/project_meta_syntax.html +13 -5
  40. data/documentation/_build/html/syntax/syntax.html +3 -3
  41. data/documentation/_build/html/syntax/variable_substitutions.html +3 -3
  42. data/documentation/_build/html/tips_and_tricks/how_to_use_bake_with_cygwin.html +3 -3
  43. data/documentation/_build/html/tips_and_tricks/static_code_analysis.html +7 -7
  44. data/documentation/_build/html/tips_and_tricks/the_bakery.html +8 -4
  45. data/documentation/_build/html/tips_and_tricks/the_clang.html +3 -3
  46. data/documentation/_build/html/tips_and_tricks/tips_and_tricks.html +3 -3
  47. data/documentation/_build/html/why_bake/why_bake.html +5 -5
  48. data/lib/bake/config/loader.rb +42 -0
  49. data/lib/bake/model/metamodel.rb +6 -0
  50. data/lib/bake/options/options.rb +63 -68
  51. data/lib/bake/options/showDoc.rb +0 -7
  52. data/lib/bake/options/usage.rb +16 -17
  53. data/lib/bakery/options/options.rb +9 -9
  54. data/lib/bakery/toBake.rb +1 -1
  55. data/lib/blocks/compile.rb +3 -5
  56. data/lib/blocks/executable.rb +6 -1
  57. data/lib/blocks/library.rb +6 -3
  58. data/lib/common/options/parser.rb +19 -14
  59. data/lib/common/version.rb +1 -1
  60. data/lib/vs/options.rb +9 -8
  61. metadata +2 -3
  62. data/lib/common/options/option.rb +0 -13
@@ -106,6 +106,11 @@ module Bake
106
106
  has_attr 'text', String, :defaultValueLiteral => ""
107
107
  end
108
108
 
109
+ class RequiredBakeVersion < ModelElement
110
+ has_attr 'minimum', String, :defaultValueLiteral => ""
111
+ has_attr 'maximum', String, :defaultValueLiteral => ""
112
+ end
113
+
109
114
  class Responsible < ModelElement
110
115
  contains_many "person", Person, 'parent'
111
116
  end
@@ -238,6 +243,7 @@ module Bake
238
243
  class Project < ModelElement
239
244
  has_attr 'default', String, :defaultValueLiteral => ""
240
245
  contains_one 'description', Description, 'parent'
246
+ contains_one 'requiredBakeVersion', RequiredBakeVersion, 'parent'
241
247
  contains_one 'responsible', Responsible, 'parent'
242
248
  contains_many 'config', BaseConfig_INTERNAL, 'parent'
243
249
 
@@ -6,7 +6,6 @@ require 'bake/options/showLicense'
6
6
  require 'bake/options/showDoc'
7
7
  require 'bake/options/usage'
8
8
  require 'bake/options/create'
9
- require 'common/options/option'
10
9
 
11
10
  module Bake
12
11
 
@@ -68,62 +67,65 @@ module Bake
68
67
  @def_roots = []
69
68
  @main_project_name = ""
70
69
 
71
- add_default(Proc.new{ |x| set_build_config_default(x) })
72
-
73
- add_option(Option.new("-m",true) { |x| set_main_dir(x) })
74
- add_option(Option.new("-b",true) { |x| set_build_config(x) })
75
- add_option(Option.new("-p",true) { |x| @project = x;})
76
- add_option(Option.new("-f",true) { |x| @filename = x.gsub(/[\\]/,'/') })
77
- add_option(Option.new("-c",false) { @clean = true })
78
- add_option(Option.new("-a",true) { |x| Bake.formatter.setColorScheme(x.to_sym) })
79
- add_option(Option.new("-w",true) { |x| set_root(x) })
80
- add_option(Option.new("-r",false) { @stopOnFirstError = true })
81
- add_option(Option.new("--rebuild",false) { @rebuild = true })
82
- add_option(Option.new("--prepro",false) { @prepro = true })
83
- add_option(Option.new("--link_only",false) { @linkOnly = true; })
84
- add_option(Option.new("--no_autodir",false) { @no_autodir = true })
85
- add_option(Option.new("--lint",false) { @lint = true })
86
- add_option(Option.new("--lint_min",true) { |x| @lint_min = String === x ? x.to_i : x })
87
- add_option(Option.new("--lint_max",true) { |x| @lint_max = String === x ? x.to_i : x })
88
-
89
- add_option(Option.new("--create",true) { |x| Bake::Create.proj(x) })
90
- add_option(Option.new("--conversion_info",false) { @conversion_info = true })
70
+ add_option(["-b", "" ], lambda { |x| set_build_config(x) })
71
+ add_option(["-m" ], lambda { |x| set_main_dir(x) })
72
+ add_option(["-p" ], lambda { |x| @project = x })
73
+ add_option(["-f" ], lambda { |x| @filename = x.gsub(/[\\]/,'/') })
74
+ add_option(["-c" ], lambda { @clean = true })
75
+ add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
76
+ add_option(["-w" ], lambda { |x| set_root(x) })
77
+ add_option(["-r" ], lambda { @stopOnFirstError = true })
78
+ add_option(["--rebuild" ], lambda { @rebuild = true })
79
+ add_option(["--prepro" ], lambda { @prepro = true })
80
+ add_option(["--link-only", "--link_only" ], lambda { @linkOnly = true; })
81
+ add_option(["--no-autodir", "--no_autodir" ], lambda { @no_autodir = true })
82
+ add_option(["--lint" ], lambda { @lint = true })
83
+ add_option(["--lint-min", "--lint_min" ], lambda { |x| @lint_min = String === x ? x.to_i : x })
84
+ add_option(["--lint-max", "--lint_max" ], lambda { |x| @lint_max = String === x ? x.to_i : x })
85
+
86
+ add_option(["--create" ], lambda { |x| Bake::Create.proj(x) })
87
+ add_option(["--conversion-info", "--conversion_info" ], lambda { @conversion_info = true })
88
+
89
+ add_option(["--generate-doc", "--docu" ], lambda { @docu = true })
90
+
91
+ add_option(["-v0" ], lambda { @verbose = 0 })
92
+ add_option(["-v1" ], lambda { @verbose = 1 })
93
+ add_option(["-v2" ], lambda { @verbose = 2 })
94
+ add_option(["-v3" ], lambda { @verbose = 3 })
91
95
 
92
- add_option(Option.new("--docu",false) { @docu = true })
93
-
94
- add_option(Option.new("-v0",false) { @verbose = 0 })
95
- add_option(Option.new("-v1",false) { @verbose = 1 })
96
- add_option(Option.new("-v2",false) { @verbose = 2 })
97
- add_option(Option.new("-v3",false) { @verbose = 3 })
96
+ add_option(["--debug" ], lambda { @debug = true })
97
+ add_option(["--set" ], lambda { |x| set_set(x) })
98
98
 
99
- add_option(Option.new("--debug",false) { @debug = true })
100
- add_option(Option.new("--set",true) { |x| set_set(x) })
101
-
102
- add_option(Option.new("--clobber",false) { @clobber = true; @clean = true })
103
- add_option(Option.new("--ignore_cache",false) { @nocache = true })
104
- add_option(Option.new("--threads",true) { |x| set_threads(x) })
105
- add_option(Option.new("--socket",true) { |x| @socket = String === x ? x.to_i : x })
106
- add_option(Option.new("--toolchain_info",true) { |x| ToolchainInfo.showToolchain(x) })
107
- add_option(Option.new("--toolchain_names",false) { ToolchainInfo.showToolchainList })
108
- add_option(Option.new("--include_filter",true) { |x| @include_filter << x })
109
- add_option(Option.new("--exclude_filter",true) { |x| @exclude_filter << x })
110
- add_option(Option.new("--show_abs_paths",false) { @consoleOutput_fullnames = true })
111
- add_option(Option.new("--visualStudio",false) { @consoleOutput_visualStudio = true })
112
- add_option(Option.new("-h",false) { Bake::Usage.show })
113
- add_option(Option.new("--help",false) { Bake::Usage.show })
114
- add_option(Option.new("--show_include_paths",false) { @show_includes = true })
115
- add_option(Option.new("--show_incs_and_defs",false) { @show_includes_and_defines = true })
116
- add_option(Option.new("--show_license",false) { License.show })
117
- add_option(Option.new("--show_doc",false) { Doc.show })
118
- add_option(Option.new("--doc",false) { Doc.deprecated })
119
- add_option(Option.new("--version",false) { ExitHelper.exit(0) })
120
- add_option(Option.new("--show_configs",false) { @showConfigs = true })
121
- add_option(Option.new("--writeCC2J",true) { |x| @cc2j_filename = x.gsub(/[\\]/,'/') })
99
+ add_option(["--clobber" ], lambda { @clobber = true; @clean = true })
100
+ add_option(["--ignore-cache", "--ignore_cache" ], lambda { @nocache = true })
101
+ add_option(["--threads" ], lambda { |x| set_threads(x) })
102
+ add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
103
+ add_option(["--toolchain-info", "--toolchain_info" ], lambda { |x| ToolchainInfo.showToolchain(x) })
104
+ add_option(["--toolchain-names", "--toolchain_names" ], lambda { ToolchainInfo.showToolchainList })
105
+ add_option(["--do", "--include_filter" ], lambda { |x| @include_filter << x })
106
+ add_option(["--omit", "--exclude_filter" ], lambda { |x| @exclude_filter << x })
107
+ add_option(["--abs-paths", "--show_abs_paths" ], lambda { @consoleOutput_fullnames = true })
108
+
109
+ add_option(["-h", "--help" ], lambda { Bake::Usage.show })
110
+
111
+ add_option(["--incs-and-defs", "--show_incs_and_defs" ], lambda { @show_includes_and_defines = true })
112
+ add_option(["--license", "--show_license" ], lambda { License.show })
113
+ add_option(["--doc", "--show_doc" ], lambda { Doc.show })
114
+
115
+ add_option(["--version" ], lambda { ExitHelper.exit(0) })
116
+ add_option(["--list", "--show_configs" ], lambda { @showConfigs = true })
117
+ add_option(["--writeCC2J" ], lambda { |x| @cc2j_filename = x.gsub(/[\\]/,'/') })
118
+
119
+ # hidden
120
+ add_option(["--visualStudio" ], lambda { @consoleOutput_visualStudio = true })
121
+
122
+ # deprecated and not replaced by new command
123
+ add_option(["--show_include_paths" ], lambda { @show_includes = true })
122
124
 
123
125
  end
124
126
 
125
127
  def parse_options()
126
- parse_internal(false)
128
+ parse_internal()
127
129
  set_main_dir(Dir.pwd) if @main_dir.nil?
128
130
  @roots = @def_roots if @roots.length == 0
129
131
 
@@ -136,46 +138,46 @@ module Bake
136
138
 
137
139
  if @conversion_info
138
140
  if @rebuild
139
- Bake.formatter.printError("Error: --conversion_info and --rebuild not allowed at the same time")
141
+ Bake.formatter.printError("Error: --conversion-info and --rebuild not allowed at the same time")
140
142
  ExitHelper.exit(1)
141
143
  end
142
144
  if @clean
143
- Bake.formatter.printError("Error: --conversion_info and -c not allowed at the same time")
145
+ Bake.formatter.printError("Error: --conversion-info and -c not allowed at the same time")
144
146
  ExitHelper.exit(1)
145
147
  end
146
148
  if @prepro
147
- Bake.formatter.printError("Error: --conversion_info and --prepro not allowed at the same time")
149
+ Bake.formatter.printError("Error: --conversion-info and --prepro not allowed at the same time")
148
150
  ExitHelper.exit(1)
149
151
  end
150
152
  if @linkOnly
151
- Bake.formatter.printError("Error: --conversion_info and --linkOnly not allowed at the same time")
153
+ Bake.formatter.printError("Error: --conversion-info and --linkOnly not allowed at the same time")
152
154
  ExitHelper.exit(1)
153
155
  end
154
156
  if @lint
155
- Bake.formatter.printError("Error: --conversion_info and --lint not allowed at the same time")
157
+ Bake.formatter.printError("Error: --conversion-info and --lint not allowed at the same time")
156
158
  ExitHelper.exit(1)
157
159
  end
158
160
  if @docu
159
- Bake.formatter.printError("Error: --conversion_info and --docu not allowed at the same time")
161
+ Bake.formatter.printError("Error: --conversion-info and --docu not allowed at the same time")
160
162
  ExitHelper.exit(1)
161
163
  end
162
164
  if not @project
163
- Bake.formatter.printError("Error: --conversion_info must be used with -p")
165
+ Bake.formatter.printError("Error: --conversion-info must be used with -p")
164
166
  ExitHelper.exit(1)
165
167
  end
166
168
  end
167
169
 
168
170
  if @linkOnly
169
171
  if @rebuild
170
- Bake.formatter.printError("Error: --link_only and --rebuild not allowed at the same time")
172
+ Bake.formatter.printError("Error: --link-only and --rebuild not allowed at the same time")
171
173
  ExitHelper.exit(1)
172
174
  end
173
175
  if @clean
174
- Bake.formatter.printError("Error: --link_only and -c not allowed at the same time")
176
+ Bake.formatter.printError("Error: --link-only and -c not allowed at the same time")
175
177
  ExitHelper.exit(1)
176
178
  end
177
179
  if @prepro
178
- Bake.formatter.printError("Error: --link_only and --prepro not allowed at the same time")
180
+ Bake.formatter.printError("Error: --link-only and --prepro not allowed at the same time")
179
181
  ExitHelper.exit(1)
180
182
  end
181
183
  end
@@ -210,13 +212,6 @@ module Bake
210
212
  end
211
213
  end
212
214
 
213
- def set_build_config_default(config)
214
- index = config.index('-')
215
- return false if (index != nil and index == 0)
216
- set_build_config(config)
217
- return true
218
- end
219
-
220
215
  def set_build_config(config)
221
216
  if not @build_config.empty?
222
217
  Bake.formatter.printError("Error: Cannot set build config '#{config}', because build config is already set to '#{@build_config}'")
@@ -16,12 +16,5 @@ module Bake
16
16
  ExitHelper.exit(0)
17
17
  end
18
18
 
19
- def self.deprecated
20
- puts "Option \"--doc\" not supported anymore. Please use"
21
- puts "\"--show_doc\" to open the documentation in the browser OR"
22
- puts "\"--docu\" for building the documentation of a project."
23
- ExitHelper.exit(1)
24
- end
25
-
26
19
  end
27
20
  end
@@ -14,39 +14,38 @@ module Bake
14
14
  puts " -r Stop on first error."
15
15
  puts " -w <root> Add a workspace root (can be used multiple times)."
16
16
  puts " If no root is specified, the parent directory of the main project is added automatically."
17
- puts " --show_configs Shows all configs with DefaultToolchain."
17
+ puts " --list Lists all configs with a DefaultToolchain."
18
18
  puts " --rebuild Clean before build."
19
19
  puts " --clobber Clean the file/project (same as option -c) AND the bake cache files."
20
20
  puts " --prepro Stop after preprocessor."
21
- puts " --link_only Only link executables - doesn't update objects and archives or start PreSteps and PostSteps."
21
+ puts " --link-only Only link executables - doesn't update objects and archives or start PreSteps and PostSteps."
22
22
  puts " Forces executables to be relinked."
23
- puts " --docu Builds docu instead of compiling sources."
23
+ puts " --generate-doc Builds docu instead of compiling sources."
24
24
  puts " --lint Performs Lint checks instead of compiling sources."
25
- puts " --lint_min <num> If number of files in a project is too large for lint to handle, it is possible"
25
+ puts " --lint-min <num> If number of files in a project is too large for lint to handle, it is possible"
26
26
  puts " to specify only a part of the file list to lint (default -1)."
27
- puts " --lint_max <num> See above (default -1)."
28
- puts " --ignore_cache Rereads the original meta files - usefull if workspace structure has been changed."
27
+ puts " --lint-max <num> See above (default -1)."
28
+ puts " --ignore-cache Rereads the original meta files - usefull if workspace structure has been changed."
29
29
  puts " --threads <num> Set NUMBER of parallel compiled files (default is 8)."
30
30
  puts " --socket <num> Set SOCKET for sending errors, receiving commands, etc. - used by e.g. Eclipse."
31
- puts " --toolchain_info <name> Prints default values of a toolchain."
32
- puts " --toolchain_names Prints available toolchains."
33
- puts " --include_filter <name> Includes steps with this filter name (can be used multiple times)."
31
+ puts " --toolchain-info <name> Prints default values of a toolchain."
32
+ puts " --toolchain-names Prints available toolchains."
33
+ puts " --do <name> Includes steps with this filter name (can be used multiple times)."
34
34
  puts " 'PRE', 'POST', 'STARTUP' or 'EXIT' includes all according steps."
35
- puts " --exclude_filter <name> Excludes steps with this filter name (can be used multiple times)."
35
+ puts " --omit <name> Excludes steps with this filter name (can be used multiple times)."
36
36
  puts " 'PRE', 'POST', 'STARTUP' or 'EXIT' excludes all according steps."
37
- puts " --show_abs_paths Compiler prints absolute filename paths instead of relative paths."
38
- puts " --no_autodir Disable auto completion of paths like in IncludeDir"
37
+ puts " --abs-paths Compiler prints absolute filename paths instead of relative paths."
38
+ puts " --no-autodir Disable auto completion of paths like in IncludeDir"
39
39
  puts " --set <key>=<value> Sets a variable. Overwrites variables defined in Project.metas (can be used multiple times)."
40
- puts " --show_include_paths Used by IDEs plugins"
41
- puts " --show_incs_and_defs Used by IDEs plugins"
42
- puts " --conversion_info Prints infos for an external tool which converts bake configs for other build systems"
40
+ puts " --incs-and-defs Used by IDEs plugins"
41
+ puts " --conversion-info Prints infos for an external tool which converts bake configs for other build systems"
43
42
  puts " --writeCC2J <name> Writes compiler command into a json file (experimental!)"
44
43
  puts " --create exe|lib|custom Creates a project with exe, lib or custom template"
45
44
  puts ""
46
45
  puts " --version Print version."
47
- puts " --show_doc Open documentation in browser"
46
+ puts " --doc Open documentation in browser"
48
47
  puts " -h, --help Print this help."
49
- puts " --show_license Print the license."
48
+ puts " --license Print the license."
50
49
  puts ""
51
50
  puts " --debug Print out backtraces in some cases - used only for debugging bake."
52
51
  ExitHelper.exit(0)
@@ -20,22 +20,22 @@ module Bake
20
20
  @socket = 0
21
21
  @def_roots = []
22
22
 
23
- add_option(Option.new("-b",true) { |x| set_collection_name(x) })
24
- add_option(Option.new("-m",true) { |x| set_collection_dir(x) })
25
- add_option(Option.new("-r",false) { @error = true })
26
- add_option(Option.new("-a",true) { |x|Bake.formatter.setColorScheme(x.to_sym) })
27
- add_option(Option.new("-w",true) { |x| set_root(x) })
28
- add_option(Option.new("--socket",true) { |x| @socket = String === x ? x.to_i : x })
29
- add_option(Option.new("-h",false) { usage; ExitHelper.exit(0) })
23
+ add_option(["-b", "" ], lambda { |x| set_collection_name(x) })
24
+ add_option(["-m" ], lambda { |x| set_collection_dir(x) })
25
+ add_option(["-r" ], lambda { @error = true })
26
+ add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
27
+ add_option(["-w" ], lambda { |x| set_root(x) })
28
+ add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
29
+ add_option(["-h", "--help"], lambda { usage; ExitHelper.exit(0) })
30
30
  end
31
31
 
32
32
  def usage
33
33
  puts "\nUsage: bake <name> [options]"
34
- puts " -b <name> Name of the collection to build."
34
+ puts " [-b] <name> Name of the collection to build."
35
35
  puts " -m <dir> Directory containing the collection file (default is current directory)."
36
36
  puts " -r Stop on first error."
37
37
  puts " -a <scheme> Use ansi color sequences (console must support it). Possible values are 'white' and 'black'."
38
- puts " -h Print this help."
38
+ puts " -h, --help Print this help."
39
39
  puts " -w <root> Add a workspace root (can be used multiple times)."
40
40
  puts " If no root is specified, the parent directory of Collection.meta is added automatically."
41
41
  puts " --socket <num> Set socket for sending errors, receiving commands, etc. - used by e.g. Eclipse."
@@ -30,7 +30,7 @@ module Bake
30
30
  toBuildPattern = []
31
31
  @options.roots.each do |r|
32
32
  col.project.each do |p|
33
- projs = Dir.glob(r+"/"+p.name+"/Project.meta")
33
+ projs = Dir.glob(r+"/**/"+p.name+"/Project.meta")
34
34
  if projs.length == 0
35
35
  toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout
36
36
  end
@@ -32,10 +32,8 @@ module Bake
32
32
  File.join([@output_dir, adaptedSource])
33
33
  end
34
34
 
35
- def maybe_needed?(source, object, type, dep_filename_conv)
36
- return false if Bake.options.linkOnly
37
- return false if Bake.options.prepro and type == ASM
38
- return true
35
+ def ignore?(type)
36
+ Bake.options.linkOnly or (Bake.options.prepro and type == ASM)
39
37
  end
40
38
 
41
39
  def needed?(source, object, type, dep_filename_conv)
@@ -114,8 +112,8 @@ module Bake
114
112
 
115
113
  cmdLineCheck = false
116
114
  cmdLineFile = calcCmdlineFile(object)
117
- return true unless maybe_needed?(source, object, type, dep_filename_conv)
118
115
 
116
+ return true if ignore?(type)
119
117
  reason = needed?(source, object, type, dep_filename_conv)
120
118
  if not reason
121
119
  cmdLineCheck = true
@@ -56,8 +56,11 @@ module Bake
56
56
  return false
57
57
  end
58
58
 
59
+ def ignore?
60
+ Bake.options.prepro
61
+ end
62
+
59
63
  def needed?(libs)
60
- return false if Bake.options.prepro
61
64
  return "because linkOnly was specified" if Bake.options.linkOnly
62
65
 
63
66
  # exe
@@ -94,6 +97,8 @@ module Bake
94
97
 
95
98
  cmdLineCheck = false
96
99
  cmdLineFile = calcCmdlineFile()
100
+
101
+ return true if ignore?
97
102
  reason = needed?(libs)
98
103
  if not reason
99
104
  cmdLineCheck = true
@@ -23,10 +23,11 @@ module Bake
23
23
  archive_name + ".cmdline"
24
24
  end
25
25
 
26
+ def ignore?
27
+ Bake.options.linkOnly or Bake.options.prepro
28
+ end
29
+
26
30
  def needed?
27
- return false if Bake.options.linkOnly
28
- return false if Bake.options.prepro
29
-
30
31
  # lib
31
32
  return "because library does not exist" if not File.exists?(archive_name)
32
33
 
@@ -51,6 +52,8 @@ module Bake
51
52
 
52
53
  cmdLineCheck = false
53
54
  cmdLineFile = calcCmdlineFile()
55
+
56
+ return true if ignore?
54
57
  reason = needed?
55
58
  if not reason
56
59
  cmdLineCheck = true
@@ -8,39 +8,44 @@ module Bake
8
8
  def initialize(argv)
9
9
  @arguments = {}
10
10
  @argv = argv
11
- @default = nil
12
11
  end
13
12
 
14
- def add_option(opt)
15
- @arguments[opt.param] = opt
13
+ #def add_option(opt)
14
+ # @arguments[opt.param] = opt
15
+ #end
16
+
17
+ def add_option(params, block)
18
+ params.each { |p| @arguments[p] = block }
16
19
  end
17
20
 
18
- def add_default(opt)
19
- @default = opt
21
+ def get_block(param)
22
+ opt = @arguments[param]
23
+ raise "Internal error in option handling" unless opt
24
+ opt.block
20
25
  end
21
26
 
22
- def parse_internal(ignoreInvalid = true)
27
+ def parse_internal(ignore_invalid = false)
23
28
  pos = 0
24
29
  begin
25
30
  while pos < @argv.length do
26
31
  if not @arguments.include?@argv[pos]
27
- if @default
28
- res = @default.call(@argv[pos])
29
- if (not res and not ignoreInvalid)
30
- raise "Option #{@argv[pos]} unknown"
31
- end
32
+ index = @argv[pos].index('-')
33
+ if index != nil and index == 0
34
+ raise "Option #{@argv[pos]} unknown" if not ignore_invalid
35
+ else
36
+ @arguments[""].call(@argv[pos]) # default paramter without "-"
32
37
  end
33
38
  else
34
39
  option = @arguments[@argv[pos]]
35
- if option.arg
40
+ if option.parameters.length == 1
36
41
  if pos+1 < @argv.length and @argv[pos+1][0] != "-"
37
- option.block.call(@argv[pos+1])
42
+ option.call(@argv[pos+1])
38
43
  pos = pos + 1
39
44
  else
40
45
  raise "Argument for option #{@argv[pos]} missing"
41
46
  end
42
47
  else
43
- option.block.call()
48
+ option.call()
44
49
  end
45
50
  end
46
51
  pos = pos + 1