bake-toolkit 1.0.1
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.
- data/Rakefile.rb +3 -0
- data/bin/bake +86 -0
- data/bin/bakery +234 -0
- data/lib/alias/loader.rb +56 -0
- data/lib/alias/model/language.rb +22 -0
- data/lib/alias/model/metamodel.rb +29 -0
- data/lib/bake/cache.rb +142 -0
- data/lib/bake/loader.rb +92 -0
- data/lib/bake/model/language.rb +46 -0
- data/lib/bake/model/metamodel.rb +226 -0
- data/lib/bake/model/metamodel_ext.rb +15 -0
- data/lib/bake/options.rb +288 -0
- data/lib/bake/subst.rb +90 -0
- data/lib/bake/util.rb +98 -0
- data/lib/bake/version.rb +30 -0
- data/lib/bakery/loader.rb +57 -0
- data/lib/bakery/model/language.rb +22 -0
- data/lib/bakery/model/metamodel.rb +44 -0
- data/lib/bakery/options.rb +98 -0
- data/lib/option/parser.rb +66 -0
- data/lib/tocxx.rb +883 -0
- data/license.txt +64 -0
- metadata +109 -0
data/Rakefile.rb
ADDED
data/bin/bake
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$timeStart = Time.now
|
4
|
+
|
5
|
+
$:.unshift(File.dirname(__FILE__)+"/../lib")
|
6
|
+
require 'bake/version'
|
7
|
+
|
8
|
+
$:.unshift(File.dirname(__FILE__)+"/../../cxxproject_master.git/lib")
|
9
|
+
|
10
|
+
require "cxxproject/version"
|
11
|
+
|
12
|
+
STDOUT.sync = true
|
13
|
+
STDERR.sync = true
|
14
|
+
|
15
|
+
puts "-- bake #{Cxxproject::Version.bake}, ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}, platform #{RUBY_PLATFORM} --"
|
16
|
+
|
17
|
+
require 'tocxx'
|
18
|
+
require 'bake/options'
|
19
|
+
require 'socket'
|
20
|
+
|
21
|
+
module Cxxproject
|
22
|
+
|
23
|
+
def self.isNewer(oldVersion, newVersion)
|
24
|
+
oldSplitted = oldVersion.split(".")
|
25
|
+
newSplitted = newVersion.split(".")
|
26
|
+
if oldSplitted.length >= 3 and newSplitted.length >= 3
|
27
|
+
3.times do |i|
|
28
|
+
return true if newSplitted[i].to_i > oldSplitted[i].to_i
|
29
|
+
return false if newSplitted[i].to_i < oldSplitted[i].to_i
|
30
|
+
end
|
31
|
+
end
|
32
|
+
return false;
|
33
|
+
end
|
34
|
+
|
35
|
+
earlyExit = nil
|
36
|
+
begin
|
37
|
+
options = Options.new(ARGV)
|
38
|
+
options.parse_options
|
39
|
+
|
40
|
+
tocxx = Cxxproject::ToCxx.new(options)
|
41
|
+
|
42
|
+
tocxx.connect()
|
43
|
+
|
44
|
+
if tocxx.doit()
|
45
|
+
tocxx.start()
|
46
|
+
end
|
47
|
+
tocxx.disconnect()
|
48
|
+
|
49
|
+
rescue SystemExit => e
|
50
|
+
earlyExit = e
|
51
|
+
begin
|
52
|
+
tocxx.disconnect()
|
53
|
+
rescue Exception => e2
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
timeEnd = Time.now
|
59
|
+
timeDiff = timeEnd - $timeStart
|
60
|
+
Printer.printInfo "\nTime: %02d:%02d minutes" % [timeDiff/60, timeDiff%60]
|
61
|
+
|
62
|
+
# update check
|
63
|
+
#begin
|
64
|
+
# versionWarningString = ""
|
65
|
+
# require 'net/http'
|
66
|
+
# vtext = Net::HTTP.get('10.40.38.84', '/bake/versions.txt')
|
67
|
+
# vtextSplitted = vtext.split(" ")
|
68
|
+
# if vtextSplitted.length > 0
|
69
|
+
# if isNewer(Cxxproject::Version.bake, vtextSplitted[0])
|
70
|
+
# versionWarningString = versionWarningString + "\nNewer version of bake gem available: #{vtextSplitted[0]} - please update!"
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# if vtextSplitted.length > 1
|
74
|
+
# if isNewer(options.eclipse_version, vtextSplitted[1])
|
75
|
+
# versionWarningString = versionWarningString + "\nNewer version of bake Eclipse plugin available: #{vtextSplitted[1]} - please update!"
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
# if versionWarningString != ""
|
79
|
+
# Printer.printWarning versionWarningString
|
80
|
+
# end
|
81
|
+
#rescue Exception => e
|
82
|
+
#end
|
83
|
+
|
84
|
+
|
85
|
+
raise earlyExit if earlyExit
|
86
|
+
end
|
data/bin/bakery
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$timeStart = Time.now
|
4
|
+
|
5
|
+
$:.unshift(File.dirname(__FILE__)+"/../lib")
|
6
|
+
require 'bake/version'
|
7
|
+
|
8
|
+
$:.unshift(File.dirname(__FILE__)+"/../../cxxproject_master.git/lib")
|
9
|
+
|
10
|
+
require "cxxproject/version"
|
11
|
+
|
12
|
+
puts "-- bakery #{Cxxproject::Version.bake}, ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}, platform #{RUBY_PLATFORM} --"
|
13
|
+
|
14
|
+
STDOUT.sync = true
|
15
|
+
STDERR.sync = true
|
16
|
+
|
17
|
+
require 'cxxproject/utils/printer'
|
18
|
+
require 'tocxx'
|
19
|
+
require "bakery/loader"
|
20
|
+
require "bakery/options"
|
21
|
+
require 'cxxproject/ext/stdout'
|
22
|
+
require 'cxxproject/utils/cleanup'
|
23
|
+
|
24
|
+
module Cxxproject
|
25
|
+
|
26
|
+
class BuildPattern
|
27
|
+
attr_reader :proj, :conf, :coll_p
|
28
|
+
def initialize(proj, conf, coll_p)
|
29
|
+
@proj = proj
|
30
|
+
@conf = conf
|
31
|
+
@coll_p = coll_p
|
32
|
+
end
|
33
|
+
def getId
|
34
|
+
proj + "*******" + conf
|
35
|
+
end
|
36
|
+
def hash
|
37
|
+
getId.hash
|
38
|
+
end
|
39
|
+
def eql?(comparee)
|
40
|
+
self == comparee
|
41
|
+
end
|
42
|
+
def ==(comparee)
|
43
|
+
self.getId == comparee.getId
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
@options = BakeryOptions.new(ARGV)
|
48
|
+
@options.parse_options
|
49
|
+
|
50
|
+
env = nil
|
51
|
+
begin
|
52
|
+
loader = BakeryLoader.new(@options)
|
53
|
+
env = loader.load(@options.collection_dir+"/Collection.meta")
|
54
|
+
rescue Exception => e
|
55
|
+
ExitHelper.exit(1)
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
if @options.collection_name.nil?
|
60
|
+
puts "Please specify a collection name (with -b). Possible values are:"
|
61
|
+
env.find(:class => BakeryModel::Collection).each { |e|
|
62
|
+
puts "* " + e.name
|
63
|
+
}
|
64
|
+
ExitHelper.exit(0)
|
65
|
+
end
|
66
|
+
|
67
|
+
cols = env.find(:class => BakeryModel::Collection, :name => @options.collection_name)
|
68
|
+
if (cols.length == 0)
|
69
|
+
Printer.printError "Collection #{@options.collection_name} not found in #{@options.collection_dir+"/Collection.meta"}"
|
70
|
+
ExitHelper.exit(1)
|
71
|
+
elsif (cols.length > 1)
|
72
|
+
Printer.printError "Collection #{@options.collection_name} found more than once in #{@options.collection_dir+"/Collection.meta"}"
|
73
|
+
ExitHelper.exit(1)
|
74
|
+
end
|
75
|
+
|
76
|
+
col = cols[0]
|
77
|
+
|
78
|
+
col.project.each do |p|
|
79
|
+
if p.name == ""
|
80
|
+
Printer.printError "Error in #{@options.collection_dir+"/Collection.meta"} (line #{p.line_number}): Project name empty"
|
81
|
+
ExitHelper.exit(1)
|
82
|
+
end
|
83
|
+
if p.config == ""
|
84
|
+
Printer.printError "Error in #{@options.collection_dir+"/Collection.meta"} (line #{p.line_number}): Config name empty"
|
85
|
+
ExitHelper.exit(1)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
toBuildPattern = []
|
90
|
+
@options.roots.each do |r|
|
91
|
+
col.project.each do |p|
|
92
|
+
projs = Dir.glob(r+"/"+p.name+"/Project.meta")
|
93
|
+
if projs.length == 0
|
94
|
+
toBuildPattern << BuildPattern.new(nil, nil, p) # remember it for sorted info printout
|
95
|
+
end
|
96
|
+
projs.each do |f|
|
97
|
+
toBuildPattern << BuildPattern.new(f, "^"+p.config.gsub("*","(\\w*)")+"$", p)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
toBuild = []
|
103
|
+
toBuildPattern.each do |bp|
|
104
|
+
next unless bp.proj
|
105
|
+
contents = File.open(bp.proj, "r") {|io| io.read }
|
106
|
+
contents.split("\n").each do |c|
|
107
|
+
res = c.match("\\s*(Library|Executable|Custom){1}Config\\s*(\\w*)")
|
108
|
+
if res
|
109
|
+
if res[2].match(bp.conf) != nil
|
110
|
+
toBuild << BuildPattern.new(bp.proj, res[2], nil)
|
111
|
+
bp.coll_p.found
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
toBuildPattern.each do |bp|
|
118
|
+
Printer.printInfo "Info in #{@options.collection_dir+"/Collection.meta"} (line #{bp.coll_p.line_number}): No match for project #{bp.coll_p.name} with config #{bp.coll_p.config}" unless bp.coll_p.isFound
|
119
|
+
end
|
120
|
+
|
121
|
+
col.exclude.each do |p|
|
122
|
+
p.name = "/"+p.name.gsub("*","(\\w*)")+"/Project.meta"
|
123
|
+
p.config = "^"+p.config.gsub("*","(\\w*)")+"$"
|
124
|
+
end
|
125
|
+
|
126
|
+
toBuild.delete_if do |bp|
|
127
|
+
exclude = false
|
128
|
+
col.exclude.each do |p|
|
129
|
+
exclude = true if (bp.proj.match(p.name) != nil and bp.conf.match(p.config) != nil)
|
130
|
+
end
|
131
|
+
exclude
|
132
|
+
end
|
133
|
+
|
134
|
+
toBuild.uniq!
|
135
|
+
|
136
|
+
maxRuns = toBuild.length
|
137
|
+
currentRun = 0
|
138
|
+
failedRuns = 0
|
139
|
+
|
140
|
+
passedParams = []
|
141
|
+
excludeParam = false
|
142
|
+
ARGV.each do |x|
|
143
|
+
if (x=="-b" or x=="-m" or x=="-p" or x=="-e" or x=="--socket")
|
144
|
+
excludeParam = true
|
145
|
+
next
|
146
|
+
end
|
147
|
+
if excludeParam
|
148
|
+
excludeParam = false
|
149
|
+
next
|
150
|
+
end
|
151
|
+
passedParams << x
|
152
|
+
end
|
153
|
+
|
154
|
+
if @options.socket != 0
|
155
|
+
Rake.application.idei.connect(@options.socket)
|
156
|
+
end
|
157
|
+
|
158
|
+
msg1 = "* bakery "
|
159
|
+
|
160
|
+
ExitHelper.enable_exit_test
|
161
|
+
|
162
|
+
exitValue = 0
|
163
|
+
abort = false
|
164
|
+
toBuild.each do |bp|
|
165
|
+
currentRun += 1
|
166
|
+
p = File.dirname(bp.proj)
|
167
|
+
cmd = (["-m #{p} -b #{bp.conf}"] + passedParams).join(" ")
|
168
|
+
cmdWithNum = "* bakery #{currentRun} of #{maxRuns}: bake " + cmd + " *"
|
169
|
+
print "\n"; cmdWithNum.length.times { print "*" }; print "\n";
|
170
|
+
Printer.printInfo cmdWithNum
|
171
|
+
cmdWithNum.length.times { print "*" }; print "\n";
|
172
|
+
|
173
|
+
runOk = true
|
174
|
+
begin
|
175
|
+
bakeOptions = Options.new(cmd.split(" "))
|
176
|
+
bakeOptions.parse_options
|
177
|
+
tocxx = ToCxx.new(bakeOptions)
|
178
|
+
if tocxx.doit()
|
179
|
+
runOk = tocxx.start()
|
180
|
+
else
|
181
|
+
runOk = false
|
182
|
+
end
|
183
|
+
rescue
|
184
|
+
runOk = false
|
185
|
+
end
|
186
|
+
|
187
|
+
Utils.cleanup_rake
|
188
|
+
ExitHelper.reset_exit_code
|
189
|
+
|
190
|
+
if runOk == false
|
191
|
+
exitValue = 1
|
192
|
+
failedRuns += 1
|
193
|
+
if @options.error
|
194
|
+
msg1 << "aborted, "
|
195
|
+
abort = true
|
196
|
+
break
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
print "\n"
|
202
|
+
|
203
|
+
if not abort
|
204
|
+
if failedRuns > 0
|
205
|
+
msg1 << "summary: #{failedRuns} of #{maxRuns} builds failed, "
|
206
|
+
else
|
207
|
+
msg1 << "summary: #{maxRuns-failedRuns} of #{maxRuns} builds ok, "
|
208
|
+
end
|
209
|
+
else
|
210
|
+
end
|
211
|
+
|
212
|
+
timeEnd = Time.now
|
213
|
+
timeDiff = timeEnd - $timeStart
|
214
|
+
msg1 << "time: %02d:%02d minutes *" % [timeDiff/60, timeDiff%60]
|
215
|
+
|
216
|
+
stars = ""
|
217
|
+
msg1.length.times { stars << "*" }
|
218
|
+
|
219
|
+
if failedRuns == 0
|
220
|
+
Printer.printSuccess stars
|
221
|
+
Printer.printSuccess msg1
|
222
|
+
Printer.printSuccess stars
|
223
|
+
else
|
224
|
+
Printer.printError stars
|
225
|
+
Printer.printError msg1
|
226
|
+
Printer.printError stars
|
227
|
+
end
|
228
|
+
|
229
|
+
Rake.application.idei.disconnect()
|
230
|
+
|
231
|
+
ExitHelper.disable_exit_test
|
232
|
+
ExitHelper.exit(exitValue)
|
233
|
+
end
|
234
|
+
|
data/lib/alias/loader.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'alias/model/metamodel'
|
2
|
+
require 'alias/model/language'
|
3
|
+
|
4
|
+
require 'rgen/environment'
|
5
|
+
require 'rgen/fragment/fragmented_model'
|
6
|
+
|
7
|
+
require 'rtext/default_loader'
|
8
|
+
|
9
|
+
require 'cxxproject/utils/exit_helper'
|
10
|
+
require 'cxxproject/utils/printer'
|
11
|
+
|
12
|
+
module Cxxproject
|
13
|
+
|
14
|
+
class AliasLoader
|
15
|
+
|
16
|
+
attr_reader :model
|
17
|
+
|
18
|
+
def initialize(options)
|
19
|
+
@env = RGen::Environment.new
|
20
|
+
@options = options
|
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
|
+
Printer.printError "Error: #{filename} does not exist"
|
30
|
+
ExitHelper.exit(1)
|
31
|
+
end
|
32
|
+
|
33
|
+
loader = RText::DefaultLoader.new(
|
34
|
+
Cxxproject::AliasLanguage,
|
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
|
+
Printer.printError "Error: "+p.file+"("+p.line.to_s+"): "+p.message
|
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,22 @@
|
|
1
|
+
require 'bake/model/metamodel'
|
2
|
+
require 'rtext/language'
|
3
|
+
|
4
|
+
module Cxxproject
|
5
|
+
|
6
|
+
AliasLanguage =
|
7
|
+
RText::Language.new(AliasModel.ecore,
|
8
|
+
:feature_provider => proc {|c|
|
9
|
+
RGen::Serializer::OppositeReferenceFilter.call(c.eAllStructuralFeatures).reject {|f|
|
10
|
+
f.eAnnotations.any? {|a|
|
11
|
+
a.details.any? {|d| d.key == 'internal' && d.value == 'true'}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
},
|
15
|
+
:unlabled_arguments => proc {|c|
|
16
|
+
["hdd_name", "logical_name"]
|
17
|
+
},
|
18
|
+
:line_number_attribute => "line_number",
|
19
|
+
:file_name_attribute => "file_name"
|
20
|
+
)
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rgen/metamodel_builder'
|
2
|
+
require 'rgen/metamodel_builder/data_types'
|
3
|
+
|
4
|
+
module Cxxproject
|
5
|
+
|
6
|
+
module AliasModel
|
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 Alias < ModelElement
|
20
|
+
has_attr 'hdd_name', String, :defaultValueLiteral => ""
|
21
|
+
has_attr 'logical_name', String, :defaultValueLiteral => ""
|
22
|
+
end
|
23
|
+
class Aliases < ModelElement
|
24
|
+
contains_many 'alias', Alias, 'aliases'
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/lib/bake/cache.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'cxxproject/utils/exit_helper'
|
2
|
+
require 'cxxproject/utils/printer'
|
3
|
+
require 'bake/version'
|
4
|
+
require 'bake/options'
|
5
|
+
|
6
|
+
module Cxxproject
|
7
|
+
|
8
|
+
class Cache
|
9
|
+
attr_accessor :project2config
|
10
|
+
attr_accessor :files # project_files
|
11
|
+
attr_accessor :cache_file
|
12
|
+
attr_accessor :version
|
13
|
+
attr_accessor :workspace_roots
|
14
|
+
attr_accessor :include_filter
|
15
|
+
attr_accessor :exclude_filter
|
16
|
+
attr_accessor :defaultToolchain
|
17
|
+
attr_accessor :defaultToolchainTime
|
18
|
+
end
|
19
|
+
|
20
|
+
class CacheAccess
|
21
|
+
attr_reader :defaultToolchain
|
22
|
+
attr_reader :defaultToolchainTime
|
23
|
+
attr_reader :cacheFilename
|
24
|
+
|
25
|
+
def initialize(pm_filename, config_name, options)
|
26
|
+
@cacheFilename = File.dirname(pm_filename)+"/.bake/"+File.basename(pm_filename)+"."+sanitize_filename(config_name)+".cache"
|
27
|
+
FileUtils.mkdir_p(File.dirname(@cacheFilename))
|
28
|
+
@options = options
|
29
|
+
@defaultToolchain = nil
|
30
|
+
@defaultToolchainTime = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def load_cache
|
34
|
+
cache = nil
|
35
|
+
begin
|
36
|
+
allFiles = Dir.glob(File.dirname(@cacheFilename)+"/*.cache")
|
37
|
+
if allFiles.include?(@cacheFilename)
|
38
|
+
cacheTime = File.mtime(@cacheFilename)
|
39
|
+
contents = File.open(@cacheFilename, "rb") {|io| io.read }
|
40
|
+
cache = Marshal.load(contents)
|
41
|
+
|
42
|
+
if cache.version != Version.bake
|
43
|
+
Printer.printInfo("Info: cache version ("+cache.version+") does not match to bake version ("+Version.bake+"), reloading meta information")
|
44
|
+
cache = nil
|
45
|
+
@options.set_nocache # complete re-read
|
46
|
+
else
|
47
|
+
@defaultToolchain = cache.defaultToolchain
|
48
|
+
@defaultToolchainTime = cache.defaultToolchainTime
|
49
|
+
end
|
50
|
+
|
51
|
+
if cache != nil
|
52
|
+
if cache.cache_file != @cacheFilename
|
53
|
+
Printer.printInfo "Info: cache filename changed, reloading meta information"
|
54
|
+
cache = nil
|
55
|
+
@options.set_nocache # abs dir may wrong
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
if cache != nil
|
60
|
+
cache.files.each do |c|
|
61
|
+
if (not File.exists?(c))
|
62
|
+
Printer.printInfo "Info: meta file(s) renamed or deleted, reloading meta information"
|
63
|
+
cache = nil
|
64
|
+
@options.set_nocache # abs dir may wrong
|
65
|
+
break
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if cache != nil
|
71
|
+
cache.files.each do |c|
|
72
|
+
if File.mtime(c) > cacheTime
|
73
|
+
Printer.printInfo "Info: cache is out-of-date, reloading meta information"
|
74
|
+
cache = nil
|
75
|
+
break
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if cache != nil
|
81
|
+
if cache.workspace_roots.length == @options.roots.length
|
82
|
+
cache.workspace_roots.each do |r|
|
83
|
+
if not @options.roots.include?r
|
84
|
+
break
|
85
|
+
end
|
86
|
+
end
|
87
|
+
else
|
88
|
+
cache = nil
|
89
|
+
end
|
90
|
+
Printer.printInfo "Info: specified roots differ from cached roots, reloading meta information" if cache.nil?
|
91
|
+
end
|
92
|
+
|
93
|
+
if cache != nil
|
94
|
+
if (not @options.include_filter.eql?(cache.include_filter)) or (not @options.exclude_filter.eql?(cache.exclude_filter))
|
95
|
+
cache = nil
|
96
|
+
Printer.printInfo "Info: specified filters differ from cached filters, reloading meta information"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
else
|
101
|
+
Printer.printInfo("Info: cache not found, reloading meta information")
|
102
|
+
end
|
103
|
+
|
104
|
+
rescue ExitHelperException
|
105
|
+
raise
|
106
|
+
rescue
|
107
|
+
Printer.printWarning "Warning: cache file corrupt, reloading meta information"
|
108
|
+
cache = nil
|
109
|
+
end
|
110
|
+
|
111
|
+
if cache != nil
|
112
|
+
Printer.printInfo "Info: cache is up-to-date, loading cached meta information" if @options.verbose
|
113
|
+
return cache.project2config
|
114
|
+
end
|
115
|
+
return nil
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
def write_cache(project_files, project2config, defaultToolchain, defaultToolchainTime)
|
120
|
+
cache = Cache.new
|
121
|
+
cache.project2config = project2config
|
122
|
+
cache.files = project_files
|
123
|
+
cache.cache_file = @cacheFilename
|
124
|
+
cache.version = Version.bake
|
125
|
+
cache.include_filter = @options.include_filter
|
126
|
+
cache.exclude_filter = @options.exclude_filter
|
127
|
+
cache.workspace_roots = @options.roots
|
128
|
+
cache.defaultToolchain = defaultToolchain
|
129
|
+
cache.defaultToolchainTime = defaultToolchainTime
|
130
|
+
bbdump = Marshal.dump(cache)
|
131
|
+
begin
|
132
|
+
File.delete(@cacheFilename)
|
133
|
+
rescue
|
134
|
+
end
|
135
|
+
File.open(@cacheFilename, 'wb') {|file| file.write(bbdump) }
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
end
|
142
|
+
|