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.
- checksums.yaml +4 -4
- data/Rakefile.rb +3 -3
- data/bin/bake +46 -46
- data/bin/bake-doc +11 -11
- data/bin/bakery +179 -179
- data/bin/createVSProjects +213 -213
- data/documentation/_build/html/_sources/changelog.txt +456 -451
- data/documentation/_build/html/_sources/commandline/commandline.txt +107 -107
- data/documentation/_build/html/_sources/concepts/build_hierarchy.txt +34 -34
- data/documentation/_build/html/_sources/concepts/concepts.txt +14 -14
- data/documentation/_build/html/_sources/concepts/inject.txt +65 -65
- data/documentation/_build/html/_sources/concepts/link_order.txt +91 -91
- data/documentation/_build/html/_sources/concepts/prebuild.txt +56 -56
- data/documentation/_build/html/_sources/concepts/the_main_project.txt +45 -45
- data/documentation/_build/html/_sources/concepts/the_project_meta_file.txt +72 -72
- data/documentation/_build/html/_sources/ide/eclipse/eclipse.txt +25 -25
- data/documentation/_build/html/_sources/ide/eclipse/how_to_convert_existing_cdt_workspace.txt +31 -31
- data/documentation/_build/html/_sources/ide/eclipse/how_to_create_a_new_project_in_eclipse.txt +18 -18
- data/documentation/_build/html/_sources/ide/eclipse/how_to_create_a_workspace_in_eclipse.txt +27 -27
- data/documentation/_build/html/_sources/ide/eclipse/how_to_debug_in_eclipse.txt +38 -38
- data/documentation/_build/html/_sources/ide/eclipse/how_to_install_eclipse_plugin.txt +44 -44
- data/documentation/_build/html/_sources/ide/eclipse/how_to_use_bake_in_eclipse.txt +86 -86
- data/documentation/_build/html/_sources/ide/ide_integrations.txt +8 -8
- data/documentation/_build/html/_sources/ide/vs/how_to_create_vs_projects.txt +15 -15
- data/documentation/_build/html/_sources/ide/vs/how_to_debug_in_vs.txt +35 -35
- data/documentation/_build/html/_sources/ide/vs/how_to_used_bake_in_vs.txt +35 -35
- data/documentation/_build/html/_sources/ide/vs/vs.txt +10 -10
- data/documentation/_build/html/_sources/ide/vs/vs_install.txt +43 -43
- data/documentation/_build/html/_sources/index.txt +33 -33
- data/documentation/_build/html/_sources/install/install_bake.txt +112 -112
- data/documentation/_build/html/_sources/internal.txt +50 -50
- data/documentation/_build/html/_sources/known_issues.txt +9 -9
- data/documentation/_build/html/_sources/license.txt +4 -4
- data/documentation/_build/html/_sources/performance/performance.txt +104 -104
- data/documentation/_build/html/_sources/quickstart/quickstart.txt +70 -70
- data/documentation/_build/html/_sources/syntax/adapt_configs.txt +143 -143
- data/documentation/_build/html/_sources/syntax/auto_adjustment.txt +43 -43
- data/documentation/_build/html/_sources/syntax/derive_configs.txt +93 -94
- data/documentation/_build/html/_sources/syntax/project_meta_syntax.txt +19 -19
- data/documentation/_build/html/_sources/syntax/syntax.txt +11 -11
- data/documentation/_build/html/_sources/syntax/variable_substitutions.txt +147 -147
- data/documentation/_build/html/_sources/tips_and_tricks/dot.txt +34 -34
- data/documentation/_build/html/_sources/tips_and_tricks/how_to_use_bake_with_cygwin.txt +62 -62
- data/documentation/_build/html/_sources/tips_and_tricks/static_code_analysis.txt +122 -122
- data/documentation/_build/html/_sources/tips_and_tricks/the_bakery.txt +72 -72
- data/documentation/_build/html/_sources/tips_and_tricks/the_clang.txt +43 -43
- data/documentation/_build/html/_sources/tips_and_tricks/tips_and_tricks.txt +34 -34
- data/documentation/_build/html/_sources/why_bake/why_bake.txt +40 -40
- data/documentation/_build/html/changelog.html +7 -0
- data/documentation/_build/html/commandline/commandline.html +2 -2
- data/documentation/_build/html/concepts/link_order.html +2 -2
- data/documentation/_build/html/concepts/prebuild.html +2 -2
- data/documentation/_build/html/index.html +4 -4
- data/documentation/_build/html/performance/performance.html +2 -2
- data/documentation/_build/html/searchindex.js +1 -1
- data/documentation/_build/html/syntax/adapt_configs.html +2 -2
- data/documentation/_build/html/syntax/syntax.html +2 -2
- data/documentation/_build/html/tips_and_tricks/the_clang.html +2 -2
- data/documentation/_build/html/why_bake/why_bake.html +2 -2
- data/lib/adapt/config/loader.rb +112 -112
- data/lib/bake/bundle.rb +158 -158
- data/lib/bake/cache.rb +179 -180
- data/lib/bake/config/checks.rb +68 -68
- data/lib/bake/config/loader.rb +363 -363
- data/lib/bake/libElement.rb +176 -176
- data/lib/bake/mergeConfig.rb +208 -208
- data/lib/bake/model/language.rb +45 -45
- data/lib/bake/model/loader.rb +99 -99
- data/lib/bake/model/metamodel.rb +307 -307
- data/lib/bake/model/metamodel_ext.rb +27 -27
- data/lib/bake/options/create.rb +95 -95
- data/lib/bake/options/options.rb +315 -310
- data/lib/bake/options/showDoc.rb +20 -20
- data/lib/bake/options/showLicense.rb +9 -9
- data/lib/bake/options/showToolchains.rb +38 -38
- data/lib/bake/options/usage.rb +79 -68
- data/lib/bake/subst.rb +313 -313
- data/lib/bake/toolchain/clang.rb +44 -44
- data/lib/bake/toolchain/clang_analyze.rb +31 -31
- data/lib/bake/toolchain/colorizing_formatter.rb +125 -125
- data/lib/bake/toolchain/diab.rb +53 -53
- data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -40
- data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +41 -41
- data/lib/bake/toolchain/errorparser/error_parser.rb +71 -71
- data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -35
- data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +35 -35
- data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -32
- data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +44 -44
- data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -40
- data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +30 -30
- data/lib/bake/toolchain/errorparser/lint_error_parser.rb +34 -34
- data/lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb +63 -63
- data/lib/bake/toolchain/errorparser/msvc_linker_error_parser.rb +42 -42
- data/lib/bake/toolchain/errorparser/process_output.rb +2 -2
- data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -30
- data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +30 -30
- data/lib/bake/toolchain/gcc.rb +49 -49
- data/lib/bake/toolchain/gcc_env.rb +55 -55
- data/lib/bake/toolchain/greenhills.rb +52 -52
- data/lib/bake/toolchain/keil.rb +53 -53
- data/lib/bake/toolchain/lint.rb +20 -20
- data/lib/bake/toolchain/msvc.rb +58 -58
- data/lib/bake/toolchain/provider.rb +146 -146
- data/lib/bake/toolchain/ti.rb +47 -47
- data/lib/bake/util.rb +149 -149
- data/lib/bakery/buildPattern.rb +24 -24
- data/lib/bakery/model/language.rb +22 -22
- data/lib/bakery/model/loader.rb +55 -55
- data/lib/bakery/model/metamodel.rb +48 -48
- data/lib/bakery/options/options.rb +87 -87
- data/lib/bakery/toBake.rb +81 -81
- data/lib/blocks/block.rb +324 -324
- data/lib/blocks/blockBase.rb +204 -204
- data/lib/blocks/commandLine.rb +38 -38
- data/lib/blocks/compile.rb +529 -528
- data/lib/blocks/convert.rb +41 -41
- data/lib/blocks/docu.rb +30 -30
- data/lib/blocks/executable.rb +174 -174
- data/lib/blocks/has_execute_command.rb +31 -31
- data/lib/blocks/library.rb +114 -114
- data/lib/blocks/lint.rb +56 -56
- data/lib/blocks/makefile.rb +100 -100
- data/lib/blocks/showIncludes.rb +140 -125
- data/lib/common/abortException.rb +4 -4
- data/lib/common/cleanup.rb +10 -10
- data/lib/common/exit_helper.rb +38 -38
- data/lib/common/ext/file.rb +88 -88
- data/lib/common/ext/rtext.rb +11 -11
- data/lib/common/ext/stdout.rb +45 -45
- data/lib/common/ide_interface.rb +194 -194
- data/lib/common/options/parser.rb +95 -85
- data/lib/common/process.rb +64 -64
- data/lib/common/utils.rb +52 -52
- data/lib/common/version.rb +31 -23
- data/lib/multithread/job.rb +44 -44
- data/lib/tocxx.rb +558 -555
- data/lib/vs/options.rb +69 -69
- data/license.txt +90 -90
- 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
|
data/lib/bake/options/create.rb
CHANGED
|
@@ -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
|
data/lib/bake/options/options.rb
CHANGED
|
@@ -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, :
|
|
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
|
-
@
|
|
36
|
-
@
|
|
37
|
-
@
|
|
38
|
-
@
|
|
39
|
-
@
|
|
40
|
-
@
|
|
41
|
-
@
|
|
42
|
-
@
|
|
43
|
-
@
|
|
44
|
-
@
|
|
45
|
-
@
|
|
46
|
-
@
|
|
47
|
-
@
|
|
48
|
-
@
|
|
49
|
-
@
|
|
50
|
-
@
|
|
51
|
-
@
|
|
52
|
-
@
|
|
53
|
-
@
|
|
54
|
-
@
|
|
55
|
-
@
|
|
56
|
-
@
|
|
57
|
-
@
|
|
58
|
-
@
|
|
59
|
-
@
|
|
60
|
-
@
|
|
61
|
-
@
|
|
62
|
-
@
|
|
63
|
-
@
|
|
64
|
-
@
|
|
65
|
-
@
|
|
66
|
-
@
|
|
67
|
-
@
|
|
68
|
-
@
|
|
69
|
-
@
|
|
70
|
-
@
|
|
71
|
-
@
|
|
72
|
-
@
|
|
73
|
-
@
|
|
74
|
-
@
|
|
75
|
-
@
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
add_option(["-
|
|
80
|
-
add_option(["-
|
|
81
|
-
add_option(["-
|
|
82
|
-
add_option(["-
|
|
83
|
-
add_option(["-
|
|
84
|
-
add_option(["-
|
|
85
|
-
add_option(["
|
|
86
|
-
add_option(["
|
|
87
|
-
add_option(["--
|
|
88
|
-
add_option(["--
|
|
89
|
-
add_option(["--
|
|
90
|
-
add_option(["--
|
|
91
|
-
add_option(["--
|
|
92
|
-
add_option(["--lint
|
|
93
|
-
|
|
94
|
-
add_option(["--
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
add_option(["--
|
|
98
|
-
|
|
99
|
-
add_option(["--
|
|
100
|
-
|
|
101
|
-
add_option(["
|
|
102
|
-
|
|
103
|
-
add_option(["-
|
|
104
|
-
add_option(["-
|
|
105
|
-
|
|
106
|
-
add_option(["
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
add_option(["--
|
|
110
|
-
|
|
111
|
-
add_option(["
|
|
112
|
-
add_option(["--
|
|
113
|
-
add_option(["
|
|
114
|
-
add_option(["--
|
|
115
|
-
add_option(["--
|
|
116
|
-
add_option(["--
|
|
117
|
-
add_option(["--
|
|
118
|
-
add_option(["--
|
|
119
|
-
add_option(["--
|
|
120
|
-
add_option(["--
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
add_option(["--
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
add_option(["
|
|
127
|
-
|
|
128
|
-
add_option(["
|
|
129
|
-
add_option(["--
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
add_option(["--
|
|
133
|
-
add_option(["--
|
|
134
|
-
add_option(["--
|
|
135
|
-
add_option(["--
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
add_option(["--
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if @
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
@
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
@
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if @
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
|
+
|