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,48 +1,48 @@
|
|
|
1
|
-
require 'rgen/metamodel_builder'
|
|
2
|
-
require 'rgen/metamodel_builder/data_types'
|
|
3
|
-
|
|
4
|
-
module Bake
|
|
5
|
-
|
|
6
|
-
module BakeryModel
|
|
7
|
-
extend RGen::MetamodelBuilder::ModuleExtension
|
|
8
|
-
|
|
9
|
-
class ModelElement < RGen::MetamodelBuilder::MMBase
|
|
10
|
-
abstract
|
|
11
|
-
has_attr 'line_number', Integer do
|
|
12
|
-
annotation :details => {'internal' => 'true'}
|
|
13
|
-
end
|
|
14
|
-
has_attr 'file_name', String do
|
|
15
|
-
annotation :details => {'internal' => 'true'}
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
class Project < ModelElement
|
|
20
|
-
has_attr 'name', String, :defaultValueLiteral => ""
|
|
21
|
-
has_attr 'config', String, :defaultValueLiteral => ""
|
|
22
|
-
end
|
|
23
|
-
class Exclude < ModelElement
|
|
24
|
-
has_attr 'name', String, :defaultValueLiteral => ""
|
|
25
|
-
has_attr 'config', String, :defaultValueLiteral => ""
|
|
26
|
-
end
|
|
27
|
-
class SubCollection < ModelElement
|
|
28
|
-
has_attr 'name', String, :defaultValueLiteral => ""
|
|
29
|
-
end
|
|
30
|
-
class Collection < ModelElement
|
|
31
|
-
has_attr 'name', String, :defaultValueLiteral => ""
|
|
32
|
-
contains_many 'project', Project, 'collection'
|
|
33
|
-
contains_many 'exclude', Exclude, 'collection'
|
|
34
|
-
contains_many 'collections', SubCollection, 'collection'
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
module Project::ClassModule
|
|
38
|
-
def isFound
|
|
39
|
-
@isFound ||= false
|
|
40
|
-
end
|
|
41
|
-
def found
|
|
42
|
-
@isFound = true
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
1
|
+
require 'rgen/metamodel_builder'
|
|
2
|
+
require 'rgen/metamodel_builder/data_types'
|
|
3
|
+
|
|
4
|
+
module Bake
|
|
5
|
+
|
|
6
|
+
module BakeryModel
|
|
7
|
+
extend RGen::MetamodelBuilder::ModuleExtension
|
|
8
|
+
|
|
9
|
+
class ModelElement < RGen::MetamodelBuilder::MMBase
|
|
10
|
+
abstract
|
|
11
|
+
has_attr 'line_number', Integer do
|
|
12
|
+
annotation :details => {'internal' => 'true'}
|
|
13
|
+
end
|
|
14
|
+
has_attr 'file_name', String do
|
|
15
|
+
annotation :details => {'internal' => 'true'}
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Project < ModelElement
|
|
20
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
|
21
|
+
has_attr 'config', String, :defaultValueLiteral => ""
|
|
22
|
+
end
|
|
23
|
+
class Exclude < ModelElement
|
|
24
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
|
25
|
+
has_attr 'config', String, :defaultValueLiteral => ""
|
|
26
|
+
end
|
|
27
|
+
class SubCollection < ModelElement
|
|
28
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
|
29
|
+
end
|
|
30
|
+
class Collection < ModelElement
|
|
31
|
+
has_attr 'name', String, :defaultValueLiteral => ""
|
|
32
|
+
contains_many 'project', Project, 'collection'
|
|
33
|
+
contains_many 'exclude', Exclude, 'collection'
|
|
34
|
+
contains_many 'collections', SubCollection, 'collection'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module Project::ClassModule
|
|
38
|
+
def isFound
|
|
39
|
+
@isFound ||= false
|
|
40
|
+
end
|
|
41
|
+
def found
|
|
42
|
+
@isFound = true
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
require 'bake/toolchain/colorizing_formatter'
|
|
2
|
-
require 'common/options/parser'
|
|
3
|
-
|
|
4
|
-
module Bake
|
|
5
|
-
|
|
6
|
-
class BakeryOptions < Parser
|
|
7
|
-
attr_reader :collection_name, :collection_dir # String
|
|
8
|
-
attr_reader :roots # String List
|
|
9
|
-
attr_reader :color, :error # Boolean
|
|
10
|
-
attr_reader :socket # Fixnum
|
|
11
|
-
|
|
12
|
-
def initialize(argv)
|
|
13
|
-
super(argv)
|
|
14
|
-
|
|
15
|
-
@collection_name = ""
|
|
16
|
-
@collection_dir = nil
|
|
17
|
-
@color = nil
|
|
18
|
-
@error = false
|
|
19
|
-
@roots = []
|
|
20
|
-
@socket = 0
|
|
21
|
-
@def_roots = []
|
|
22
|
-
|
|
23
|
-
add_option(["-b", "" ], lambda { |x| set_collection_name(x) })
|
|
24
|
-
add_option(["-m" ], lambda { |x| set_collection_dir(x) })
|
|
25
|
-
add_option(["-r" ], lambda { @error = true })
|
|
26
|
-
add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
|
|
27
|
-
add_option(["-w" ], lambda { |x| set_root(x) })
|
|
28
|
-
add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
|
|
29
|
-
add_option(["-h", "--help"], lambda { usage; ExitHelper.exit(0) })
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def usage
|
|
33
|
-
puts "\nUsage: bake <name> [options]"
|
|
34
|
-
puts " [-b] <name> Name of the collection to build."
|
|
35
|
-
puts " -m <dir> Directory containing the collection file (default is current directory)."
|
|
36
|
-
puts " -r Stop on first error."
|
|
37
|
-
puts " -a <scheme> Use ansi color sequences (console must support it). Possible values are 'white' and 'black'."
|
|
38
|
-
puts " -h, --help Print this help."
|
|
39
|
-
puts " -w <root> Add a workspace root (can be used multiple times)."
|
|
40
|
-
puts " If no root is specified, the parent directory of Collection.meta is added automatically."
|
|
41
|
-
puts " --socket <num> Set socket for sending errors, receiving commands, etc. - used by e.g. Eclipse."
|
|
42
|
-
puts "Note: all parameters except -b, -m and -h will be passed to bake - see bake help for more options."
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def parse_options(bakeOptions)
|
|
46
|
-
parse_internal(true, bakeOptions)
|
|
47
|
-
set_collection_dir(Dir.pwd) if @collection_dir.nil?
|
|
48
|
-
if @roots.length == 0
|
|
49
|
-
@roots = @def_roots
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def check_valid_dir(dir)
|
|
54
|
-
if not File.exists?(dir)
|
|
55
|
-
Bake.formatter.printError("Error: Directory #{dir} does not exist")
|
|
56
|
-
ExitHelper.exit(1)
|
|
57
|
-
end
|
|
58
|
-
if not File.directory?(dir)
|
|
59
|
-
Bake.formatter.printError("Error: #{dir} is not a directory")
|
|
60
|
-
ExitHelper.exit(1)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def set_collection_name(collection_name)
|
|
65
|
-
if not @collection_name.empty?
|
|
66
|
-
Bake.formatter.printError("Error: Cannot set collection name '#{collection_name}', because collection name is already set to '#{@collection_name}'")
|
|
67
|
-
ExitHelper.exit(1)
|
|
68
|
-
end
|
|
69
|
-
@collection_name = collection_name
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def set_collection_dir(dir)
|
|
73
|
-
check_valid_dir(dir)
|
|
74
|
-
@collection_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
|
|
75
|
-
@def_roots = calc_def_roots(@collection_dir)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def set_root(dir)
|
|
79
|
-
check_valid_dir(dir)
|
|
80
|
-
r = File.expand_path(dir.gsub(/[\\]/,'/'))
|
|
81
|
-
@roots << r if not @roots.include?r
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
end
|
|
1
|
+
require 'bake/toolchain/colorizing_formatter'
|
|
2
|
+
require 'common/options/parser'
|
|
3
|
+
|
|
4
|
+
module Bake
|
|
5
|
+
|
|
6
|
+
class BakeryOptions < Parser
|
|
7
|
+
attr_reader :collection_name, :collection_dir # String
|
|
8
|
+
attr_reader :roots # String List
|
|
9
|
+
attr_reader :color, :error # Boolean
|
|
10
|
+
attr_reader :socket # Fixnum
|
|
11
|
+
|
|
12
|
+
def initialize(argv)
|
|
13
|
+
super(argv)
|
|
14
|
+
|
|
15
|
+
@collection_name = ""
|
|
16
|
+
@collection_dir = nil
|
|
17
|
+
@color = nil
|
|
18
|
+
@error = false
|
|
19
|
+
@roots = []
|
|
20
|
+
@socket = 0
|
|
21
|
+
@def_roots = []
|
|
22
|
+
|
|
23
|
+
add_option(["-b", "" ], lambda { |x| set_collection_name(x) })
|
|
24
|
+
add_option(["-m" ], lambda { |x| set_collection_dir(x) })
|
|
25
|
+
add_option(["-r" ], lambda { @error = true })
|
|
26
|
+
add_option(["-a" ], lambda { |x| Bake.formatter.setColorScheme(x.to_sym) })
|
|
27
|
+
add_option(["-w" ], lambda { |x| set_root(x) })
|
|
28
|
+
add_option(["--socket" ], lambda { |x| @socket = String === x ? x.to_i : x })
|
|
29
|
+
add_option(["-h", "--help"], lambda { usage; ExitHelper.exit(0) })
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def usage
|
|
33
|
+
puts "\nUsage: bake <name> [options]"
|
|
34
|
+
puts " [-b] <name> Name of the collection to build."
|
|
35
|
+
puts " -m <dir> Directory containing the collection file (default is current directory)."
|
|
36
|
+
puts " -r Stop on first error."
|
|
37
|
+
puts " -a <scheme> Use ansi color sequences (console must support it). Possible values are 'white' and 'black'."
|
|
38
|
+
puts " -h, --help Print this help."
|
|
39
|
+
puts " -w <root> Add a workspace root (can be used multiple times)."
|
|
40
|
+
puts " If no root is specified, the parent directory of Collection.meta is added automatically."
|
|
41
|
+
puts " --socket <num> Set socket for sending errors, receiving commands, etc. - used by e.g. Eclipse."
|
|
42
|
+
puts "Note: all parameters except -b, -m and -h will be passed to bake - see bake help for more options."
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def parse_options(bakeOptions)
|
|
46
|
+
parse_internal(true, bakeOptions)
|
|
47
|
+
set_collection_dir(Dir.pwd) if @collection_dir.nil?
|
|
48
|
+
if @roots.length == 0
|
|
49
|
+
@roots = @def_roots
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def check_valid_dir(dir)
|
|
54
|
+
if not File.exists?(dir)
|
|
55
|
+
Bake.formatter.printError("Error: Directory #{dir} does not exist")
|
|
56
|
+
ExitHelper.exit(1)
|
|
57
|
+
end
|
|
58
|
+
if not File.directory?(dir)
|
|
59
|
+
Bake.formatter.printError("Error: #{dir} is not a directory")
|
|
60
|
+
ExitHelper.exit(1)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def set_collection_name(collection_name)
|
|
65
|
+
if not @collection_name.empty?
|
|
66
|
+
Bake.formatter.printError("Error: Cannot set collection name '#{collection_name}', because collection name is already set to '#{@collection_name}'")
|
|
67
|
+
ExitHelper.exit(1)
|
|
68
|
+
end
|
|
69
|
+
@collection_name = collection_name
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def set_collection_dir(dir)
|
|
73
|
+
check_valid_dir(dir)
|
|
74
|
+
@collection_dir = File.expand_path(dir.gsub(/[\\]/,'/'))
|
|
75
|
+
@def_roots = calc_def_roots(@collection_dir)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def set_root(dir)
|
|
79
|
+
check_valid_dir(dir)
|
|
80
|
+
r = File.expand_path(dir.gsub(/[\\]/,'/'))
|
|
81
|
+
@roots << r if not @roots.include?r
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
data/lib/bakery/toBake.rb
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
require "bakery/buildPattern"
|
|
2
|
-
|
|
3
|
-
module Bake
|
|
4
|
-
|
|
5
|
-
def self.getBuildPattern(cols, name)
|
|
6
|
-
|
|
7
|
-
colMeta = @options.collection_dir+"/Collection.meta"
|
|
8
|
-
|
|
9
|
-
if (cols.length == 0)
|
|
10
|
-
Bake.formatter.printError("Collection #{name} not found", colMeta)
|
|
11
|
-
ExitHelper.exit(1)
|
|
12
|
-
elsif (cols.length > 1)
|
|
13
|
-
Bake.formatter.printError("Collection #{name} found more than once", colMeta)
|
|
14
|
-
ExitHelper.exit(1)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
col = cols[0]
|
|
18
|
-
|
|
19
|
-
col.project.each do |p|
|
|
20
|
-
if p.name == ""
|
|
21
|
-
Bake.formatter.printError("Project name empty", p)
|
|
22
|
-
ExitHelper.exit(1)
|
|
23
|
-
end
|
|
24
|
-
if p.config == ""
|
|
25
|
-
Bake.formatter.printError("Config name empty", p)
|
|
26
|
-
ExitHelper.exit(1)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
toBuildPattern = []
|
|
31
|
-
@options.roots.each do |r|
|
|
32
|
-
col.project.each do |p|
|
|
33
|
-
projs = Dir.glob(r+"/**/"+p.name+"/Project.meta")
|
|
34
|
-
if projs.length == 0
|
|
35
|
-
toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout
|
|
36
|
-
end
|
|
37
|
-
projs.each do |f|
|
|
38
|
-
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
toBuild = []
|
|
44
|
-
toBuildPattern.each do |bp|
|
|
45
|
-
next unless bp.proj
|
|
46
|
-
contents = File.open(bp.proj, "r") {|io| io.read }
|
|
47
|
-
contents.split("\n").each do |c|
|
|
48
|
-
res = c.match("\\s*(Library|Executable|Custom){1}Config\\s*(\\w*)")
|
|
49
|
-
if res
|
|
50
|
-
if res[2].match(bp.conf) != nil
|
|
51
|
-
toBuild << BuildPattern.new(bp.proj, res[2], nil)
|
|
52
|
-
bp.coll_p.found
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
toBuildPattern.each do |bp|
|
|
59
|
-
if not bp.coll_p.isFound
|
|
60
|
-
Bake.formatter.printInfo("No match for project #{bp.coll_p.name} with config #{bp.coll_p.config}", @options.collection_dir+"/Collection.meta", bp.coll_p.line_number)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
col.exclude.each do |p|
|
|
65
|
-
p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
|
|
66
|
-
p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
toBuild.delete_if do |bp|
|
|
70
|
-
exclude = false
|
|
71
|
-
col.exclude.each do |p|
|
|
72
|
-
exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil)
|
|
73
|
-
end
|
|
74
|
-
exclude
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
toBuild.uniq!
|
|
78
|
-
|
|
79
|
-
return toBuild
|
|
80
|
-
end
|
|
81
|
-
|
|
1
|
+
require "bakery/buildPattern"
|
|
2
|
+
|
|
3
|
+
module Bake
|
|
4
|
+
|
|
5
|
+
def self.getBuildPattern(cols, name)
|
|
6
|
+
|
|
7
|
+
colMeta = @options.collection_dir+"/Collection.meta"
|
|
8
|
+
|
|
9
|
+
if (cols.length == 0)
|
|
10
|
+
Bake.formatter.printError("Collection #{name} not found", colMeta)
|
|
11
|
+
ExitHelper.exit(1)
|
|
12
|
+
elsif (cols.length > 1)
|
|
13
|
+
Bake.formatter.printError("Collection #{name} found more than once", colMeta)
|
|
14
|
+
ExitHelper.exit(1)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
col = cols[0]
|
|
18
|
+
|
|
19
|
+
col.project.each do |p|
|
|
20
|
+
if p.name == ""
|
|
21
|
+
Bake.formatter.printError("Project name empty", p)
|
|
22
|
+
ExitHelper.exit(1)
|
|
23
|
+
end
|
|
24
|
+
if p.config == ""
|
|
25
|
+
Bake.formatter.printError("Config name empty", p)
|
|
26
|
+
ExitHelper.exit(1)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
toBuildPattern = []
|
|
31
|
+
@options.roots.each do |r|
|
|
32
|
+
col.project.each do |p|
|
|
33
|
+
projs = Dir.glob(r+"/**/"+p.name+"/Project.meta")
|
|
34
|
+
if projs.length == 0
|
|
35
|
+
toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout
|
|
36
|
+
end
|
|
37
|
+
projs.each do |f|
|
|
38
|
+
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
toBuild = []
|
|
44
|
+
toBuildPattern.each do |bp|
|
|
45
|
+
next unless bp.proj
|
|
46
|
+
contents = File.open(bp.proj, "r") {|io| io.read }
|
|
47
|
+
contents.split("\n").each do |c|
|
|
48
|
+
res = c.match("\\s*(Library|Executable|Custom){1}Config\\s*(\\w*)")
|
|
49
|
+
if res
|
|
50
|
+
if res[2].match(bp.conf) != nil
|
|
51
|
+
toBuild << BuildPattern.new(bp.proj, res[2], nil)
|
|
52
|
+
bp.coll_p.found
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
toBuildPattern.each do |bp|
|
|
59
|
+
if not bp.coll_p.isFound
|
|
60
|
+
Bake.formatter.printInfo("No match for project #{bp.coll_p.name} with config #{bp.coll_p.config}", @options.collection_dir+"/Collection.meta", bp.coll_p.line_number)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
col.exclude.each do |p|
|
|
65
|
+
p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
|
|
66
|
+
p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
toBuild.delete_if do |bp|
|
|
70
|
+
exclude = false
|
|
71
|
+
col.exclude.each do |p|
|
|
72
|
+
exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil)
|
|
73
|
+
end
|
|
74
|
+
exclude
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
toBuild.uniq!
|
|
78
|
+
|
|
79
|
+
return toBuild
|
|
80
|
+
end
|
|
81
|
+
|
|
82
82
|
end
|
data/lib/blocks/block.rb
CHANGED
|
@@ -1,325 +1,325 @@
|
|
|
1
|
-
require 'bake/libElement'
|
|
2
|
-
require 'common/abortException'
|
|
3
|
-
|
|
4
|
-
module Bake
|
|
5
|
-
|
|
6
|
-
BUILD_PASSED = 0
|
|
7
|
-
BUILD_FAILED = 1
|
|
8
|
-
BUILD_ABORTED = 2
|
|
9
|
-
|
|
10
|
-
module Blocks
|
|
11
|
-
|
|
12
|
-
CC2J = []
|
|
13
|
-
ALL_BLOCKS = {}
|
|
14
|
-
ALL_COMPILE_BLOCKS = {}
|
|
15
|
-
|
|
16
|
-
class Block
|
|
17
|
-
|
|
18
|
-
attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :warnConvValid, :prebuild
|
|
19
|
-
attr_accessor :visited, :inDeps, :result
|
|
20
|
-
|
|
21
|
-
def startupSteps
|
|
22
|
-
@startupSteps ||= []
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def preSteps
|
|
26
|
-
@preSteps ||= []
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def mainSteps
|
|
30
|
-
@mainSteps ||= []
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def postSteps
|
|
34
|
-
@postSteps ||= []
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def exitSteps
|
|
38
|
-
@exitSteps ||= []
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def dependencies
|
|
42
|
-
@dependencies ||= []
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def childs
|
|
46
|
-
@childs ||= []
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def parents
|
|
50
|
-
@parents ||= []
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def set_library(library)
|
|
54
|
-
@library = library
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def initialize(config, referencedConfigs, prebuild)
|
|
58
|
-
@inDeps = false
|
|
59
|
-
@prebuild = prebuild
|
|
60
|
-
@visited = false
|
|
61
|
-
@library = nil
|
|
62
|
-
@config = config
|
|
63
|
-
@referencedConfigs = referencedConfigs
|
|
64
|
-
@projectName = config.parent.name
|
|
65
|
-
@configName = config.name
|
|
66
|
-
@projectDir = config.get_project_dir
|
|
67
|
-
@@block_counter = 0
|
|
68
|
-
@result = true
|
|
69
|
-
|
|
70
|
-
@lib_elements = Bake::LibElements.calcLibElements(self)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def getCompileBlocks()
|
|
74
|
-
mainSteps.select { |m| Compile === m }
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def convPath(dir, elem=nil, warnIfLocal=false)
|
|
78
|
-
if dir.respond_to?("name")
|
|
79
|
-
d = dir.name
|
|
80
|
-
elem = dir
|
|
81
|
-
else
|
|
82
|
-
d = dir
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
@warnConvValid = false
|
|
86
|
-
|
|
87
|
-
return d if Bake.options.no_autodir
|
|
88
|
-
|
|
89
|
-
inc = d.split("/")
|
|
90
|
-
res = nil
|
|
91
|
-
if (inc[0] == @projectName)
|
|
92
|
-
res = inc[1..-1].join("/") # within self
|
|
93
|
-
res = "." if res == ""
|
|
94
|
-
elsif @referencedConfigs.include?(inc[0])
|
|
95
|
-
dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
|
|
96
|
-
res = File.rel_from_to_project(@projectDir, dirOther, false)
|
|
97
|
-
postfix = inc[1..-1].join("/")
|
|
98
|
-
res = res + "/" + postfix if postfix != ""
|
|
99
|
-
else
|
|
100
|
-
if (inc[0] != "..")
|
|
101
|
-
return d if File.exists?(@projectDir + "/" + d) # e.g. "include"
|
|
102
|
-
# check if dir exists without Project.meta entry
|
|
103
|
-
Bake.options.roots.each do |r|
|
|
104
|
-
absIncDir = r+"/"+d
|
|
105
|
-
if File.exists?(absIncDir)
|
|
106
|
-
res = File.rel_from_to_project(@projectDir,absIncDir,false)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
else
|
|
110
|
-
if elem and Bake.options.verbose >= 2
|
|
111
|
-
Bake.formatter.printInfo("\"..\" in path name found", elem)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
if res.nil? # relative from self as last resort
|
|
116
|
-
warnIfLocal = false # no path magic -> no warning
|
|
117
|
-
res = d
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
@warnConvValid = File.exists?(@projectDir + "/" + d) if warnIfLocal # only warn if path magic hides local path
|
|
122
|
-
|
|
123
|
-
res
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def self.block_counter
|
|
128
|
-
@@block_counter += 1
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def self.reset_block_counter
|
|
132
|
-
@@block_counter = 0
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def self.set_num_projects(num)
|
|
136
|
-
@@num_projects = num
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def executeStep(step, method)
|
|
140
|
-
begin
|
|
141
|
-
@result = step.send(method) && @result
|
|
142
|
-
rescue Bake::SystemCommandFailed => scf
|
|
143
|
-
@result = false
|
|
144
|
-
ProcessHelper.killProcess(true)
|
|
145
|
-
rescue SystemExit => exSys
|
|
146
|
-
@result = false
|
|
147
|
-
ProcessHelper.killProcess(true)
|
|
148
|
-
rescue Exception => ex1
|
|
149
|
-
@result = false
|
|
150
|
-
if not Bake::IDEInterface.instance.get_abort
|
|
151
|
-
Bake.formatter.printError("Error: #{ex1.message}")
|
|
152
|
-
puts ex1.backtrace if Bake.options.debug
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
if Bake::IDEInterface.instance.get_abort
|
|
157
|
-
raise AbortException.new
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
# needed for ctrl-c in Cygwin console
|
|
161
|
-
#####################################
|
|
162
|
-
# additionally, the user has to enable raw mode of Cygwin console: "stty raw".
|
|
163
|
-
# raw mode changes the signals into raw characters.
|
|
164
|
-
# original problem: Cygwin is compiled with broken control handler config,
|
|
165
|
-
# which might not be changed due to backward compatibility.
|
|
166
|
-
# the control handler works only with programs compiled under Cygwin, which is
|
|
167
|
-
# not true for Windows RubyInstaller packages.
|
|
168
|
-
ctrl_c_found = false
|
|
169
|
-
begin
|
|
170
|
-
while IO.select([$stdin],nil,nil,0) do
|
|
171
|
-
nextChar = $stdin.sysread(1)
|
|
172
|
-
if nextChar == "\x03"
|
|
173
|
-
ctrl_c_found = true
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
rescue Exception => e
|
|
177
|
-
end
|
|
178
|
-
raise AbortException.new if ctrl_c_found
|
|
179
|
-
|
|
180
|
-
return @result
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
def callDeps(method)
|
|
184
|
-
depResult = true
|
|
185
|
-
dependencies.each do |dep|
|
|
186
|
-
depResult = (ALL_BLOCKS[dep].send(method) and depResult)
|
|
187
|
-
break if not depResult and Bake.options.stopOnFirstError
|
|
188
|
-
end
|
|
189
|
-
return depResult
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
def callSteps(method)
|
|
193
|
-
|
|
194
|
-
preSteps.each do |step|
|
|
195
|
-
@result = executeStep(step, method) if @result
|
|
196
|
-
return false if not @result and Bake.options.stopOnFirstError
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
mainSteps.each do |step|
|
|
200
|
-
@result = executeStep(step, method) if @result
|
|
201
|
-
return false if not @result and Bake.options.stopOnFirstError
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
postSteps.each do |step|
|
|
205
|
-
@result = executeStep(step, method) if @result
|
|
206
|
-
return false if not @result and Bake.options.stopOnFirstError
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
return @result
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
def execute
|
|
213
|
-
if (@inDeps)
|
|
214
|
-
if Bake.options.verbose >= 3
|
|
215
|
-
Bake.formatter.printWarning("While calculating next config, a circular dependency was found including project #{@projectName} with config #{@configName}", @config)
|
|
216
|
-
end
|
|
217
|
-
return true
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
return true if (@visited)
|
|
221
|
-
@visited = true
|
|
222
|
-
|
|
223
|
-
@inDeps = true
|
|
224
|
-
depResult = callDeps(:execute)
|
|
225
|
-
@inDeps = false
|
|
226
|
-
return false if not depResult and Bake.options.stopOnFirstError
|
|
227
|
-
|
|
228
|
-
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
|
229
|
-
|
|
230
|
-
if Bake.options.verbose >= 1
|
|
231
|
-
typeStr = @prebuild ? "Skipping" : "Building"
|
|
232
|
-
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
return depResult if @prebuild
|
|
236
|
-
|
|
237
|
-
@result = callSteps(:execute)
|
|
238
|
-
return (depResult && @result)
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
def clean
|
|
242
|
-
return true if (@visited)
|
|
243
|
-
@visited = true
|
|
244
|
-
|
|
245
|
-
depResult = callDeps(:clean)
|
|
246
|
-
return false if not depResult and Bake.options.stopOnFirstError
|
|
247
|
-
|
|
248
|
-
if Bake.options.verbose >= 2
|
|
249
|
-
typeStr = @prebuild ? "Skipping" : "Cleaning"
|
|
250
|
-
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
return depResult if @prebuild
|
|
254
|
-
|
|
255
|
-
@result = callSteps(:clean)
|
|
256
|
-
|
|
257
|
-
if Bake.options.clobber
|
|
258
|
-
Dir.chdir(@projectDir) do
|
|
259
|
-
if File.exist?".bake"
|
|
260
|
-
puts "Deleting folder .bake" if Bake.options.verbose >= 2
|
|
261
|
-
FileUtils.rm_rf(".bake")
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
return (depResult && @result)
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
def startup
|
|
270
|
-
return true if (@visited)
|
|
271
|
-
@visited = true
|
|
272
|
-
|
|
273
|
-
depResult = callDeps(:startup)
|
|
274
|
-
|
|
275
|
-
if Bake.options.verbose >= 1 and not startupSteps.empty?
|
|
276
|
-
Bake.formatter.printAdditionalInfo "**** Starting up #{@projectName} (#{@configName}) ****"
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
startupSteps.each do |step|
|
|
280
|
-
@result = executeStep(step, :startupStep) && @result
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
return (depResult && @result)
|
|
284
|
-
end
|
|
285
|
-
|
|
286
|
-
def exits
|
|
287
|
-
return true if (@visited)
|
|
288
|
-
@visited = true
|
|
289
|
-
|
|
290
|
-
depResult = callDeps(:exits)
|
|
291
|
-
|
|
292
|
-
if Bake.options.verbose >= 1 and not exitSteps.empty?
|
|
293
|
-
Bake.formatter.printAdditionalInfo "**** Exiting #{@projectName} (#{@configName}) ****"
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
exitSteps.each do |step|
|
|
297
|
-
@result = executeStep(step, :exitStep) && @result
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
return (depResult && @result)
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
def getSubBlocks(b, method)
|
|
304
|
-
b.send(method).each do |child_b|
|
|
305
|
-
if not @otherBlocks.include?child_b and not child_b == self
|
|
306
|
-
@otherBlocks << child_b
|
|
307
|
-
getSubBlocks(child_b, method)
|
|
308
|
-
end
|
|
309
|
-
end
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
def getBlocks(method)
|
|
313
|
-
@otherBlocks = []
|
|
314
|
-
getSubBlocks(self, method)
|
|
315
|
-
return @otherBlocks
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
end
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
|
|
1
|
+
require 'bake/libElement'
|
|
2
|
+
require 'common/abortException'
|
|
3
|
+
|
|
4
|
+
module Bake
|
|
5
|
+
|
|
6
|
+
BUILD_PASSED = 0
|
|
7
|
+
BUILD_FAILED = 1
|
|
8
|
+
BUILD_ABORTED = 2
|
|
9
|
+
|
|
10
|
+
module Blocks
|
|
11
|
+
|
|
12
|
+
CC2J = []
|
|
13
|
+
ALL_BLOCKS = {}
|
|
14
|
+
ALL_COMPILE_BLOCKS = {}
|
|
15
|
+
|
|
16
|
+
class Block
|
|
17
|
+
|
|
18
|
+
attr_reader :lib_elements, :projectDir, :library, :config, :projectName, :warnConvValid, :prebuild
|
|
19
|
+
attr_accessor :visited, :inDeps, :result
|
|
20
|
+
|
|
21
|
+
def startupSteps
|
|
22
|
+
@startupSteps ||= []
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def preSteps
|
|
26
|
+
@preSteps ||= []
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def mainSteps
|
|
30
|
+
@mainSteps ||= []
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def postSteps
|
|
34
|
+
@postSteps ||= []
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def exitSteps
|
|
38
|
+
@exitSteps ||= []
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def dependencies
|
|
42
|
+
@dependencies ||= []
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def childs
|
|
46
|
+
@childs ||= []
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def parents
|
|
50
|
+
@parents ||= []
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def set_library(library)
|
|
54
|
+
@library = library
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(config, referencedConfigs, prebuild)
|
|
58
|
+
@inDeps = false
|
|
59
|
+
@prebuild = prebuild
|
|
60
|
+
@visited = false
|
|
61
|
+
@library = nil
|
|
62
|
+
@config = config
|
|
63
|
+
@referencedConfigs = referencedConfigs
|
|
64
|
+
@projectName = config.parent.name
|
|
65
|
+
@configName = config.name
|
|
66
|
+
@projectDir = config.get_project_dir
|
|
67
|
+
@@block_counter = 0
|
|
68
|
+
@result = true
|
|
69
|
+
|
|
70
|
+
@lib_elements = Bake::LibElements.calcLibElements(self)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def getCompileBlocks()
|
|
74
|
+
mainSteps.select { |m| Compile === m }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def convPath(dir, elem=nil, warnIfLocal=false)
|
|
78
|
+
if dir.respond_to?("name")
|
|
79
|
+
d = dir.name
|
|
80
|
+
elem = dir
|
|
81
|
+
else
|
|
82
|
+
d = dir
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
@warnConvValid = false
|
|
86
|
+
|
|
87
|
+
return d if Bake.options.no_autodir
|
|
88
|
+
|
|
89
|
+
inc = d.split("/")
|
|
90
|
+
res = nil
|
|
91
|
+
if (inc[0] == @projectName)
|
|
92
|
+
res = inc[1..-1].join("/") # within self
|
|
93
|
+
res = "." if res == ""
|
|
94
|
+
elsif @referencedConfigs.include?(inc[0])
|
|
95
|
+
dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
|
|
96
|
+
res = File.rel_from_to_project(@projectDir, dirOther, false)
|
|
97
|
+
postfix = inc[1..-1].join("/")
|
|
98
|
+
res = res + "/" + postfix if postfix != ""
|
|
99
|
+
else
|
|
100
|
+
if (inc[0] != "..")
|
|
101
|
+
return d if File.exists?(@projectDir + "/" + d) # e.g. "include"
|
|
102
|
+
# check if dir exists without Project.meta entry
|
|
103
|
+
Bake.options.roots.each do |r|
|
|
104
|
+
absIncDir = r+"/"+d
|
|
105
|
+
if File.exists?(absIncDir)
|
|
106
|
+
res = File.rel_from_to_project(@projectDir,absIncDir,false)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
else
|
|
110
|
+
if elem and Bake.options.verbose >= 2
|
|
111
|
+
Bake.formatter.printInfo("\"..\" in path name found", elem)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if res.nil? # relative from self as last resort
|
|
116
|
+
warnIfLocal = false # no path magic -> no warning
|
|
117
|
+
res = d
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
@warnConvValid = File.exists?(@projectDir + "/" + d) if warnIfLocal # only warn if path magic hides local path
|
|
122
|
+
|
|
123
|
+
res
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def self.block_counter
|
|
128
|
+
@@block_counter += 1
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def self.reset_block_counter
|
|
132
|
+
@@block_counter = 0
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def self.set_num_projects(num)
|
|
136
|
+
@@num_projects = num
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def executeStep(step, method)
|
|
140
|
+
begin
|
|
141
|
+
@result = step.send(method) && @result
|
|
142
|
+
rescue Bake::SystemCommandFailed => scf
|
|
143
|
+
@result = false
|
|
144
|
+
ProcessHelper.killProcess(true)
|
|
145
|
+
rescue SystemExit => exSys
|
|
146
|
+
@result = false
|
|
147
|
+
ProcessHelper.killProcess(true)
|
|
148
|
+
rescue Exception => ex1
|
|
149
|
+
@result = false
|
|
150
|
+
if not Bake::IDEInterface.instance.get_abort
|
|
151
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
|
152
|
+
puts ex1.backtrace if Bake.options.debug
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if Bake::IDEInterface.instance.get_abort
|
|
157
|
+
raise AbortException.new
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# needed for ctrl-c in Cygwin console
|
|
161
|
+
#####################################
|
|
162
|
+
# additionally, the user has to enable raw mode of Cygwin console: "stty raw".
|
|
163
|
+
# raw mode changes the signals into raw characters.
|
|
164
|
+
# original problem: Cygwin is compiled with broken control handler config,
|
|
165
|
+
# which might not be changed due to backward compatibility.
|
|
166
|
+
# the control handler works only with programs compiled under Cygwin, which is
|
|
167
|
+
# not true for Windows RubyInstaller packages.
|
|
168
|
+
ctrl_c_found = false
|
|
169
|
+
begin
|
|
170
|
+
while IO.select([$stdin],nil,nil,0) do
|
|
171
|
+
nextChar = $stdin.sysread(1)
|
|
172
|
+
if nextChar == "\x03"
|
|
173
|
+
ctrl_c_found = true
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
rescue Exception => e
|
|
177
|
+
end
|
|
178
|
+
raise AbortException.new if ctrl_c_found
|
|
179
|
+
|
|
180
|
+
return @result
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def callDeps(method)
|
|
184
|
+
depResult = true
|
|
185
|
+
dependencies.each do |dep|
|
|
186
|
+
depResult = (ALL_BLOCKS[dep].send(method) and depResult)
|
|
187
|
+
break if not depResult and Bake.options.stopOnFirstError
|
|
188
|
+
end
|
|
189
|
+
return depResult
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def callSteps(method)
|
|
193
|
+
|
|
194
|
+
preSteps.each do |step|
|
|
195
|
+
@result = executeStep(step, method) if @result
|
|
196
|
+
return false if not @result and Bake.options.stopOnFirstError
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
mainSteps.each do |step|
|
|
200
|
+
@result = executeStep(step, method) if @result
|
|
201
|
+
return false if not @result and Bake.options.stopOnFirstError
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
postSteps.each do |step|
|
|
205
|
+
@result = executeStep(step, method) if @result
|
|
206
|
+
return false if not @result and Bake.options.stopOnFirstError
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
return @result
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def execute
|
|
213
|
+
if (@inDeps)
|
|
214
|
+
if Bake.options.verbose >= 3
|
|
215
|
+
Bake.formatter.printWarning("While calculating next config, a circular dependency was found including project #{@projectName} with config #{@configName}", @config)
|
|
216
|
+
end
|
|
217
|
+
return true
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
return true if (@visited)
|
|
221
|
+
@visited = true
|
|
222
|
+
|
|
223
|
+
@inDeps = true
|
|
224
|
+
depResult = callDeps(:execute)
|
|
225
|
+
@inDeps = false
|
|
226
|
+
return false if not depResult and Bake.options.stopOnFirstError
|
|
227
|
+
|
|
228
|
+
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
|
229
|
+
|
|
230
|
+
if Bake.options.verbose >= 1
|
|
231
|
+
typeStr = @prebuild ? "Skipping" : "Building"
|
|
232
|
+
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
return depResult if @prebuild
|
|
236
|
+
|
|
237
|
+
@result = callSteps(:execute)
|
|
238
|
+
return (depResult && @result)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def clean
|
|
242
|
+
return true if (@visited)
|
|
243
|
+
@visited = true
|
|
244
|
+
|
|
245
|
+
depResult = callDeps(:clean)
|
|
246
|
+
return false if not depResult and Bake.options.stopOnFirstError
|
|
247
|
+
|
|
248
|
+
if Bake.options.verbose >= 2
|
|
249
|
+
typeStr = @prebuild ? "Skipping" : "Cleaning"
|
|
250
|
+
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
return depResult if @prebuild
|
|
254
|
+
|
|
255
|
+
@result = callSteps(:clean)
|
|
256
|
+
|
|
257
|
+
if Bake.options.clobber
|
|
258
|
+
Dir.chdir(@projectDir) do
|
|
259
|
+
if File.exist?".bake"
|
|
260
|
+
puts "Deleting folder .bake" if Bake.options.verbose >= 2
|
|
261
|
+
FileUtils.rm_rf(".bake")
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
return (depResult && @result)
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def startup
|
|
270
|
+
return true if (@visited)
|
|
271
|
+
@visited = true
|
|
272
|
+
|
|
273
|
+
depResult = callDeps(:startup)
|
|
274
|
+
|
|
275
|
+
if Bake.options.verbose >= 1 and not startupSteps.empty?
|
|
276
|
+
Bake.formatter.printAdditionalInfo "**** Starting up #{@projectName} (#{@configName}) ****"
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
startupSteps.each do |step|
|
|
280
|
+
@result = executeStep(step, :startupStep) && @result
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
return (depResult && @result)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def exits
|
|
287
|
+
return true if (@visited)
|
|
288
|
+
@visited = true
|
|
289
|
+
|
|
290
|
+
depResult = callDeps(:exits)
|
|
291
|
+
|
|
292
|
+
if Bake.options.verbose >= 1 and not exitSteps.empty?
|
|
293
|
+
Bake.formatter.printAdditionalInfo "**** Exiting #{@projectName} (#{@configName}) ****"
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
exitSteps.each do |step|
|
|
297
|
+
@result = executeStep(step, :exitStep) && @result
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
return (depResult && @result)
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def getSubBlocks(b, method)
|
|
304
|
+
b.send(method).each do |child_b|
|
|
305
|
+
if not @otherBlocks.include?child_b and not child_b == self
|
|
306
|
+
@otherBlocks << child_b
|
|
307
|
+
getSubBlocks(child_b, method)
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
def getBlocks(method)
|
|
313
|
+
@otherBlocks = []
|
|
314
|
+
getSubBlocks(self, method)
|
|
315
|
+
return @otherBlocks
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
|
|
325
325
|
end
|