bake-toolkit 2.20.4 → 2.21.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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile.rb +3 -3
  3. data/bin/bake +46 -46
  4. data/bin/bake-doc +11 -11
  5. data/bin/bakery +179 -179
  6. data/bin/createVSProjects +213 -213
  7. data/documentation/_build/html/_sources/changelog.txt +456 -451
  8. data/documentation/_build/html/_sources/commandline/commandline.txt +107 -107
  9. data/documentation/_build/html/_sources/concepts/build_hierarchy.txt +34 -34
  10. data/documentation/_build/html/_sources/concepts/concepts.txt +14 -14
  11. data/documentation/_build/html/_sources/concepts/inject.txt +65 -65
  12. data/documentation/_build/html/_sources/concepts/link_order.txt +91 -91
  13. data/documentation/_build/html/_sources/concepts/prebuild.txt +56 -56
  14. data/documentation/_build/html/_sources/concepts/the_main_project.txt +45 -45
  15. data/documentation/_build/html/_sources/concepts/the_project_meta_file.txt +72 -72
  16. data/documentation/_build/html/_sources/ide/eclipse/eclipse.txt +25 -25
  17. data/documentation/_build/html/_sources/ide/eclipse/how_to_convert_existing_cdt_workspace.txt +31 -31
  18. data/documentation/_build/html/_sources/ide/eclipse/how_to_create_a_new_project_in_eclipse.txt +18 -18
  19. data/documentation/_build/html/_sources/ide/eclipse/how_to_create_a_workspace_in_eclipse.txt +27 -27
  20. data/documentation/_build/html/_sources/ide/eclipse/how_to_debug_in_eclipse.txt +38 -38
  21. data/documentation/_build/html/_sources/ide/eclipse/how_to_install_eclipse_plugin.txt +44 -44
  22. data/documentation/_build/html/_sources/ide/eclipse/how_to_use_bake_in_eclipse.txt +86 -86
  23. data/documentation/_build/html/_sources/ide/ide_integrations.txt +8 -8
  24. data/documentation/_build/html/_sources/ide/vs/how_to_create_vs_projects.txt +15 -15
  25. data/documentation/_build/html/_sources/ide/vs/how_to_debug_in_vs.txt +35 -35
  26. data/documentation/_build/html/_sources/ide/vs/how_to_used_bake_in_vs.txt +35 -35
  27. data/documentation/_build/html/_sources/ide/vs/vs.txt +10 -10
  28. data/documentation/_build/html/_sources/ide/vs/vs_install.txt +43 -43
  29. data/documentation/_build/html/_sources/index.txt +33 -33
  30. data/documentation/_build/html/_sources/install/install_bake.txt +112 -112
  31. data/documentation/_build/html/_sources/internal.txt +50 -50
  32. data/documentation/_build/html/_sources/known_issues.txt +9 -9
  33. data/documentation/_build/html/_sources/license.txt +4 -4
  34. data/documentation/_build/html/_sources/performance/performance.txt +104 -104
  35. data/documentation/_build/html/_sources/quickstart/quickstart.txt +70 -70
  36. data/documentation/_build/html/_sources/syntax/adapt_configs.txt +143 -143
  37. data/documentation/_build/html/_sources/syntax/auto_adjustment.txt +43 -43
  38. data/documentation/_build/html/_sources/syntax/derive_configs.txt +93 -94
  39. data/documentation/_build/html/_sources/syntax/project_meta_syntax.txt +19 -19
  40. data/documentation/_build/html/_sources/syntax/syntax.txt +11 -11
  41. data/documentation/_build/html/_sources/syntax/variable_substitutions.txt +147 -147
  42. data/documentation/_build/html/_sources/tips_and_tricks/dot.txt +34 -34
  43. data/documentation/_build/html/_sources/tips_and_tricks/how_to_use_bake_with_cygwin.txt +62 -62
  44. data/documentation/_build/html/_sources/tips_and_tricks/static_code_analysis.txt +122 -122
  45. data/documentation/_build/html/_sources/tips_and_tricks/the_bakery.txt +72 -72
  46. data/documentation/_build/html/_sources/tips_and_tricks/the_clang.txt +43 -43
  47. data/documentation/_build/html/_sources/tips_and_tricks/tips_and_tricks.txt +34 -34
  48. data/documentation/_build/html/_sources/why_bake/why_bake.txt +40 -40
  49. data/documentation/_build/html/changelog.html +7 -0
  50. data/documentation/_build/html/commandline/commandline.html +2 -2
  51. data/documentation/_build/html/concepts/link_order.html +2 -2
  52. data/documentation/_build/html/concepts/prebuild.html +2 -2
  53. data/documentation/_build/html/index.html +4 -4
  54. data/documentation/_build/html/performance/performance.html +2 -2
  55. data/documentation/_build/html/searchindex.js +1 -1
  56. data/documentation/_build/html/syntax/adapt_configs.html +2 -2
  57. data/documentation/_build/html/syntax/syntax.html +2 -2
  58. data/documentation/_build/html/tips_and_tricks/the_clang.html +2 -2
  59. data/documentation/_build/html/why_bake/why_bake.html +2 -2
  60. data/lib/adapt/config/loader.rb +112 -112
  61. data/lib/bake/bundle.rb +158 -158
  62. data/lib/bake/cache.rb +179 -180
  63. data/lib/bake/config/checks.rb +68 -68
  64. data/lib/bake/config/loader.rb +363 -363
  65. data/lib/bake/libElement.rb +176 -176
  66. data/lib/bake/mergeConfig.rb +208 -208
  67. data/lib/bake/model/language.rb +45 -45
  68. data/lib/bake/model/loader.rb +99 -99
  69. data/lib/bake/model/metamodel.rb +307 -307
  70. data/lib/bake/model/metamodel_ext.rb +27 -27
  71. data/lib/bake/options/create.rb +95 -95
  72. data/lib/bake/options/options.rb +315 -310
  73. data/lib/bake/options/showDoc.rb +20 -20
  74. data/lib/bake/options/showLicense.rb +9 -9
  75. data/lib/bake/options/showToolchains.rb +38 -38
  76. data/lib/bake/options/usage.rb +79 -68
  77. data/lib/bake/subst.rb +313 -313
  78. data/lib/bake/toolchain/clang.rb +44 -44
  79. data/lib/bake/toolchain/clang_analyze.rb +31 -31
  80. data/lib/bake/toolchain/colorizing_formatter.rb +125 -125
  81. data/lib/bake/toolchain/diab.rb +53 -53
  82. data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -40
  83. data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +41 -41
  84. data/lib/bake/toolchain/errorparser/error_parser.rb +71 -71
  85. data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -35
  86. data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +35 -35
  87. data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -32
  88. data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +44 -44
  89. data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -40
  90. data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +30 -30
  91. data/lib/bake/toolchain/errorparser/lint_error_parser.rb +34 -34
  92. data/lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb +63 -63
  93. data/lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb +42 -42
  94. data/lib/bake/toolchain/errorparser/process_output.rb +2 -2
  95. data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -30
  96. data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +30 -30
  97. data/lib/bake/toolchain/gcc.rb +49 -49
  98. data/lib/bake/toolchain/gcc_env.rb +55 -55
  99. data/lib/bake/toolchain/greenhills.rb +52 -52
  100. data/lib/bake/toolchain/keil.rb +53 -53
  101. data/lib/bake/toolchain/lint.rb +20 -20
  102. data/lib/bake/toolchain/msvc.rb +58 -58
  103. data/lib/bake/toolchain/provider.rb +146 -146
  104. data/lib/bake/toolchain/ti.rb +47 -47
  105. data/lib/bake/util.rb +149 -149
  106. data/lib/bakery/buildPattern.rb +24 -24
  107. data/lib/bakery/model/language.rb +22 -22
  108. data/lib/bakery/model/loader.rb +55 -55
  109. data/lib/bakery/model/metamodel.rb +48 -48
  110. data/lib/bakery/options/options.rb +87 -87
  111. data/lib/bakery/toBake.rb +81 -81
  112. data/lib/blocks/block.rb +324 -324
  113. data/lib/blocks/blockBase.rb +204 -204
  114. data/lib/blocks/commandLine.rb +38 -38
  115. data/lib/blocks/compile.rb +529 -528
  116. data/lib/blocks/convert.rb +41 -41
  117. data/lib/blocks/docu.rb +30 -30
  118. data/lib/blocks/executable.rb +174 -174
  119. data/lib/blocks/has_execute_command.rb +31 -31
  120. data/lib/blocks/library.rb +114 -114
  121. data/lib/blocks/lint.rb +56 -56
  122. data/lib/blocks/makefile.rb +100 -100
  123. data/lib/blocks/showIncludes.rb +140 -125
  124. data/lib/common/abortException.rb +4 -4
  125. data/lib/common/cleanup.rb +10 -10
  126. data/lib/common/exit_helper.rb +38 -38
  127. data/lib/common/ext/file.rb +88 -88
  128. data/lib/common/ext/rtext.rb +11 -11
  129. data/lib/common/ext/stdout.rb +45 -45
  130. data/lib/common/ide_interface.rb +194 -194
  131. data/lib/common/options/parser.rb +95 -85
  132. data/lib/common/process.rb +64 -64
  133. data/lib/common/utils.rb +52 -52
  134. data/lib/common/version.rb +31 -23
  135. data/lib/multithread/job.rb +44 -44
  136. data/lib/tocxx.rb +558 -555
  137. data/lib/vs/options.rb +69 -69
  138. data/license.txt +90 -90
  139. metadata +2 -2
@@ -1,27 +1,27 @@
1
- require 'bake/model/metamodel'
2
- require 'common/ext/file'
3
-
4
- module Bake
5
- module Metamodel
6
-
7
- module ModelElement::ClassModule
8
- def get_project_dir
9
- comp = self
10
- while comp.respond_to?"parent"
11
- comp = comp.parent
12
- end
13
- ::File.dirname(comp.file_name)
14
- end
15
- end
16
-
17
- module BaseConfig_INTERNAL::ClassModule
18
- def qname
19
- @qname ||= parent.name + "," + name
20
- end
21
- def dependency
22
- libStuff.find_all { |l| Dependency === l }
23
- end
24
- end
25
-
26
- end
27
- end
1
+ require 'bake/model/metamodel'
2
+ require 'common/ext/file'
3
+
4
+ module Bake
5
+ module Metamodel
6
+
7
+ module ModelElement::ClassModule
8
+ def get_project_dir
9
+ comp = self
10
+ while comp.respond_to?"parent"
11
+ comp = comp.parent
12
+ end
13
+ ::File.dirname(comp.file_name)
14
+ end
15
+ end
16
+
17
+ module BaseConfig_INTERNAL::ClassModule
18
+ def qname
19
+ @qname ||= parent.name + "," + name
20
+ end
21
+ def dependency
22
+ libStuff.find_all { |l| Dependency === l }
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -1,96 +1,96 @@
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
-
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
96
  end
@@ -1,310 +1,315 @@
1
- require 'bake/toolchain/colorizing_formatter'
2
- require 'common/options/parser'
3
- require 'bake/options/showToolchains'
4
- require 'bake/options/showLicense'
5
- require 'bake/options/showDoc'
6
- require 'bake/options/usage'
7
- require 'bake/options/create'
8
- require 'bake/bundle'
9
-
10
- module Bake
11
-
12
- def self.options
13
- @@options
14
- end
15
- def self.options=(options)
16
- @@options = options
17
- end
18
-
19
- class Options < Parser
20
- attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :envToolchain, :showConfigs
21
- attr_reader :main_dir, :project, :filename, :main_project_name, :cc2j_filename, :bundleDir, :buildDirDelimiter, :dot # String
22
- attr_reader :roots, :include_filter, :exclude_filter, :adapt # String List
23
- attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :linkOnly, :compileOnly, :no_autodir, :clobber, :lint, :docu, :debug, :prepro, :oldLinkOrder, :prebuild # Boolean
24
- attr_reader :threads, :socket, :lint_min, :lint_max # Fixnum
25
- attr_reader :vars # map
26
- attr_reader :verbose
27
- attr_reader :consoleOutput_fullnames, :consoleOutput_visualStudio
28
-
29
-
30
- def initialize(argv)
31
- super(argv)
32
-
33
- @dot = nil
34
- @prebuild = false
35
- @buildDirDelimiter = "/"
36
- @oldLinkOrder = false
37
- @conversion_info = false
38
- @envToolchain = false
39
- @analyze = false
40
- @eclipseOrder = false
41
- @showConfigs = false
42
- @consoleOutput_fullnames = false
43
- @consoleOutput_visualStudio = false
44
- @prepro = false
45
- @stopOnFirstError = false
46
- @verbose = 1
47
- @vars = {}
48
- @build_config = ""
49
- @main_dir = nil
50
- @project = nil
51
- @filename = nil
52
- @cc2j_filename = nil
53
- @clean = false
54
- @clobber = false
55
- @lint = false
56
- @docu = false
57
- @debug = false
58
- @rebuild = false
59
- @nocache = false
60
- @show_includes = false
61
- @show_includes_and_defines = false
62
- @linkOnly = false
63
- @compileOnly = false
64
- @no_autodir = false
65
- @threads = 8
66
- @lint_min = 0
67
- @lint_max = -1
68
- @roots = []
69
- @socket = 0
70
- @include_filter = []
71
- @exclude_filter = []
72
- @def_roots = []
73
- @main_project_name = ""
74
- @adapt = []
75
- @bundleDir = nil
76
-
77
- add_option(["-b", "" ], lambda { |x| set_build_config(x) })
78
- add_option(["-m" ], lambda { |x| set_main_dir(x) })
79
- add_option(["-p" ], lambda { |x| @project = x })
80
- add_option(["-f" ], lambda { |x| @filename = x.gsub(/[\\]/,'/') })
81
- add_option(["-c" ], lambda { @clean = true })
82
- add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
83
- add_option(["-w" ], lambda { |x| set_root(x) })
84
- add_option(["-r" ], lambda { @stopOnFirstError = true })
85
- add_option(["--rebuild" ], lambda { @rebuild = true })
86
- add_option(["--prepro" ], lambda { @prepro = true })
87
- add_option(["--link-only", "--link_only" ], lambda { @linkOnly = true; })
88
- add_option(["--compile-only", "--compile_only" ], lambda { @compileOnly = true; })
89
- add_option(["--no-autodir", "--no_autodir" ], lambda { @no_autodir = true })
90
- add_option(["--lint" ], lambda { @lint = true })
91
- add_option(["--lint-min", "--lint_min" ], lambda { |x| @lint_min = String === x ? x.to_i : x })
92
- add_option(["--lint-max", "--lint_max" ], lambda { |x| @lint_max = String === x ? x.to_i : x })
93
-
94
- add_option(["--create" ], lambda { |x| Bake::Create.proj(x) })
95
- add_option(["--conversion-info", "--conversion_info" ], lambda { @conversion_info = true })
96
-
97
- add_option(["--generate-doc", "--docu" ], lambda { @docu = true })
98
-
99
- add_option(["--adapt" ], lambda { |x| set_adapt(x) })
100
-
101
- add_option(["-v0" ], lambda { @verbose = 0 })
102
- add_option(["-v1" ], lambda { @verbose = 1 })
103
- add_option(["-v2" ], lambda { @verbose = 2 })
104
- add_option(["-v3" ], lambda { @verbose = 3 })
105
-
106
- add_option(["--debug" ], lambda { @debug = true })
107
- add_option(["--set" ], lambda { |x| set_set(x) })
108
-
109
- add_option(["--clobber" ], lambda { @clobber = true; @clean = true })
110
- add_option(["--ignore-cache", "--ignore_cache" ], lambda { @nocache = true })
111
- add_option(["-j", "--threads" ], lambda { |x| set_threads(x) })
112
- add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
113
- add_option(["--toolchain-info", "--toolchain_info" ], lambda { |x| ToolchainInfo.showToolchain(x) })
114
- add_option(["--toolchain-names", "--toolchain_names" ], lambda { ToolchainInfo.showToolchainList })
115
- add_option(["--dot", ], lambda { |x| @dot = x })
116
- add_option(["--do", "--include_filter" ], lambda { |x| @include_filter << x })
117
- add_option(["--omit", "--exclude_filter" ], lambda { |x| @exclude_filter << x })
118
- add_option(["--abs-paths", "--show_abs_paths" ], lambda { @consoleOutput_fullnames = true })
119
- add_option(["--bundle" ], lambda { |x| Bake::Usage.bundle })
120
- add_option(["--bundle" ], lambda { Bake::Usage.bundle })
121
- # add_option(["--bundle" ], lambda { |x| set_bundle_dir(x) })
122
- # OLD flag renamed in case someone uses this feature
123
- add_option(["--bundleDeprecated" ], lambda { |x| set_bundle_dir(x) })
124
- add_option(["--prebuild" ], lambda { @prebuild = true })
125
-
126
- add_option(["-h", "--help" ], lambda { Bake::Usage.show })
127
-
128
- add_option(["--incs-and-defs", "--show_incs_and_defs" ], lambda { @show_includes_and_defines = true })
129
- add_option(["--license", "--show_license" ], lambda { License.show })
130
- add_option(["--doc", "--show_doc" ], lambda { Doc.show })
131
-
132
- add_option(["--version" ], lambda { ExitHelper.exit(0) })
133
- add_option(["--list", "--show_configs" ], lambda { @showConfigs = true })
134
- add_option(["--writeCC2J" ], lambda { |x| @cc2j_filename = x.gsub(/[\\]/,'/') })
135
- add_option(["--link-2-17", "--link_2_17" ], lambda { @oldLinkOrder = true })
136
- add_option(["--build_", ], lambda { @buildDirDelimiter = "_" })
137
-
138
-
139
- # hidden
140
- add_option(["--visualStudio" ], lambda { @consoleOutput_visualStudio = true })
141
-
142
- # deprecated and not replaced by new command
143
- add_option(["--show_include_paths" ], lambda { @show_includes = true })
144
-
145
- end
146
-
147
- def parse_options()
148
- Bake::Bundle.instance.cleanup()
149
- parse_internal(false)
150
- set_main_dir(Dir.pwd) if @main_dir.nil?
151
- @roots = @def_roots if @roots.length == 0
152
- @roots.uniq!
153
- @adapt.uniq!
154
-
155
- if @project
156
- if @project.split(',').length > 2
157
- Bake.formatter.printError("Error: only one comma allowed for -p")
158
- ExitHelper.exit(1)
159
- end
160
- end
161
-
162
- if @conversion_info
163
- if @rebuild
164
- Bake.formatter.printError("Error: --conversion-info and --rebuild not allowed at the same time")
165
- ExitHelper.exit(1)
166
- end
167
- if @clean
168
- Bake.formatter.printError("Error: --conversion-info and -c not allowed at the same time")
169
- ExitHelper.exit(1)
170
- end
171
- if @prepro
172
- Bake.formatter.printError("Error: --conversion-info and --prepro not allowed at the same time")
173
- ExitHelper.exit(1)
174
- end
175
- if @linkOnly
176
- Bake.formatter.printError("Error: --conversion-info and --linkOnly not allowed at the same time")
177
- ExitHelper.exit(1)
178
- end
179
- if @compileOnly
180
- Bake.formatter.printError("Error: --conversion-info and --compileOnly not allowed at the same time")
181
- ExitHelper.exit(1)
182
- end
183
- if @lint
184
- Bake.formatter.printError("Error: --conversion-info and --lint not allowed at the same time")
185
- ExitHelper.exit(1)
186
- end
187
- if @docu
188
- Bake.formatter.printError("Error: --conversion-info and --docu not allowed at the same time")
189
- ExitHelper.exit(1)
190
- end
191
- if not @project
192
- Bake.formatter.printError("Error: --conversion-info must be used with -p")
193
- ExitHelper.exit(1)
194
- end
195
- end
196
-
197
- if @linkOnly
198
- if @rebuild
199
- Bake.formatter.printError("Error: --link-only and --rebuild not allowed at the same time")
200
- ExitHelper.exit(1)
201
- end
202
- if @clean
203
- Bake.formatter.printError("Error: --link-only and -c not allowed at the same time")
204
- ExitHelper.exit(1)
205
- end
206
- if @prepro
207
- Bake.formatter.printError("Error: --link-only and --prepro not allowed at the same time")
208
- ExitHelper.exit(1)
209
- end
210
- if @filename
211
- Bake.formatter.printError("Error: --link-only and --filename not allowed at the same time")
212
- ExitHelper.exit(1)
213
- end
214
- end
215
-
216
- if @compileOnly
217
- if @linkOnly
218
- Bake.formatter.printError("Error: --compile-only and --link-only not allowed at the same time")
219
- ExitHelper.exit(1)
220
- end
221
- if @filename
222
- Bake.formatter.printError("Error: --compile-only and --filename not allowed at the same time")
223
- ExitHelper.exit(1)
224
- end
225
- end
226
-
227
- if @prepro
228
- if @rebuild
229
- Bake.formatter.printError("Error: --prepro and --rebuild not allowed at the same time")
230
- ExitHelper.exit(1)
231
- end
232
- if @clean
233
- Bake.formatter.printError("Error: --prepro and -c not allowed at the same time")
234
- ExitHelper.exit(1)
235
- end
236
- end
237
-
238
- if @lint and @docu
239
- Bake.formatter.printError("Error: --lint and --docu not allowed at the same time")
240
- ExitHelper.exit(1)
241
- end
242
-
243
- @filename = "." if @compileOnly
244
-
245
- end
246
-
247
- def check_valid_dir(dir)
248
- if not File.exists?(dir)
249
- Bake.formatter.printError("Error: Directory #{dir} does not exist")
250
- ExitHelper.exit(1)
251
- end
252
- if not File.directory?(dir)
253
- Bake.formatter.printError("Error: #{dir} is not a directory")
254
- ExitHelper.exit(1)
255
- end
256
- end
257
-
258
- def set_build_config(config)
259
- if not @build_config.empty?
260
- Bake.formatter.printError("Error: Cannot set build config '#{config}', because build config is already set to '#{@build_config}'")
261
- ExitHelper.exit(1)
262
- end
263
- @build_config = config
264
- end
265
-
266
- def set_main_dir(dir)
267
- check_valid_dir(dir)
268
- @main_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
269
- @main_project_name = File::basename(@main_dir)
270
- @def_roots = calc_def_roots(@main_dir)
271
- end
272
-
273
- def set_bundle_dir(dir)
274
- d = File.expand_path(dir.gsub(/[\\]/,'/'))
275
- Bake::Bundle.instance.setOutputDir(d)
276
- end
277
-
278
-
279
- def set_root(dir)
280
- check_valid_dir(dir)
281
- r = File.expand_path(dir.gsub(/[\\]/,'/'))
282
- @roots << r if not @roots.include?r
283
- end
284
-
285
- def set_adapt(name)
286
- @adapt << name if not @adapt.include?name
287
- end
288
-
289
- def set_threads(num)
290
- @threads = String === num ? num.to_i : num
291
- if @threads <= 0
292
- Bake.formatter.printError("Error: number of threads must be > 0")
293
- ExitHelper.exit(1)
294
- end
295
- end
296
-
297
- def set_set(str)
298
- ar = str.split("=")
299
- if not str.include?"=" or ar[0].length == 0
300
- Bake.formatter.printError("Error: --set must be followed by key=value")
301
- ExitHelper.exit(1)
302
- end
303
- @vars[ar[0]] = ar[1..-1].join("=")
304
- end
305
-
306
- end
307
-
308
- end
309
-
310
-
1
+ require 'bake/toolchain/colorizing_formatter'
2
+ require 'common/options/parser'
3
+ require 'bake/options/showToolchains'
4
+ require 'bake/options/showLicense'
5
+ require 'bake/options/showDoc'
6
+ require 'bake/options/usage'
7
+ require 'bake/options/create'
8
+ require 'bake/bundle'
9
+
10
+ module Bake
11
+
12
+ def self.options
13
+ @@options
14
+ end
15
+ def self.options=(options)
16
+ @@options = options
17
+ end
18
+
19
+ class Options < Parser
20
+ attr_accessor :build_config, :nocache, :analyze, :eclipseOrder, :envToolchain, :showConfigs
21
+ attr_reader :main_dir, :project, :filename, :main_project_name, :bundleDir, :buildDirDelimiter, :dot, :cc2j_filename # String
22
+ attr_reader :roots, :include_filter, :exclude_filter, :adapt # String List
23
+ attr_reader :conversion_info, :stopOnFirstError, :clean, :rebuild, :show_includes, :show_includes_and_defines, :linkOnly, :compileOnly, :no_autodir, :clobber, :lint, :docu, :debug, :prepro, :oldLinkOrder, :prebuild, :printTime, :json # Boolean
24
+ attr_reader :threads, :socket, :lint_min, :lint_max # Fixnum
25
+ attr_reader :vars # map
26
+ attr_reader :verbose
27
+ attr_reader :consoleOutput_fullnames, :consoleOutput_visualStudio
28
+
29
+
30
+ def initialize(argv)
31
+ super(argv)
32
+
33
+ @dot = nil
34
+ @prebuild = false
35
+ @printTime = false
36
+ @buildDirDelimiter = "/"
37
+ @oldLinkOrder = false
38
+ @conversion_info = false
39
+ @envToolchain = false
40
+ @analyze = false
41
+ @eclipseOrder = false
42
+ @showConfigs = false
43
+ @consoleOutput_fullnames = false
44
+ @consoleOutput_visualStudio = false
45
+ @prepro = false
46
+ @stopOnFirstError = false
47
+ @verbose = 1
48
+ @vars = {}
49
+ @build_config = ""
50
+ @main_dir = nil
51
+ @project = nil
52
+ @filename = nil
53
+ @cc2j_filename = nil
54
+ @json = false
55
+ @clean = false
56
+ @clobber = false
57
+ @lint = false
58
+ @docu = false
59
+ @debug = false
60
+ @rebuild = false
61
+ @nocache = false
62
+ @show_includes = false
63
+ @show_includes_and_defines = false
64
+ @linkOnly = false
65
+ @compileOnly = false
66
+ @no_autodir = false
67
+ @threads = 8
68
+ @lint_min = 0
69
+ @lint_max = -1
70
+ @roots = []
71
+ @socket = 0
72
+ @include_filter = []
73
+ @exclude_filter = []
74
+ @def_roots = []
75
+ @main_project_name = ""
76
+ @adapt = []
77
+ @bundleDir = nil
78
+
79
+ add_option(["-b", "" ], lambda { |x| set_build_config(x) })
80
+ add_option(["-m" ], lambda { |x| set_main_dir(x) })
81
+ add_option(["-p" ], lambda { |x| @project = x })
82
+ add_option(["-f" ], lambda { |x| @filename = x.gsub(/[\\]/,'/') })
83
+ add_option(["-c" ], lambda { @clean = true })
84
+ add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
85
+ add_option(["-w" ], lambda { |x| set_root(x) })
86
+ add_option(["-r" ], lambda { @stopOnFirstError = true })
87
+ add_option(["--rebuild" ], lambda { @rebuild = true })
88
+ add_option(["--prepro" ], lambda { @prepro = true })
89
+ add_option(["--link-only", "--link_only" ], lambda { @linkOnly = true; })
90
+ add_option(["--compile-only", "--compile_only" ], lambda { @compileOnly = true; })
91
+ add_option(["--no-autodir", "--no_autodir" ], lambda { @no_autodir = true })
92
+ add_option(["--lint" ], lambda { @lint = true })
93
+ add_option(["--lint-min", "--lint_min" ], lambda { |x| @lint_min = String === x ? x.to_i : x })
94
+ add_option(["--lint-max", "--lint_max" ], lambda { |x| @lint_max = String === x ? x.to_i : x })
95
+
96
+ add_option(["--create" ], lambda { |x| Bake::Create.proj(x) })
97
+ add_option(["--conversion-info", "--conversion_info" ], lambda { @conversion_info = true })
98
+
99
+ add_option(["--generate-doc", "--docu" ], lambda { @docu = true })
100
+
101
+ add_option(["--adapt" ], lambda { |x| set_adapt(x) })
102
+
103
+ add_option(["-v0" ], lambda { @verbose = 0 })
104
+ add_option(["-v1" ], lambda { @verbose = 1 })
105
+ add_option(["-v2" ], lambda { @verbose = 2 })
106
+ add_option(["-v3" ], lambda { @verbose = 3 })
107
+
108
+ add_option(["--debug" ], lambda { @debug = true })
109
+ add_option(["--set" ], lambda { |x| set_set(x) })
110
+
111
+ add_option(["--clobber" ], lambda { @clobber = true; @clean = true })
112
+ add_option(["--ignore-cache", "--ignore_cache" ], lambda { @nocache = true })
113
+ add_option(["-j", "--threads" ], lambda { |x| set_threads(x) })
114
+ add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
115
+ add_option(["--toolchain-info", "--toolchain_info" ], lambda { |x| ToolchainInfo.showToolchain(x) })
116
+ add_option(["--toolchain-names", "--toolchain_names" ], lambda { ToolchainInfo.showToolchainList })
117
+ add_option(["--dot", ], lambda { |x| @dot = x })
118
+ add_option(["--do", "--include_filter" ], lambda { |x| @include_filter << x })
119
+ add_option(["--omit", "--exclude_filter" ], lambda { |x| @exclude_filter << x })
120
+ add_option(["--abs-paths", "--show_abs_paths" ], lambda { @consoleOutput_fullnames = true })
121
+ add_option(["--bundle" ], lambda { |x| Bake::Usage.bundle })
122
+ add_option(["--bundle" ], lambda { Bake::Usage.bundle })
123
+ # add_option(["--bundle" ], lambda { |x| set_bundle_dir(x) })
124
+ # OLD flag renamed in case someone uses this feature
125
+ add_option(["--bundleDeprecated" ], lambda { |x| set_bundle_dir(x) })
126
+ add_option(["--prebuild" ], lambda { @prebuild = true })
127
+
128
+ add_option(["-h", "--help" ], lambda { Bake::Usage.show })
129
+ add_option(["--time", ], lambda { @printTime = true })
130
+
131
+ add_option(["--incs-and-defs", "--show_incs_and_defs" ], lambda { @show_includes_and_defines = true })
132
+ add_option(["--incs-and-defs=bake", ], lambda { @show_includes_and_defines = true })
133
+ add_option(["--incs-and-defs=json" ], lambda { @show_includes_and_defines=true; @json=true })
134
+ add_option(["--license", "--show_license" ], lambda { License.show })
135
+ add_option(["--doc", "--show_doc" ], lambda { Doc.show })
136
+
137
+ add_option(["--version" ], lambda { Bake::Usage.version })
138
+ add_option(["--list", "--show_configs" ], lambda { @showConfigs = true })
139
+ add_option(["--compilation-db" ], lambda { |x,dummy| @cc2j_filename = (x ? x : "compilation-db.json" )})
140
+ add_option(["--link-2-17", "--link_2_17" ], lambda { @oldLinkOrder = true })
141
+ add_option(["--build_", ], lambda { @buildDirDelimiter = "_" })
142
+
143
+
144
+ # hidden
145
+ add_option(["--visualStudio" ], lambda { @consoleOutput_visualStudio = true })
146
+
147
+ # deprecated and not replaced by new command
148
+ add_option(["--show_include_paths" ], lambda { @show_includes = true })
149
+
150
+ end
151
+
152
+ def parse_options()
153
+ Bake::Bundle.instance.cleanup()
154
+ parse_internal(false)
155
+ set_main_dir(Dir.pwd) if @main_dir.nil?
156
+ @roots = @def_roots if @roots.length == 0
157
+ @roots.uniq!
158
+ @adapt.uniq!
159
+
160
+ if @project
161
+ if @project.split(',').length > 2
162
+ Bake.formatter.printError("Error: only one comma allowed for -p")
163
+ ExitHelper.exit(1)
164
+ end
165
+ end
166
+
167
+ if @conversion_info
168
+ if @rebuild
169
+ Bake.formatter.printError("Error: --conversion-info and --rebuild not allowed at the same time")
170
+ ExitHelper.exit(1)
171
+ end
172
+ if @clean
173
+ Bake.formatter.printError("Error: --conversion-info and -c not allowed at the same time")
174
+ ExitHelper.exit(1)
175
+ end
176
+ if @prepro
177
+ Bake.formatter.printError("Error: --conversion-info and --prepro not allowed at the same time")
178
+ ExitHelper.exit(1)
179
+ end
180
+ if @linkOnly
181
+ Bake.formatter.printError("Error: --conversion-info and --linkOnly not allowed at the same time")
182
+ ExitHelper.exit(1)
183
+ end
184
+ if @compileOnly
185
+ Bake.formatter.printError("Error: --conversion-info and --compileOnly not allowed at the same time")
186
+ ExitHelper.exit(1)
187
+ end
188
+ if @lint
189
+ Bake.formatter.printError("Error: --conversion-info and --lint not allowed at the same time")
190
+ ExitHelper.exit(1)
191
+ end
192
+ if @docu
193
+ Bake.formatter.printError("Error: --conversion-info and --docu not allowed at the same time")
194
+ ExitHelper.exit(1)
195
+ end
196
+ if not @project
197
+ Bake.formatter.printError("Error: --conversion-info must be used with -p")
198
+ ExitHelper.exit(1)
199
+ end
200
+ end
201
+
202
+ if @linkOnly
203
+ if @rebuild
204
+ Bake.formatter.printError("Error: --link-only and --rebuild not allowed at the same time")
205
+ ExitHelper.exit(1)
206
+ end
207
+ if @clean
208
+ Bake.formatter.printError("Error: --link-only and -c not allowed at the same time")
209
+ ExitHelper.exit(1)
210
+ end
211
+ if @prepro
212
+ Bake.formatter.printError("Error: --link-only and --prepro not allowed at the same time")
213
+ ExitHelper.exit(1)
214
+ end
215
+ if @filename
216
+ Bake.formatter.printError("Error: --link-only and --filename not allowed at the same time")
217
+ ExitHelper.exit(1)
218
+ end
219
+ end
220
+
221
+ if @compileOnly
222
+ if @linkOnly
223
+ Bake.formatter.printError("Error: --compile-only and --link-only not allowed at the same time")
224
+ ExitHelper.exit(1)
225
+ end
226
+ if @filename
227
+ Bake.formatter.printError("Error: --compile-only and --filename not allowed at the same time")
228
+ ExitHelper.exit(1)
229
+ end
230
+ end
231
+
232
+ if @prepro
233
+ if @rebuild
234
+ Bake.formatter.printError("Error: --prepro and --rebuild not allowed at the same time")
235
+ ExitHelper.exit(1)
236
+ end
237
+ if @clean
238
+ Bake.formatter.printError("Error: --prepro and -c not allowed at the same time")
239
+ ExitHelper.exit(1)
240
+ end
241
+ end
242
+
243
+ if @lint and @docu
244
+ Bake.formatter.printError("Error: --lint and --docu not allowed at the same time")
245
+ ExitHelper.exit(1)
246
+ end
247
+
248
+ @filename = "." if @compileOnly
249
+
250
+ end
251
+
252
+ def check_valid_dir(dir)
253
+ if not File.exists?(dir)
254
+ Bake.formatter.printError("Error: Directory #{dir} does not exist")
255
+ ExitHelper.exit(1)
256
+ end
257
+ if not File.directory?(dir)
258
+ Bake.formatter.printError("Error: #{dir} is not a directory")
259
+ ExitHelper.exit(1)
260
+ end
261
+ end
262
+
263
+ def set_build_config(config)
264
+ if not @build_config.empty?
265
+ Bake.formatter.printError("Error: Cannot set build config '#{config}', because build config is already set to '#{@build_config}'")
266
+ ExitHelper.exit(1)
267
+ end
268
+ @build_config = config
269
+ end
270
+
271
+ def set_main_dir(dir)
272
+ check_valid_dir(dir)
273
+ @main_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
274
+ @main_project_name = File::basename(@main_dir)
275
+ @def_roots = calc_def_roots(@main_dir)
276
+ end
277
+
278
+ def set_bundle_dir(dir)
279
+ d = File.expand_path(dir.gsub(/[\\]/,'/'))
280
+ Bake::Bundle.instance.setOutputDir(d)
281
+ end
282
+
283
+
284
+ def set_root(dir)
285
+ check_valid_dir(dir)
286
+ r = File.expand_path(dir.gsub(/[\\]/,'/'))
287
+ @roots << r if not @roots.include?r
288
+ end
289
+
290
+ def set_adapt(name)
291
+ @adapt << name if not @adapt.include?name
292
+ end
293
+
294
+ def set_threads(num)
295
+ @threads = String === num ? num.to_i : num
296
+ if @threads <= 0
297
+ Bake.formatter.printError("Error: number of threads must be > 0")
298
+ ExitHelper.exit(1)
299
+ end
300
+ end
301
+
302
+ def set_set(str)
303
+ ar = str.split("=")
304
+ if not str.include?"=" or ar[0].length == 0
305
+ Bake.formatter.printError("Error: --set must be followed by key=value")
306
+ ExitHelper.exit(1)
307
+ end
308
+ @vars[ar[0]] = ar[1..-1].join("=")
309
+ end
310
+
311
+ end
312
+
313
+ end
314
+
315
+