Class: Bake::Blocks::Library
Instance Attribute Summary
Attributes inherited from BlockBase
#tcs
Instance Method Summary
collapse
Methods inherited from BlockBase
#calcOutputDir, #check_config_file, #config_changed?, #defaultToolchainTime, isCmdLineEqual?, prepareOutput, #printCmd, #process_console_output, #process_result, writeCmdLineFile
Constructor Details
#initialize(block, config, referencedConfigs, tcs, compileBlock) ⇒ Library
Returns a new instance of Library.
9
10
11
12
13
14
|
# File 'lib/blocks/library.rb', line 9
def initialize(block, config, referencedConfigs, tcs, compileBlock)
super(block,config, referencedConfigs, tcs)
@compileBlock = compileBlock
block.set_library(self)
end
|
Instance Method Details
#archive_name ⇒ Object
16
17
18
|
# File 'lib/blocks/library.rb', line 16
def archive_name()
@archive_name ||= File.join([@output_dir, "lib#{@projectName}.a"])
end
|
#calcCmdlineFile ⇒ Object
20
21
22
|
# File 'lib/blocks/library.rb', line 20
def calcCmdlineFile()
archive_name + ".cmdline"
end
|
#clean ⇒ Object
80
81
82
83
84
85
86
87
88
|
# File 'lib/blocks/library.rb', line 80
def clean
Dir.chdir(@projectDir) do
if File.exist?@output_dir
puts "Deleting folder #{@output_dir}" if Bake.options.verbose >= 2
FileUtils.rm_rf(@output_dir)
end
end unless Bake.options.filename
return true
end
|
#execute ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/blocks/library.rb', line 42
def execute
Dir.chdir(@projectDir) do
cmdLineCheck = false
cmdLineFile = calcCmdlineFile()
reason = needed?
if not reason
cmdLineCheck = true
reason = config_changed?(cmdLineFile)
end
return true unless reason
archiver = @tcs[:ARCHIVER]
cmd = Utils.flagSplit(archiver[:COMMAND], false)
cmd += Bake::Utils::flagSplit(archiver[:FLAGS],true)
cmd += archiver[:ARCHIVE_FLAGS].split(" ")
if archiver[:ARCHIVE_FLAGS_SPACE]
cmd << archive_name
else
cmd[cmd.length-1] += archive_name
end
cmd += @compileBlock.objects
return true if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
BlockBase.prepareOutput(archive_name)
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
success, consoleOutput = ProcessHelper.run(cmd, false, false)
process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{archive_name}", reason, success)
check_config_file()
return success
end
end
|
#needed? ⇒ Boolean
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/blocks/library.rb', line 24
def needed?
return false if Bake.options.linkOnly
return false if Bake.options.prepro
return "because library does not exist" if not File.exists?(archive_name)
aTime = File.mtime(archive_name)
@compileBlock.objects.each do |obj|
return "because object #{obj} does not exist" if not File.exists?(obj)
return "because object #{obj} is newer than executable" if aTime < File.mtime(obj)
end
false
end
|