bake-toolkit 1.8.0.1 → 2.0.10
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/bin/bake +14 -53
- data/bin/bakery +50 -43
- data/bin/createVSProjects +3 -3
- data/doc/cmd/install.html +1 -5
- data/doc/cmd/usecmd.html +29 -5
- data/doc/dyk/lint.html +21 -4
- data/doc/dyk/tipps.html +0 -6
- data/doc/eclipse/import.html +3 -1
- data/doc/eclipse/import/Import.png +0 -0
- data/doc/eclipse/use.html +8 -5
- data/doc/further/change.html +134 -1
- data/doc/further/issues.html +1 -0
- data/doc/further/wish.html +24 -21
- data/doc/index.html +1 -1
- data/doc/syntax/subst.html +8 -1
- data/doc/syntax/syntax.html +42 -14
- data/lib/bake/cache.rb +51 -59
- data/lib/bake/config/loader.rb +289 -0
- data/lib/bake/libElement.rb +134 -0
- data/lib/bake/mergeConfig.rb +1 -1
- data/lib/bake/model/language.rb +1 -1
- data/lib/bake/model/loader.rb +88 -0
- data/lib/bake/model/metamodel.rb +24 -16
- data/lib/bake/model/metamodel_ext.rb +9 -4
- data/lib/bake/options/options.rb +222 -0
- data/lib/bake/options/showConfigNames.rb +44 -0
- data/lib/bake/options/showDoc.rb +19 -0
- data/lib/bake/options/showLicense.rb +9 -0
- data/lib/bake/options/showToolchains.rb +39 -0
- data/lib/bake/options/usage.rb +54 -0
- data/lib/bake/process_output.rb +10 -0
- data/lib/bake/subst.rb +105 -40
- data/lib/bake/toolchain/clang.rb +44 -0
- data/lib/bake/toolchain/colorizing_formatter.rb +125 -0
- data/lib/bake/toolchain/diab.rb +53 -0
- data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -0
- data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +41 -0
- data/lib/bake/toolchain/errorparser/error_parser.rb +71 -0
- data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -0
- data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +35 -0
- data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -0
- data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +44 -0
- data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -0
- data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +30 -0
- data/lib/bake/toolchain/errorparser/lint_error_parser.rb +34 -0
- data/lib/bake/toolchain/errorparser/process_output.rb +3 -0
- data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -0
- data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +30 -0
- data/lib/bake/toolchain/gcc.rb +49 -0
- data/lib/bake/toolchain/gcc_param.rb +7 -0
- data/lib/bake/toolchain/greenhills.rb +52 -0
- data/lib/bake/toolchain/keil.rb +55 -0
- data/lib/bake/toolchain/lint.rb +20 -0
- data/lib/bake/toolchain/provider.rb +136 -0
- data/lib/bake/toolchain/ti.rb +47 -0
- data/lib/bake/util.rb +27 -15
- data/lib/bakery/buildPattern.rb +1 -1
- data/lib/bakery/model/language.rb +1 -1
- data/lib/bakery/model/loader.rb +56 -0
- data/lib/bakery/model/metamodel.rb +1 -1
- data/lib/bakery/options/options.rb +87 -0
- data/lib/bakery/toBake.rb +10 -6
- data/lib/blocks/block.rb +225 -0
- data/lib/blocks/blockBase.rb +155 -0
- data/lib/blocks/commandLine.rb +25 -0
- data/lib/blocks/compile.rb +382 -0
- data/lib/blocks/docu.rb +28 -0
- data/lib/blocks/executable.rb +143 -0
- data/lib/blocks/has_execute_command.rb +31 -0
- data/lib/blocks/library.rb +78 -0
- data/lib/blocks/lint.rb +53 -0
- data/lib/blocks/makefile.rb +87 -0
- data/lib/blocks/showIncludes.rb +114 -0
- data/lib/common/abortException.rb +4 -0
- data/lib/common/cleanup.rb +9 -0
- data/lib/common/exit_helper.rb +28 -0
- data/lib/common/ext/file.rb +88 -0
- data/lib/common/ext/stdout.rb +45 -0
- data/lib/common/ide_interface.rb +194 -0
- data/lib/common/options/option.rb +13 -0
- data/lib/common/options/parser.rb +59 -0
- data/lib/common/process.rb +64 -0
- data/lib/common/utils.rb +52 -0
- data/lib/{bake → common}/version.rb +3 -10
- data/lib/multithread/job.rb +44 -0
- data/lib/tocxx.rb +201 -932
- data/lib/vs/options.rb +3 -2
- data/license.txt +47 -22
- metadata +90 -30
- data/bin/bake-doc +0 -12
- data/lib/alias/loader.rb +0 -56
- data/lib/alias/model/language.rb +0 -22
- data/lib/alias/model/metamodel.rb +0 -29
- data/lib/bake/loader.rb +0 -92
- data/lib/bake/options.rb +0 -421
- data/lib/bakery/loader.rb +0 -57
- data/lib/bakery/options.rb +0 -105
- data/lib/option/parser.rb +0 -73
data/lib/bakery/buildPattern.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'bakery/model/metamodel'
|
2
|
+
require 'bakery/model/language'
|
3
|
+
require 'common/version'
|
4
|
+
|
5
|
+
require 'rgen/environment'
|
6
|
+
require 'rgen/fragment/fragmented_model'
|
7
|
+
|
8
|
+
require 'rtext/default_loader'
|
9
|
+
|
10
|
+
require 'common/exit_helper'
|
11
|
+
require 'bake/toolchain/colorizing_formatter'
|
12
|
+
|
13
|
+
module Bake
|
14
|
+
|
15
|
+
class BakeryLoader
|
16
|
+
|
17
|
+
attr_reader :model
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@env = RGen::Environment.new
|
21
|
+
@model = RGen::Fragment::FragmentedModel.new(:env => @env)
|
22
|
+
end
|
23
|
+
|
24
|
+
def load(filename)
|
25
|
+
|
26
|
+
sumErrors = 0
|
27
|
+
|
28
|
+
if not File.exists?filename
|
29
|
+
Bake.formatter.printError("Error: #{filename} does not exist")
|
30
|
+
ExitHelper.exit(1)
|
31
|
+
end
|
32
|
+
|
33
|
+
loader = RText::DefaultLoader.new(
|
34
|
+
Bake::BakeryLanguage,
|
35
|
+
@model,
|
36
|
+
:file_provider => proc { [filename] },
|
37
|
+
:cache => @DumpFileCache)
|
38
|
+
loader.load()
|
39
|
+
|
40
|
+
f = @model.fragments[0]
|
41
|
+
|
42
|
+
f.data[:problems].each do |p|
|
43
|
+
Bake.formatter.printError(p.message, p.file, p.line)
|
44
|
+
end
|
45
|
+
|
46
|
+
if f.data[:problems].length > 0
|
47
|
+
ExitHelper.exit(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
return @env
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +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(Option.new("-b",true) { |x| set_collection_name(x) })
|
24
|
+
add_option(Option.new("-m",true) { |x| set_collection_dir(x) })
|
25
|
+
add_option(Option.new("-r",false) { @error = true })
|
26
|
+
add_option(Option.new("-a",true) { |x|Bake.formatter.setColorScheme(x.to_sym) })
|
27
|
+
add_option(Option.new("-w",true) { |x| set_root(x) })
|
28
|
+
add_option(Option.new("--socket",true) { |x| @socket = String === x ? x.to_i : x })
|
29
|
+
add_option(Option.new("-h",false) { usage; ExitHelper.exit(0) })
|
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 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()
|
46
|
+
parse_internal(true)
|
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,14 +1,16 @@
|
|
1
1
|
require "bakery/buildPattern"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Bake
|
4
4
|
|
5
5
|
def self.getBuildPattern(cols, name)
|
6
6
|
|
7
|
+
colMeta = @options.collection_dir+"/Collection.meta"
|
8
|
+
|
7
9
|
if (cols.length == 0)
|
8
|
-
|
10
|
+
Bake.formatter.printError("Collection #{name} not found", colMeta)
|
9
11
|
ExitHelper.exit(1)
|
10
12
|
elsif (cols.length > 1)
|
11
|
-
|
13
|
+
Bake.formatter.printError("Collection #{name} found more than once", colMeta)
|
12
14
|
ExitHelper.exit(1)
|
13
15
|
end
|
14
16
|
|
@@ -16,11 +18,11 @@ module Cxxproject
|
|
16
18
|
|
17
19
|
col.project.each do |p|
|
18
20
|
if p.name == ""
|
19
|
-
|
21
|
+
Bake.formatter.printError("Project name empty", p)
|
20
22
|
ExitHelper.exit(1)
|
21
23
|
end
|
22
24
|
if p.config == ""
|
23
|
-
|
25
|
+
Bake.formatter.printError("Config name empty", p)
|
24
26
|
ExitHelper.exit(1)
|
25
27
|
end
|
26
28
|
end
|
@@ -54,7 +56,9 @@ module Cxxproject
|
|
54
56
|
end
|
55
57
|
|
56
58
|
toBuildPattern.each do |bp|
|
57
|
-
|
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
|
58
62
|
end
|
59
63
|
|
60
64
|
col.exclude.each do |p|
|
data/lib/blocks/block.rb
ADDED
@@ -0,0 +1,225 @@
|
|
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
|
+
ALL_BLOCKS = {}
|
13
|
+
ALL_COMPILE_BLOCKS = {}
|
14
|
+
|
15
|
+
class Block
|
16
|
+
|
17
|
+
attr_reader :lib_elements, :projectDir, :library, :config
|
18
|
+
attr_accessor :visited, :inDeps, :result
|
19
|
+
|
20
|
+
def preSteps
|
21
|
+
@preSteps ||= []
|
22
|
+
end
|
23
|
+
|
24
|
+
def mainSteps
|
25
|
+
@mainSteps ||= []
|
26
|
+
end
|
27
|
+
|
28
|
+
def postSteps
|
29
|
+
@postSteps ||= []
|
30
|
+
end
|
31
|
+
|
32
|
+
def dependencies
|
33
|
+
@dependencies ||= []
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_library(library)
|
37
|
+
@library = library
|
38
|
+
end
|
39
|
+
|
40
|
+
def initialize(config, referencedConfigs)
|
41
|
+
@inDeps = false
|
42
|
+
@visited = false
|
43
|
+
@library = nil
|
44
|
+
@config = config
|
45
|
+
@referencedConfigs = referencedConfigs
|
46
|
+
@projectName = config.parent.name
|
47
|
+
@configName = config.name
|
48
|
+
@projectDir = config.get_project_dir
|
49
|
+
@@block_counter = 0
|
50
|
+
@result = false
|
51
|
+
|
52
|
+
@lib_elements = Bake::LibElements.calcLibElements(self)
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_lib_element(elem)
|
56
|
+
@lib_elements[2000000000] = [elem]
|
57
|
+
end
|
58
|
+
|
59
|
+
def convPath(dir, elem=nil)
|
60
|
+
if dir.respond_to?("name")
|
61
|
+
d = dir.name
|
62
|
+
elem = dir
|
63
|
+
else
|
64
|
+
d = dir
|
65
|
+
end
|
66
|
+
|
67
|
+
return d if Bake.options.no_autodir
|
68
|
+
|
69
|
+
inc = d.split("/")
|
70
|
+
if (inc[0] == @projectName)
|
71
|
+
res = inc[1..-1].join("/") # within self
|
72
|
+
res = "." if res == ""
|
73
|
+
elsif @referencedConfigs.include?(inc[0])
|
74
|
+
dirOther = @referencedConfigs[inc[0]].first.parent.get_project_dir
|
75
|
+
res = File.rel_from_to_project(@projectDir, dirOther, false)
|
76
|
+
postfix = inc[1..-1].join("/")
|
77
|
+
res = res + "/" + postfix if postfix != ""
|
78
|
+
else
|
79
|
+
if (inc[0] != "..")
|
80
|
+
return d if File.exists?(@projectDir + "/" + d) # e.g. "include"
|
81
|
+
|
82
|
+
# check if dir exists without Project.meta entry
|
83
|
+
Bake.options.roots.each do |r|
|
84
|
+
absIncDir = r+"/"+d
|
85
|
+
if File.exists?(absIncDir)
|
86
|
+
res = File.rel_from_to_project(@projectDir,absIncDir,false)
|
87
|
+
if not res.nil?
|
88
|
+
return res
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
else
|
93
|
+
if elem and Bake.options.verboseHigh
|
94
|
+
Bake.formatter.printInfo("\"..\" in path name found", elem)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
res = d # relative from self as last resort
|
99
|
+
end
|
100
|
+
res
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def self.block_counter
|
105
|
+
@@block_counter += 1
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.reset_block_counter
|
109
|
+
@@block_counter = 0
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.set_num_projects(num)
|
113
|
+
@@num_projects = num
|
114
|
+
end
|
115
|
+
|
116
|
+
def executeStep(step, method)
|
117
|
+
result = false
|
118
|
+
begin
|
119
|
+
step.send method
|
120
|
+
result = true
|
121
|
+
rescue Bake::SystemCommandFailed => scf
|
122
|
+
rescue SystemExit => exSys
|
123
|
+
ProcessHelper.killProcess(true)
|
124
|
+
rescue Exception => ex1
|
125
|
+
if not Bake::IDEInterface.instance.get_abort
|
126
|
+
Bake.formatter.printError("Error: #{ex1.message}")
|
127
|
+
puts ex1.backtrace if Bake.options.debug
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if Bake::IDEInterface.instance.get_abort
|
132
|
+
raise AbortException.new
|
133
|
+
end
|
134
|
+
|
135
|
+
return result
|
136
|
+
end
|
137
|
+
|
138
|
+
def callDeps(method)
|
139
|
+
depResult = true
|
140
|
+
dependencies.each do |dep|
|
141
|
+
depResult = (ALL_BLOCKS[dep].send(method) and depResult)
|
142
|
+
break if not depResult and Bake.options.stopOnFirstError
|
143
|
+
end
|
144
|
+
return depResult
|
145
|
+
end
|
146
|
+
|
147
|
+
def callSteps(method)
|
148
|
+
result = true
|
149
|
+
preSteps.each do |step|
|
150
|
+
result = executeStep(step, method) if result
|
151
|
+
return false if not result and Bake.options.stopOnFirstError
|
152
|
+
end
|
153
|
+
|
154
|
+
mainSteps.each do |step|
|
155
|
+
result = executeStep(step, method) if result
|
156
|
+
return false if not result and Bake.options.stopOnFirstError
|
157
|
+
end
|
158
|
+
|
159
|
+
postSteps.each do |step|
|
160
|
+
result = executeStep(step, method) if result
|
161
|
+
return false if not result and Bake.options.stopOnFirstError
|
162
|
+
end
|
163
|
+
|
164
|
+
return result
|
165
|
+
end
|
166
|
+
|
167
|
+
def execute
|
168
|
+
if (@inDeps)
|
169
|
+
if not Bake.options.verboseLow
|
170
|
+
Bake.formatter.printWarning("Circular dependency found including project #{@projectName} with config #{@configName}", @config)
|
171
|
+
end
|
172
|
+
return true
|
173
|
+
end
|
174
|
+
|
175
|
+
return true if (@visited)
|
176
|
+
@visited = true
|
177
|
+
|
178
|
+
@inDeps = true
|
179
|
+
depResult = callDeps(:execute)
|
180
|
+
@inDeps = false
|
181
|
+
return false if not depResult and Bake.options.stopOnFirstError
|
182
|
+
|
183
|
+
Bake::IDEInterface.instance.set_build_info(@projectName, @configName)
|
184
|
+
|
185
|
+
if not Bake.options.verboseLow
|
186
|
+
Bake.formatter.printAdditionalInfo "**** Building #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
187
|
+
end
|
188
|
+
|
189
|
+
@result = callSteps(:execute)
|
190
|
+
return (depResult && result)
|
191
|
+
end
|
192
|
+
|
193
|
+
def clean
|
194
|
+
return true if (@visited)
|
195
|
+
@visited = true
|
196
|
+
|
197
|
+
depResult = callDeps(:clean)
|
198
|
+
return false if not depResult and Bake.options.stopOnFirstError
|
199
|
+
|
200
|
+
if Bake.options.verboseHigh
|
201
|
+
Bake.formatter.printAdditionalInfo "**** Cleaning #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
202
|
+
end
|
203
|
+
|
204
|
+
@result = callSteps(:clean)
|
205
|
+
|
206
|
+
if Bake.options.clobber
|
207
|
+
Dir.chdir(@projectDir) do
|
208
|
+
if File.exist?".bake"
|
209
|
+
puts "Deleting folder .bake" if Bake.options.verboseHigh
|
210
|
+
FileUtils.rm_rf(".bake")
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
return (depResult && result)
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module Bake
|
2
|
+
module Blocks
|
3
|
+
|
4
|
+
class BlockBase
|
5
|
+
|
6
|
+
attr_reader :tcs
|
7
|
+
|
8
|
+
def initialize(block, config, referencedConfigs, tcs)
|
9
|
+
@block = block
|
10
|
+
@config = config
|
11
|
+
@referencedConfigs = referencedConfigs
|
12
|
+
@projectName = config.parent.name
|
13
|
+
@projectDir = config.get_project_dir
|
14
|
+
@tcs = tcs
|
15
|
+
@config_date = Time.now
|
16
|
+
|
17
|
+
@printedCmdAlternate = false
|
18
|
+
@lastCommand = nil
|
19
|
+
|
20
|
+
calcOutputDir
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_config_file()
|
24
|
+
if File.exists?(@config.file_name) and File.mtime(@config.file_name) > @config_date
|
25
|
+
begin
|
26
|
+
FileUtils.touch(@config.file_name)
|
27
|
+
rescue Exception=>e
|
28
|
+
if Bake.options.verboseHigh
|
29
|
+
Bake.formatter.printWarning("Could not touch #{@config.file_name}: #{e.message}", @config.file_name)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def prepareOutput(filename)
|
36
|
+
begin
|
37
|
+
if File.exists?(filename)
|
38
|
+
FileUtils.rm(filename)
|
39
|
+
else
|
40
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
41
|
+
end
|
42
|
+
rescue Exception => e
|
43
|
+
if Bake.options.debug
|
44
|
+
puts e.message
|
45
|
+
puts e.backtrace
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def calcOutputDir
|
51
|
+
if @tcs[:OUTPUT_DIR] != nil
|
52
|
+
p = @block.convPath(@tcs[:OUTPUT_DIR])
|
53
|
+
@output_dir = p
|
54
|
+
elsif @projectName == Bake.options.main_project_name and @config.name == Bake.options.build_config
|
55
|
+
@output_dir = Bake.options.build_config
|
56
|
+
else
|
57
|
+
@output_dir = @config.name + "_" + Bake.options.main_project_name + "_" + Bake.options.build_config
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def printCmd(cmd, alternate, reason, forceVerbose)
|
62
|
+
|
63
|
+
if (cmd == @lastCommand)
|
64
|
+
if (Bake.options.verboseHigh or (@printedCmdAlternate and not forceVerbose))
|
65
|
+
return
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
@lastCommand = cmd
|
70
|
+
|
71
|
+
return if Bake.options.verboseLow and not forceVerbose
|
72
|
+
|
73
|
+
if forceVerbose or Bake.options.verboseHigh or not alternate
|
74
|
+
@printedCmdAlternate = false
|
75
|
+
if Bake.options.verboseHigh
|
76
|
+
puts "" # for A.K. :-)
|
77
|
+
exedIn = "\n(executed in '#{@projectDir}')"
|
78
|
+
because = reason ? "\n(#{reason})" : ""
|
79
|
+
else
|
80
|
+
exedIn = ""
|
81
|
+
because = ""
|
82
|
+
end
|
83
|
+
|
84
|
+
if cmd.is_a?(Array)
|
85
|
+
puts cmd.join(' ') + exedIn + because
|
86
|
+
else
|
87
|
+
puts cmd + exedIn + because
|
88
|
+
end
|
89
|
+
else
|
90
|
+
@printedCmdAlternate = true
|
91
|
+
puts alternate
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
def process_console_output(console_output, error_parser)
|
97
|
+
ret = false
|
98
|
+
if not console_output.empty?
|
99
|
+
if error_parser
|
100
|
+
begin
|
101
|
+
error_descs, console_output_full = error_parser.scan_lines(console_output, @projectDir)
|
102
|
+
|
103
|
+
console_output = console_output_full if Bake.options.consoleOutput_fullnames
|
104
|
+
|
105
|
+
if Bake.options.consoleOutput_visualStudio
|
106
|
+
console_output_VS = ""
|
107
|
+
descCounter = 0
|
108
|
+
console_output.each_line do |l|
|
109
|
+
d = error_descs[descCounter]
|
110
|
+
console_output_VS << error_parser.makeVsError(l.rstrip, d) << "\n"
|
111
|
+
descCounter = descCounter + 1
|
112
|
+
end
|
113
|
+
console_output = console_output_VS
|
114
|
+
end
|
115
|
+
|
116
|
+
if Bake.options.lint
|
117
|
+
ret = error_descs.any? { |e| e.severity != ErrorParser::SEVERITY_OK }
|
118
|
+
else
|
119
|
+
ret = error_descs.any? { |e| e.severity == ErrorParser::SEVERITY_ERROR }
|
120
|
+
end
|
121
|
+
|
122
|
+
console_output.gsub!(/[\r]/, "")
|
123
|
+
Bake.formatter.format(console_output, error_descs, error_parser)
|
124
|
+
|
125
|
+
Bake::IDEInterface.instance.set_errors(error_descs)
|
126
|
+
rescue Exception => e
|
127
|
+
Bake.formatter.printWarning("Parsing output failed (maybe language not set to English?): " + e.message)
|
128
|
+
Bake.formatter.printWarning("Original output:")
|
129
|
+
Bake.formatter.printWarning(console_output)
|
130
|
+
raise e
|
131
|
+
end
|
132
|
+
else
|
133
|
+
puts console_output # fallback
|
134
|
+
end
|
135
|
+
end
|
136
|
+
ret
|
137
|
+
end
|
138
|
+
|
139
|
+
def process_result(cmd, console_output, error_parser, alternate, reason, success)
|
140
|
+
hasError = (success == false)
|
141
|
+
printCmd(cmd, alternate, reason, (hasError and not Bake.options.lint))
|
142
|
+
errorPrinted = process_console_output(console_output, error_parser)
|
143
|
+
|
144
|
+
if hasError and not errorPrinted
|
145
|
+
Bake.formatter.printError("System command failed", @projectDir)
|
146
|
+
end
|
147
|
+
if hasError or errorPrinted
|
148
|
+
raise SystemCommandFailed.new
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
end
|