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
data/lib/bake/config/checks.rb
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
module Bake
|
|
2
|
-
module Configs
|
|
3
|
-
|
|
4
|
-
class Checks
|
|
5
|
-
|
|
6
|
-
def self.symlinkCheck(filename)
|
|
7
|
-
dirOfProjMeta = File.dirname(filename)
|
|
8
|
-
Dir.chdir(dirOfProjMeta) do
|
|
9
|
-
if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
|
|
10
|
-
isSym = false
|
|
11
|
-
begin
|
|
12
|
-
isSym = File.symlink?(dirOfProjMeta)
|
|
13
|
-
rescue
|
|
14
|
-
end
|
|
15
|
-
if isSym
|
|
16
|
-
Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
|
|
17
|
-
ExitHelper.exit(1)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def self.commonMetamodelCheck(configs, filename)
|
|
24
|
-
|
|
25
|
-
if configs.length == 0
|
|
26
|
-
Bake.formatter.printError("No config found", filename)
|
|
27
|
-
ExitHelper.exit(1)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
configs.each do |config|
|
|
31
|
-
if config.respond_to?("toolchain") and config.toolchain
|
|
32
|
-
config.toolchain.compiler.each do |c|
|
|
33
|
-
if not c.internalDefines.nil? and c.internalDefines != ""
|
|
34
|
-
Bake.formatter.printError("InternalDefines only allowed in DefaultToolchain", c.internalDefines)
|
|
35
|
-
ExitHelper.exit(1)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
config.includeDir.each do |inc|
|
|
41
|
-
if not ["front", "back", ""].include?inc.inject
|
|
42
|
-
Bake.formatter.printError("inject of IncludeDir must be 'front' or 'back'", inc)
|
|
43
|
-
ExitHelper.exit(1)
|
|
44
|
-
end
|
|
45
|
-
if not ["front", "back", ""].include?inc.infix
|
|
46
|
-
Bake.formatter.printError("infix of IncludeDir must be 'front' or 'back'", inc)
|
|
47
|
-
ExitHelper.exit(1)
|
|
48
|
-
end
|
|
49
|
-
if (inc.infix != "" and inc.inject != "")
|
|
50
|
-
Bake.formatter.printError("IncludeDir must have inject OR infix (deprecated)", inc)
|
|
51
|
-
ExitHelper.exit(1)
|
|
52
|
-
end
|
|
53
|
-
end if config.respond_to?("includeDir")
|
|
54
|
-
|
|
55
|
-
config.dependency.each do |d|
|
|
56
|
-
if not ["front", "back", ""].include?d.inject
|
|
57
|
-
Bake.formatter.printError("inject of Dependency must be 'front' or 'back'", d)
|
|
58
|
-
ExitHelper.exit(1)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
1
|
+
module Bake
|
|
2
|
+
module Configs
|
|
3
|
+
|
|
4
|
+
class Checks
|
|
5
|
+
|
|
6
|
+
def self.symlinkCheck(filename)
|
|
7
|
+
dirOfProjMeta = File.dirname(filename)
|
|
8
|
+
Dir.chdir(dirOfProjMeta) do
|
|
9
|
+
if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
|
|
10
|
+
isSym = false
|
|
11
|
+
begin
|
|
12
|
+
isSym = File.symlink?(dirOfProjMeta)
|
|
13
|
+
rescue
|
|
14
|
+
end
|
|
15
|
+
if isSym
|
|
16
|
+
Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
|
|
17
|
+
ExitHelper.exit(1)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.commonMetamodelCheck(configs, filename)
|
|
24
|
+
|
|
25
|
+
if configs.length == 0
|
|
26
|
+
Bake.formatter.printError("No config found", filename)
|
|
27
|
+
ExitHelper.exit(1)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
configs.each do |config|
|
|
31
|
+
if config.respond_to?("toolchain") and config.toolchain
|
|
32
|
+
config.toolchain.compiler.each do |c|
|
|
33
|
+
if not c.internalDefines.nil? and c.internalDefines != ""
|
|
34
|
+
Bake.formatter.printError("InternalDefines only allowed in DefaultToolchain", c.internalDefines)
|
|
35
|
+
ExitHelper.exit(1)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
config.includeDir.each do |inc|
|
|
41
|
+
if not ["front", "back", ""].include?inc.inject
|
|
42
|
+
Bake.formatter.printError("inject of IncludeDir must be 'front' or 'back'", inc)
|
|
43
|
+
ExitHelper.exit(1)
|
|
44
|
+
end
|
|
45
|
+
if not ["front", "back", ""].include?inc.infix
|
|
46
|
+
Bake.formatter.printError("infix of IncludeDir must be 'front' or 'back'", inc)
|
|
47
|
+
ExitHelper.exit(1)
|
|
48
|
+
end
|
|
49
|
+
if (inc.infix != "" and inc.inject != "")
|
|
50
|
+
Bake.formatter.printError("IncludeDir must have inject OR infix (deprecated)", inc)
|
|
51
|
+
ExitHelper.exit(1)
|
|
52
|
+
end
|
|
53
|
+
end if config.respond_to?("includeDir")
|
|
54
|
+
|
|
55
|
+
config.dependency.each do |d|
|
|
56
|
+
if not ["front", "back", ""].include?d.inject
|
|
57
|
+
Bake.formatter.printError("inject of Dependency must be 'front' or 'back'", d)
|
|
58
|
+
ExitHelper.exit(1)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
69
|
end
|
data/lib/bake/config/loader.rb
CHANGED
|
@@ -1,363 +1,363 @@
|
|
|
1
|
-
require 'bake/model/loader'
|
|
2
|
-
require 'bake/config/checks'
|
|
3
|
-
|
|
4
|
-
module Bake
|
|
5
|
-
|
|
6
|
-
class Config
|
|
7
|
-
attr_reader :referencedConfigs
|
|
8
|
-
|
|
9
|
-
def getFullProjectInternal(configs, configname, isMain) # note: configs is never empty
|
|
10
|
-
|
|
11
|
-
if (configname == "")
|
|
12
|
-
if configs[0].parent.default != ""
|
|
13
|
-
configname = configs[0].parent.default
|
|
14
|
-
else
|
|
15
|
-
Bake.formatter.printError("No default config specified", configs[0].file_name)
|
|
16
|
-
ExitHelper.exit(1)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
config = nil
|
|
21
|
-
configs.each do |c|
|
|
22
|
-
if c.name == configname
|
|
23
|
-
if config
|
|
24
|
-
Bake.formatter.printError("Config '#{configname}' found more than once",config.file_name)
|
|
25
|
-
ExitHelper.exit(1)
|
|
26
|
-
end
|
|
27
|
-
config = c
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
if not config
|
|
32
|
-
Bake.formatter.printError("Config '#{configname}' not found", configs[0].file_name)
|
|
33
|
-
ExitHelper.exit(1)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
if config.extends != ""
|
|
37
|
-
config.extends.split(",").map {|ex| ex.strip}.reverse.each do |ex|
|
|
38
|
-
if (ex != "")
|
|
39
|
-
parent,parentConfigName = getFullProjectInternal(configs, ex, isMain)
|
|
40
|
-
MergeConfig.new(config, parent).merge(:merge)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
[config, configname]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def getFullProject(configs, configname, isMain)
|
|
49
|
-
config, configname = getFullProjectInternal(configs, configname, isMain)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# check if config has to be manipulated
|
|
53
|
-
@adaptConfigs.each do |c|
|
|
54
|
-
if c.project == config.parent.name or (isMain and c.project == "__MAIN__") or c.project == "__ALL__"
|
|
55
|
-
if c.name == config.name or (isMain and c.name == "__MAIN__") or c.name == "__ALL__"
|
|
56
|
-
MergeConfig.new(c, config).merge(c.type.to_sym)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
[config, configname]
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def symlinkCheck(filename)
|
|
65
|
-
dirOfProjMeta = File.dirname(filename)
|
|
66
|
-
Dir.chdir(dirOfProjMeta) do
|
|
67
|
-
if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
|
|
68
|
-
isSym = false
|
|
69
|
-
begin
|
|
70
|
-
isSym = File.symlink?(dirOfProjMeta)
|
|
71
|
-
rescue
|
|
72
|
-
end
|
|
73
|
-
if isSym
|
|
74
|
-
Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
|
|
75
|
-
ExitHelper.exit(1)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def checkVerFormat(ver)
|
|
82
|
-
return true if ver.empty?
|
|
83
|
-
return false if ver.length > 3
|
|
84
|
-
ver.each do |v|
|
|
85
|
-
return false if not /\A\d+\z/.match(v)
|
|
86
|
-
end
|
|
87
|
-
true
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def bailOutVer(reqVersion)
|
|
91
|
-
text1 = (reqVersion.minimum.empty? ? "" : "minimum = #{reqVersion.minimum}")
|
|
92
|
-
text2 = ((reqVersion.minimum.empty? or reqVersion.maximum.empty?) ? "" : ", ")
|
|
93
|
-
text3 = (reqVersion.maximum.empty? ? "" : "maximum = #{reqVersion.maximum}")
|
|
94
|
-
Bake.formatter.printError("Not compatible with installed bake version: #{text1 + text2 + text3}", reqVersion)
|
|
95
|
-
ExitHelper.exit(1)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def checkVer(reqVersion)
|
|
99
|
-
return if reqVersion.nil?
|
|
100
|
-
min = reqVersion.minimum.split(".")
|
|
101
|
-
max = reqVersion.maximum.split(".")
|
|
102
|
-
cur = Bake::Version.number.split(".")
|
|
103
|
-
|
|
104
|
-
if !checkVerFormat(min) or !checkVerFormat(max)
|
|
105
|
-
Bake.formatter.printError("Version must be <major>.<minor>.<patch> whereas minor and patch are optional and all numbers >= 0.", reqVersion)
|
|
106
|
-
ExitHelper.exit(1)
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
[min,max,cur].each { |arr| arr.map! {|x| x.to_i} }
|
|
110
|
-
min.each_with_index do |v,i|
|
|
111
|
-
break if v < cur[i]
|
|
112
|
-
bailOutVer(reqVersion) if v > cur[i]
|
|
113
|
-
end
|
|
114
|
-
max.each_with_index do |v,i|
|
|
115
|
-
break if v > cur[i]
|
|
116
|
-
bailOutVer(reqVersion) if v < cur[i]
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def loadProjMeta(filename)
|
|
121
|
-
|
|
122
|
-
Bake::Configs::Checks.symlinkCheck(filename)
|
|
123
|
-
|
|
124
|
-
@project_files << filename
|
|
125
|
-
f = @loader.load(filename)
|
|
126
|
-
|
|
127
|
-
config = nil
|
|
128
|
-
|
|
129
|
-
if f.root_elements.length != 1 or not Metamodel::Project === f.root_elements[0]
|
|
130
|
-
Bake.formatter.printError("Config file must have exactly one 'Project' element as root element", filename)
|
|
131
|
-
ExitHelper.exit(1)
|
|
132
|
-
end
|
|
133
|
-
proj = f.root_elements[0]
|
|
134
|
-
|
|
135
|
-
reqVersion = proj.getRequiredBakeVersion
|
|
136
|
-
checkVer(reqVersion)
|
|
137
|
-
|
|
138
|
-
configs = proj.getConfig
|
|
139
|
-
Bake::Configs::Checks::commonMetamodelCheck(configs, filename)
|
|
140
|
-
|
|
141
|
-
configs.each do |c|
|
|
142
|
-
if not c.project.empty?
|
|
143
|
-
Bake.formatter.printError("Attribute 'project' must only be used in adapt config.",c)
|
|
144
|
-
ExitHelper.exit(1)
|
|
145
|
-
end
|
|
146
|
-
if not c.type.empty?
|
|
147
|
-
Bake.formatter.printError("Attribute 'type' must only be used in adapt config.",c)
|
|
148
|
-
ExitHelper.exit(1)
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
configs
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def validateDependencies(config)
|
|
157
|
-
config.dependency.each do |dep|
|
|
158
|
-
if dep.name.include?"$" or dep.config.include?"$"
|
|
159
|
-
Bake.formatter.printError("No variables allowed in Dependency definition", dep)
|
|
160
|
-
ExitHelper.exit(1)
|
|
161
|
-
end
|
|
162
|
-
dep.name = config.parent.name if dep.name == ""
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def loadMeta(dep)
|
|
167
|
-
dep_subbed = dep.name.gsub(/\\/,"/")
|
|
168
|
-
if dep_subbed.include?":" or dep_subbed.include?"../" or dep_subbed.start_with?"/" or dep_subbed.end_with?"/"
|
|
169
|
-
Bake.formatter.printError("#{dep.name} is invalid", dep)
|
|
170
|
-
ExitHelper.exit(1)
|
|
171
|
-
end
|
|
172
|
-
dep_path, dismiss, dep_name = dep_subbed.rpartition("/")
|
|
173
|
-
|
|
174
|
-
# file not loaded yet
|
|
175
|
-
if not @loadedConfigs.include?dep_name
|
|
176
|
-
|
|
177
|
-
if Bake.options.verbose >= 3
|
|
178
|
-
puts "First referenced by #{dep.parent.parent.name} (#{dep.parent.name}):"
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
pmeta_filenames = []
|
|
182
|
-
|
|
183
|
-
@potentialProjs.each do |pp|
|
|
184
|
-
if pp.include?("/" + dep_subbed + "/Project.meta") or pp == (dep_subbed + "/Project.meta")
|
|
185
|
-
pmeta_filenames << pp
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
if pmeta_filenames.empty?
|
|
190
|
-
Bake.formatter.printError("#{dep.name}/Project.meta not found", dep)
|
|
191
|
-
ExitHelper.exit(1)
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
if pmeta_filenames.length > 1
|
|
195
|
-
Bake.formatter.printWarning("Project #{dep.name} exists more than once", dep)
|
|
196
|
-
chosen = " (chosen)"
|
|
197
|
-
pmeta_filenames.each do |f|
|
|
198
|
-
Bake.formatter.printWarning(" #{File.dirname(f)}#{chosen}")
|
|
199
|
-
chosen = ""
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
@loadedConfigs[dep_name] = loadProjMeta(pmeta_filenames[0])
|
|
204
|
-
else
|
|
205
|
-
folder = @loadedConfigs[dep_name][0].get_project_dir
|
|
206
|
-
if not folder.include?dep_subbed
|
|
207
|
-
Bake.formatter.printError("Cannot load #{dep.name}, because #{folder} already loaded", dep)
|
|
208
|
-
ExitHelper.exit(1)
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
# get config
|
|
214
|
-
if Bake.options.verbose >= 3
|
|
215
|
-
puts " #{dep_name} #{dep.config.empty? ? "<default>" : "("+dep.config+")"} referenced by #{dep.parent.parent.name} (#{dep.parent.name})"
|
|
216
|
-
end
|
|
217
|
-
config, dep.config = getFullProject(@loadedConfigs[dep_name], dep.config, false)
|
|
218
|
-
dep.name = dep_name
|
|
219
|
-
|
|
220
|
-
# config not referenced yet
|
|
221
|
-
if not @referencedConfigs.include?dep_name
|
|
222
|
-
@referencedConfigs[dep_name] = [config]
|
|
223
|
-
elsif @referencedConfigs[dep_name].index { |c| c.name == dep.config } == nil
|
|
224
|
-
@referencedConfigs[dep_name] << config
|
|
225
|
-
else
|
|
226
|
-
return
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
validateDependencies(config)
|
|
230
|
-
@depsPending += config.dependency
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
def loadMainMeta()
|
|
234
|
-
mainMeta = Bake.options.main_dir+"/Project.meta"
|
|
235
|
-
if not File.exist?(mainMeta)
|
|
236
|
-
Bake.formatter.printError("Error: #{mainMeta} not found")
|
|
237
|
-
ExitHelper.exit(1)
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
@project_files = []
|
|
241
|
-
configs = loadProjMeta(mainMeta)
|
|
242
|
-
@loadedConfigs = {}
|
|
243
|
-
@loadedConfigs[Bake.options.main_project_name] = configs
|
|
244
|
-
|
|
245
|
-
if not showConfigNames?
|
|
246
|
-
config, Bake.options.build_config = getFullProject(configs,Bake.options.build_config, true)
|
|
247
|
-
@referencedConfigs = {}
|
|
248
|
-
@referencedConfigs[Bake.options.main_project_name] = [config]
|
|
249
|
-
|
|
250
|
-
validateDependencies(config)
|
|
251
|
-
@depsPending = config.dependency
|
|
252
|
-
|
|
253
|
-
if Bake.options.build_config != "" and config.defaultToolchain == nil
|
|
254
|
-
Bake.formatter.printError("Main project configuration must contain DefaultToolchain", config)
|
|
255
|
-
ExitHelper.exit(1)
|
|
256
|
-
end
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
end
|
|
260
|
-
|
|
261
|
-
def checkRoots()
|
|
262
|
-
@potentialProjs = []
|
|
263
|
-
Bake.options.roots.each do |r|
|
|
264
|
-
if (r.length == 3 && r.include?(":/"))
|
|
265
|
-
r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
|
|
266
|
-
end
|
|
267
|
-
r = r+"/**{,/*/**}/Project.meta"
|
|
268
|
-
@potentialProjs.concat(Dir.glob(r).sort)
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
@potentialProjs = @potentialProjs.uniq
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def filterStep(step, globalFilterStr)
|
|
276
|
-
|
|
277
|
-
# 1st prio: explicit single filter
|
|
278
|
-
if step.filter != ""
|
|
279
|
-
return true if Bake.options.exclude_filter.include?step.filter
|
|
280
|
-
return false if Bake.options.include_filter.include?step.filter
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
# 2nd prio: explicit global filter
|
|
284
|
-
if globalFilterStr != nil
|
|
285
|
-
return true if Bake.options.exclude_filter.include?globalFilterStr
|
|
286
|
-
return false if Bake.options.include_filter.include?globalFilterStr
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
# 3nd prio: default
|
|
290
|
-
return true if step.default == "off"
|
|
291
|
-
false
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def filterSteps
|
|
295
|
-
@referencedConfigs.each do |projName, configs|
|
|
296
|
-
configs.each do |config|
|
|
297
|
-
config.startupSteps.step = config.startupSteps.step.delete_if { |step| filterStep(step, "STARTUP") } if config.startupSteps
|
|
298
|
-
config.preSteps.step = config.preSteps.step.delete_if { |step| filterStep(step, "PRE") } if config.preSteps
|
|
299
|
-
config.postSteps.step = config.postSteps.step.delete_if { |step| filterStep(step, "POST") } if config.postSteps
|
|
300
|
-
config.exitSteps.step = config.exitSteps.step.delete_if { |step| filterStep(step, "EXIT") } if config.exitSteps
|
|
301
|
-
if Metamodel::CustomConfig === config and config.step
|
|
302
|
-
config.step = nil if filterStep(config.step, nil)
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
def defaultConfigName
|
|
309
|
-
@loadedConfigs[Bake.options.main_project_name].first.parent.default
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
def showConfigNames?
|
|
313
|
-
Bake.options.showConfigs or (Bake.options.build_config == "" and defaultConfigName == "")
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
def printConfigNames
|
|
317
|
-
mainConfigName = Bake.options.build_config != "" ? Bake.options.build_config : defaultConfigName
|
|
318
|
-
configs = @loadedConfigs[Bake.options.main_project_name]
|
|
319
|
-
foundValidConfig = false
|
|
320
|
-
configs.each do |c|
|
|
321
|
-
config, tmp = getFullProject(configs, c.name, c.name == mainConfigName)
|
|
322
|
-
next if config.defaultToolchain.nil?
|
|
323
|
-
Kernel.print "* #{config.name}"
|
|
324
|
-
Kernel.print " (default)" if config.name == defaultConfigName
|
|
325
|
-
Kernel.print ": #{config.description.text}" if config.description
|
|
326
|
-
Kernel.print "\n"
|
|
327
|
-
foundValidConfig = true
|
|
328
|
-
end
|
|
329
|
-
|
|
330
|
-
Bake.formatter.printWarning("No configuration with a DefaultToolchain found", Bake.options.main_dir+"/Project.meta") unless foundValidConfig
|
|
331
|
-
ExitHelper.exit(0)
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
def load(adaptConfigs)
|
|
335
|
-
@adaptConfigs = adaptConfigs
|
|
336
|
-
@loader = Loader.new
|
|
337
|
-
if not Bake.options.showConfigs
|
|
338
|
-
cache = CacheAccess.new()
|
|
339
|
-
@referencedConfigs = cache.load_cache unless Bake.options.nocache
|
|
340
|
-
# cache invalid or forced to reload
|
|
341
|
-
if @referencedConfigs.nil?
|
|
342
|
-
loadMainMeta
|
|
343
|
-
printConfigNames if showConfigNames? # if neither config name nor default is set, list the configs with DefaultToolchain
|
|
344
|
-
checkRoots
|
|
345
|
-
while dep = @depsPending.shift
|
|
346
|
-
loadMeta(dep)
|
|
347
|
-
end
|
|
348
|
-
filterSteps
|
|
349
|
-
cache.write_cache(@project_files, @referencedConfigs)
|
|
350
|
-
else
|
|
351
|
-
if showConfigNames?
|
|
352
|
-
loadMainMeta # needed because in cache only needed configs are stored
|
|
353
|
-
printConfigNames
|
|
354
|
-
end
|
|
355
|
-
end
|
|
356
|
-
else
|
|
357
|
-
loadMainMeta # "--list" specified
|
|
358
|
-
printConfigNames
|
|
359
|
-
end
|
|
360
|
-
end
|
|
361
|
-
|
|
362
|
-
end
|
|
363
|
-
end
|
|
1
|
+
require 'bake/model/loader'
|
|
2
|
+
require 'bake/config/checks'
|
|
3
|
+
|
|
4
|
+
module Bake
|
|
5
|
+
|
|
6
|
+
class Config
|
|
7
|
+
attr_reader :referencedConfigs
|
|
8
|
+
|
|
9
|
+
def getFullProjectInternal(configs, configname, isMain) # note: configs is never empty
|
|
10
|
+
|
|
11
|
+
if (configname == "")
|
|
12
|
+
if configs[0].parent.default != ""
|
|
13
|
+
configname = configs[0].parent.default
|
|
14
|
+
else
|
|
15
|
+
Bake.formatter.printError("No default config specified", configs[0].file_name)
|
|
16
|
+
ExitHelper.exit(1)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
config = nil
|
|
21
|
+
configs.each do |c|
|
|
22
|
+
if c.name == configname
|
|
23
|
+
if config
|
|
24
|
+
Bake.formatter.printError("Config '#{configname}' found more than once",config.file_name)
|
|
25
|
+
ExitHelper.exit(1)
|
|
26
|
+
end
|
|
27
|
+
config = c
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if not config
|
|
32
|
+
Bake.formatter.printError("Config '#{configname}' not found", configs[0].file_name)
|
|
33
|
+
ExitHelper.exit(1)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if config.extends != ""
|
|
37
|
+
config.extends.split(",").map {|ex| ex.strip}.reverse.each do |ex|
|
|
38
|
+
if (ex != "")
|
|
39
|
+
parent,parentConfigName = getFullProjectInternal(configs, ex, isMain)
|
|
40
|
+
MergeConfig.new(config, parent).merge(:merge)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
[config, configname]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def getFullProject(configs, configname, isMain)
|
|
49
|
+
config, configname = getFullProjectInternal(configs, configname, isMain)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# check if config has to be manipulated
|
|
53
|
+
@adaptConfigs.each do |c|
|
|
54
|
+
if c.project == config.parent.name or (isMain and c.project == "__MAIN__") or c.project == "__ALL__"
|
|
55
|
+
if c.name == config.name or (isMain and c.name == "__MAIN__") or c.name == "__ALL__"
|
|
56
|
+
MergeConfig.new(c, config).merge(c.type.to_sym)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
[config, configname]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def symlinkCheck(filename)
|
|
65
|
+
dirOfProjMeta = File.dirname(filename)
|
|
66
|
+
Dir.chdir(dirOfProjMeta) do
|
|
67
|
+
if Dir.pwd != dirOfProjMeta and File.dirname(Dir.pwd) != File.dirname(dirOfProjMeta)
|
|
68
|
+
isSym = false
|
|
69
|
+
begin
|
|
70
|
+
isSym = File.symlink?(dirOfProjMeta)
|
|
71
|
+
rescue
|
|
72
|
+
end
|
|
73
|
+
if isSym
|
|
74
|
+
Bake.formatter.printError("Symlinks only allowed with the same parent dir as the target: #{dirOfProjMeta} --> #{Dir.pwd}", filename)
|
|
75
|
+
ExitHelper.exit(1)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def checkVerFormat(ver)
|
|
82
|
+
return true if ver.empty?
|
|
83
|
+
return false if ver.length > 3
|
|
84
|
+
ver.each do |v|
|
|
85
|
+
return false if not /\A\d+\z/.match(v)
|
|
86
|
+
end
|
|
87
|
+
true
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def bailOutVer(reqVersion)
|
|
91
|
+
text1 = (reqVersion.minimum.empty? ? "" : "minimum = #{reqVersion.minimum}")
|
|
92
|
+
text2 = ((reqVersion.minimum.empty? or reqVersion.maximum.empty?) ? "" : ", ")
|
|
93
|
+
text3 = (reqVersion.maximum.empty? ? "" : "maximum = #{reqVersion.maximum}")
|
|
94
|
+
Bake.formatter.printError("Not compatible with installed bake version: #{text1 + text2 + text3}", reqVersion)
|
|
95
|
+
ExitHelper.exit(1)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def checkVer(reqVersion)
|
|
99
|
+
return if reqVersion.nil?
|
|
100
|
+
min = reqVersion.minimum.split(".")
|
|
101
|
+
max = reqVersion.maximum.split(".")
|
|
102
|
+
cur = Bake::Version.number.split(".")
|
|
103
|
+
|
|
104
|
+
if !checkVerFormat(min) or !checkVerFormat(max)
|
|
105
|
+
Bake.formatter.printError("Version must be <major>.<minor>.<patch> whereas minor and patch are optional and all numbers >= 0.", reqVersion)
|
|
106
|
+
ExitHelper.exit(1)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
[min,max,cur].each { |arr| arr.map! {|x| x.to_i} }
|
|
110
|
+
min.each_with_index do |v,i|
|
|
111
|
+
break if v < cur[i]
|
|
112
|
+
bailOutVer(reqVersion) if v > cur[i]
|
|
113
|
+
end
|
|
114
|
+
max.each_with_index do |v,i|
|
|
115
|
+
break if v > cur[i]
|
|
116
|
+
bailOutVer(reqVersion) if v < cur[i]
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def loadProjMeta(filename)
|
|
121
|
+
|
|
122
|
+
Bake::Configs::Checks.symlinkCheck(filename)
|
|
123
|
+
|
|
124
|
+
@project_files << filename
|
|
125
|
+
f = @loader.load(filename)
|
|
126
|
+
|
|
127
|
+
config = nil
|
|
128
|
+
|
|
129
|
+
if f.root_elements.length != 1 or not Metamodel::Project === f.root_elements[0]
|
|
130
|
+
Bake.formatter.printError("Config file must have exactly one 'Project' element as root element", filename)
|
|
131
|
+
ExitHelper.exit(1)
|
|
132
|
+
end
|
|
133
|
+
proj = f.root_elements[0]
|
|
134
|
+
|
|
135
|
+
reqVersion = proj.getRequiredBakeVersion
|
|
136
|
+
checkVer(reqVersion)
|
|
137
|
+
|
|
138
|
+
configs = proj.getConfig
|
|
139
|
+
Bake::Configs::Checks::commonMetamodelCheck(configs, filename)
|
|
140
|
+
|
|
141
|
+
configs.each do |c|
|
|
142
|
+
if not c.project.empty?
|
|
143
|
+
Bake.formatter.printError("Attribute 'project' must only be used in adapt config.",c)
|
|
144
|
+
ExitHelper.exit(1)
|
|
145
|
+
end
|
|
146
|
+
if not c.type.empty?
|
|
147
|
+
Bake.formatter.printError("Attribute 'type' must only be used in adapt config.",c)
|
|
148
|
+
ExitHelper.exit(1)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
configs
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def validateDependencies(config)
|
|
157
|
+
config.dependency.each do |dep|
|
|
158
|
+
if dep.name.include?"$" or dep.config.include?"$"
|
|
159
|
+
Bake.formatter.printError("No variables allowed in Dependency definition", dep)
|
|
160
|
+
ExitHelper.exit(1)
|
|
161
|
+
end
|
|
162
|
+
dep.name = config.parent.name if dep.name == ""
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def loadMeta(dep)
|
|
167
|
+
dep_subbed = dep.name.gsub(/\\/,"/")
|
|
168
|
+
if dep_subbed.include?":" or dep_subbed.include?"../" or dep_subbed.start_with?"/" or dep_subbed.end_with?"/"
|
|
169
|
+
Bake.formatter.printError("#{dep.name} is invalid", dep)
|
|
170
|
+
ExitHelper.exit(1)
|
|
171
|
+
end
|
|
172
|
+
dep_path, dismiss, dep_name = dep_subbed.rpartition("/")
|
|
173
|
+
|
|
174
|
+
# file not loaded yet
|
|
175
|
+
if not @loadedConfigs.include?dep_name
|
|
176
|
+
|
|
177
|
+
if Bake.options.verbose >= 3
|
|
178
|
+
puts "First referenced by #{dep.parent.parent.name} (#{dep.parent.name}):"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
pmeta_filenames = []
|
|
182
|
+
|
|
183
|
+
@potentialProjs.each do |pp|
|
|
184
|
+
if pp.include?("/" + dep_subbed + "/Project.meta") or pp == (dep_subbed + "/Project.meta")
|
|
185
|
+
pmeta_filenames << pp
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
if pmeta_filenames.empty?
|
|
190
|
+
Bake.formatter.printError("#{dep.name}/Project.meta not found", dep)
|
|
191
|
+
ExitHelper.exit(1)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if pmeta_filenames.length > 1
|
|
195
|
+
Bake.formatter.printWarning("Project #{dep.name} exists more than once", dep)
|
|
196
|
+
chosen = " (chosen)"
|
|
197
|
+
pmeta_filenames.each do |f|
|
|
198
|
+
Bake.formatter.printWarning(" #{File.dirname(f)}#{chosen}")
|
|
199
|
+
chosen = ""
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
@loadedConfigs[dep_name] = loadProjMeta(pmeta_filenames[0])
|
|
204
|
+
else
|
|
205
|
+
folder = @loadedConfigs[dep_name][0].get_project_dir
|
|
206
|
+
if not folder.include?dep_subbed
|
|
207
|
+
Bake.formatter.printError("Cannot load #{dep.name}, because #{folder} already loaded", dep)
|
|
208
|
+
ExitHelper.exit(1)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# get config
|
|
214
|
+
if Bake.options.verbose >= 3
|
|
215
|
+
puts " #{dep_name} #{dep.config.empty? ? "<default>" : "("+dep.config+")"} referenced by #{dep.parent.parent.name} (#{dep.parent.name})"
|
|
216
|
+
end
|
|
217
|
+
config, dep.config = getFullProject(@loadedConfigs[dep_name], dep.config, false)
|
|
218
|
+
dep.name = dep_name
|
|
219
|
+
|
|
220
|
+
# config not referenced yet
|
|
221
|
+
if not @referencedConfigs.include?dep_name
|
|
222
|
+
@referencedConfigs[dep_name] = [config]
|
|
223
|
+
elsif @referencedConfigs[dep_name].index { |c| c.name == dep.config } == nil
|
|
224
|
+
@referencedConfigs[dep_name] << config
|
|
225
|
+
else
|
|
226
|
+
return
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
validateDependencies(config)
|
|
230
|
+
@depsPending += config.dependency
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def loadMainMeta()
|
|
234
|
+
mainMeta = Bake.options.main_dir+"/Project.meta"
|
|
235
|
+
if not File.exist?(mainMeta)
|
|
236
|
+
Bake.formatter.printError("Error: #{mainMeta} not found")
|
|
237
|
+
ExitHelper.exit(1)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
@project_files = []
|
|
241
|
+
configs = loadProjMeta(mainMeta)
|
|
242
|
+
@loadedConfigs = {}
|
|
243
|
+
@loadedConfigs[Bake.options.main_project_name] = configs
|
|
244
|
+
|
|
245
|
+
if not showConfigNames?
|
|
246
|
+
config, Bake.options.build_config = getFullProject(configs,Bake.options.build_config, true)
|
|
247
|
+
@referencedConfigs = {}
|
|
248
|
+
@referencedConfigs[Bake.options.main_project_name] = [config]
|
|
249
|
+
|
|
250
|
+
validateDependencies(config)
|
|
251
|
+
@depsPending = config.dependency
|
|
252
|
+
|
|
253
|
+
if Bake.options.build_config != "" and config.defaultToolchain == nil
|
|
254
|
+
Bake.formatter.printError("Main project configuration must contain DefaultToolchain", config)
|
|
255
|
+
ExitHelper.exit(1)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def checkRoots()
|
|
262
|
+
@potentialProjs = []
|
|
263
|
+
Bake.options.roots.each do |r|
|
|
264
|
+
if (r.length == 3 && r.include?(":/"))
|
|
265
|
+
r = r + Bake.options.main_project_name # glob would not work otherwise on windows (ruby bug?)
|
|
266
|
+
end
|
|
267
|
+
r = r+"/**{,/*/**}/Project.meta"
|
|
268
|
+
@potentialProjs.concat(Dir.glob(r).sort)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
@potentialProjs = @potentialProjs.uniq
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def filterStep(step, globalFilterStr)
|
|
276
|
+
|
|
277
|
+
# 1st prio: explicit single filter
|
|
278
|
+
if step.filter != ""
|
|
279
|
+
return true if Bake.options.exclude_filter.include?step.filter
|
|
280
|
+
return false if Bake.options.include_filter.include?step.filter
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# 2nd prio: explicit global filter
|
|
284
|
+
if globalFilterStr != nil
|
|
285
|
+
return true if Bake.options.exclude_filter.include?globalFilterStr
|
|
286
|
+
return false if Bake.options.include_filter.include?globalFilterStr
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# 3nd prio: default
|
|
290
|
+
return true if step.default == "off"
|
|
291
|
+
false
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def filterSteps
|
|
295
|
+
@referencedConfigs.each do |projName, configs|
|
|
296
|
+
configs.each do |config|
|
|
297
|
+
config.startupSteps.step = config.startupSteps.step.delete_if { |step| filterStep(step, "STARTUP") } if config.startupSteps
|
|
298
|
+
config.preSteps.step = config.preSteps.step.delete_if { |step| filterStep(step, "PRE") } if config.preSteps
|
|
299
|
+
config.postSteps.step = config.postSteps.step.delete_if { |step| filterStep(step, "POST") } if config.postSteps
|
|
300
|
+
config.exitSteps.step = config.exitSteps.step.delete_if { |step| filterStep(step, "EXIT") } if config.exitSteps
|
|
301
|
+
if Metamodel::CustomConfig === config and config.step
|
|
302
|
+
config.step = nil if filterStep(config.step, nil)
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def defaultConfigName
|
|
309
|
+
@loadedConfigs[Bake.options.main_project_name].first.parent.default
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
def showConfigNames?
|
|
313
|
+
Bake.options.showConfigs or (Bake.options.build_config == "" and defaultConfigName == "")
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def printConfigNames
|
|
317
|
+
mainConfigName = Bake.options.build_config != "" ? Bake.options.build_config : defaultConfigName
|
|
318
|
+
configs = @loadedConfigs[Bake.options.main_project_name]
|
|
319
|
+
foundValidConfig = false
|
|
320
|
+
configs.each do |c|
|
|
321
|
+
config, tmp = getFullProject(configs, c.name, c.name == mainConfigName)
|
|
322
|
+
next if config.defaultToolchain.nil?
|
|
323
|
+
Kernel.print "* #{config.name}"
|
|
324
|
+
Kernel.print " (default)" if config.name == defaultConfigName
|
|
325
|
+
Kernel.print ": #{config.description.text}" if config.description
|
|
326
|
+
Kernel.print "\n"
|
|
327
|
+
foundValidConfig = true
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
Bake.formatter.printWarning("No configuration with a DefaultToolchain found", Bake.options.main_dir+"/Project.meta") unless foundValidConfig
|
|
331
|
+
ExitHelper.exit(0)
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def load(adaptConfigs)
|
|
335
|
+
@adaptConfigs = adaptConfigs
|
|
336
|
+
@loader = Loader.new
|
|
337
|
+
if not Bake.options.showConfigs
|
|
338
|
+
cache = CacheAccess.new()
|
|
339
|
+
@referencedConfigs = cache.load_cache unless Bake.options.nocache
|
|
340
|
+
# cache invalid or forced to reload
|
|
341
|
+
if @referencedConfigs.nil?
|
|
342
|
+
loadMainMeta
|
|
343
|
+
printConfigNames if showConfigNames? # if neither config name nor default is set, list the configs with DefaultToolchain
|
|
344
|
+
checkRoots
|
|
345
|
+
while dep = @depsPending.shift
|
|
346
|
+
loadMeta(dep)
|
|
347
|
+
end
|
|
348
|
+
filterSteps
|
|
349
|
+
cache.write_cache(@project_files, @referencedConfigs)
|
|
350
|
+
else
|
|
351
|
+
if showConfigNames?
|
|
352
|
+
loadMainMeta # needed because in cache only needed configs are stored
|
|
353
|
+
printConfigNames
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
else
|
|
357
|
+
loadMainMeta # "--list" specified
|
|
358
|
+
printConfigNames
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
end
|
|
363
|
+
end
|