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,32 +1,32 @@
|
|
|
1
|
-
module Bake
|
|
2
|
-
|
|
3
|
-
module Blocks
|
|
4
|
-
|
|
5
|
-
module HasExecuteCommand
|
|
6
|
-
|
|
7
|
-
def executeCommand(commandLine, ignoreStr=nil, exitCodeArray = [0])
|
|
8
|
-
puts commandLine if Bake.options.verbose >= 1
|
|
9
|
-
puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
|
|
10
|
-
cmd_result = false
|
|
11
|
-
output = ""
|
|
12
|
-
begin
|
|
13
|
-
Dir.chdir(@projectDir) do
|
|
14
|
-
cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray)
|
|
15
|
-
end
|
|
16
|
-
rescue Exception=>e
|
|
17
|
-
puts e.message
|
|
18
|
-
puts e.backtrace if Bake.options.debug
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
if (cmd_result == false and (not ignoreStr or not output.include?ignoreStr))
|
|
22
|
-
Bake.formatter.printError("Command \"#{commandLine}\" failed", @config)
|
|
23
|
-
puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
|
|
24
|
-
raise SystemCommandFailed.new
|
|
25
|
-
end
|
|
26
|
-
return cmd_result
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
1
|
+
module Bake
|
|
2
|
+
|
|
3
|
+
module Blocks
|
|
4
|
+
|
|
5
|
+
module HasExecuteCommand
|
|
6
|
+
|
|
7
|
+
def executeCommand(commandLine, ignoreStr=nil, exitCodeArray = [0])
|
|
8
|
+
puts commandLine if Bake.options.verbose >= 1
|
|
9
|
+
puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
|
|
10
|
+
cmd_result = false
|
|
11
|
+
output = ""
|
|
12
|
+
begin
|
|
13
|
+
Dir.chdir(@projectDir) do
|
|
14
|
+
cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray)
|
|
15
|
+
end
|
|
16
|
+
rescue Exception=>e
|
|
17
|
+
puts e.message
|
|
18
|
+
puts e.backtrace if Bake.options.debug
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if (cmd_result == false and (not ignoreStr or not output.include?ignoreStr))
|
|
22
|
+
Bake.formatter.printError("Command \"#{commandLine}\" failed", @config)
|
|
23
|
+
puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
|
|
24
|
+
raise SystemCommandFailed.new
|
|
25
|
+
end
|
|
26
|
+
return cmd_result
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
32
|
end
|
data/lib/blocks/library.rb
CHANGED
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
require 'blocks/blockBase'
|
|
2
|
-
|
|
3
|
-
module Bake
|
|
4
|
-
|
|
5
|
-
module Blocks
|
|
6
|
-
|
|
7
|
-
class Library < BlockBase
|
|
8
|
-
|
|
9
|
-
attr_reader :compileBlock, :archive_name
|
|
10
|
-
|
|
11
|
-
def initialize(block, config, referencedConfigs, tcs, compileBlock)
|
|
12
|
-
super(block,config, referencedConfigs, tcs)
|
|
13
|
-
@compileBlock = compileBlock
|
|
14
|
-
|
|
15
|
-
block.set_library(self)
|
|
16
|
-
|
|
17
|
-
calcArtifactName
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def calcArtifactName
|
|
21
|
-
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
|
22
|
-
baseFilename = @config.artifactName.name
|
|
23
|
-
else
|
|
24
|
-
baseFilename = "lib#{@projectName}.a"
|
|
25
|
-
end
|
|
26
|
-
@archive_name ||= File.join([@output_dir, baseFilename])
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def calcCmdlineFile()
|
|
30
|
-
@archive_name + ".cmdline"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def ignore?
|
|
34
|
-
Bake.options.linkOnly or Bake.options.prepro
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def needed?
|
|
38
|
-
# lib
|
|
39
|
-
return "because library does not exist" if not File.exists?(@archive_name)
|
|
40
|
-
|
|
41
|
-
aTime = File.mtime(@archive_name)
|
|
42
|
-
|
|
43
|
-
# sources
|
|
44
|
-
@compileBlock.objects.each do |obj|
|
|
45
|
-
return "because object #{obj} does not exist" if not File.exists?(obj)
|
|
46
|
-
return "because object #{obj} is newer than executable" if aTime < File.mtime(obj)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
false
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def execute
|
|
53
|
-
|
|
54
|
-
Dir.chdir(@projectDir) do
|
|
55
|
-
if @compileBlock.objects.empty?
|
|
56
|
-
puts "No source files, library won't be created" if Bake.options.verbose >= 2
|
|
57
|
-
return true
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
cmdLineCheck = false
|
|
61
|
-
cmdLineFile = calcCmdlineFile()
|
|
62
|
-
|
|
63
|
-
return true if ignore?
|
|
64
|
-
reason = needed?
|
|
65
|
-
if not reason
|
|
66
|
-
cmdLineCheck = true
|
|
67
|
-
reason = config_changed?(cmdLineFile)
|
|
68
|
-
end
|
|
69
|
-
archiver = @tcs[:ARCHIVER]
|
|
70
|
-
|
|
71
|
-
cmd = Utils.flagSplit(archiver[:COMMAND], false) # ar
|
|
72
|
-
cmd += Bake::Utils::flagSplit(archiver[:FLAGS],true) # --all_load
|
|
73
|
-
cmd += archiver[:ARCHIVE_FLAGS].split(" ")
|
|
74
|
-
|
|
75
|
-
if archiver[:ARCHIVE_FLAGS_SPACE]
|
|
76
|
-
cmd << @archive_name
|
|
77
|
-
else
|
|
78
|
-
cmd[cmd.length-1] += @archive_name
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
cmd += @compileBlock.objects
|
|
82
|
-
|
|
83
|
-
if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
|
|
84
|
-
success = true
|
|
85
|
-
else
|
|
86
|
-
BlockBase.prepareOutput(@archive_name)
|
|
87
|
-
|
|
88
|
-
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
|
89
|
-
success, consoleOutput = ProcessHelper.run(cmd, false, false)
|
|
90
|
-
process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{@archive_name}", reason, success)
|
|
91
|
-
|
|
92
|
-
check_config_file()
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
Bake::Bundle.instance.addLib(@archive_name, isMainProject? ? @config : nil)
|
|
96
|
-
|
|
97
|
-
return success
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def clean
|
|
102
|
-
Dir.chdir(@projectDir) do
|
|
103
|
-
if File.exist?@output_dir
|
|
104
|
-
puts "Deleting folder #{@output_dir}" if Bake.options.verbose >= 2
|
|
105
|
-
FileUtils.rm_rf(@output_dir)
|
|
106
|
-
end
|
|
107
|
-
end unless Bake.options.filename
|
|
108
|
-
return true
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
end
|
|
1
|
+
require 'blocks/blockBase'
|
|
2
|
+
|
|
3
|
+
module Bake
|
|
4
|
+
|
|
5
|
+
module Blocks
|
|
6
|
+
|
|
7
|
+
class Library < BlockBase
|
|
8
|
+
|
|
9
|
+
attr_reader :compileBlock, :archive_name
|
|
10
|
+
|
|
11
|
+
def initialize(block, config, referencedConfigs, tcs, compileBlock)
|
|
12
|
+
super(block,config, referencedConfigs, tcs)
|
|
13
|
+
@compileBlock = compileBlock
|
|
14
|
+
|
|
15
|
+
block.set_library(self)
|
|
16
|
+
|
|
17
|
+
calcArtifactName
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def calcArtifactName
|
|
21
|
+
if not @config.artifactName.nil? and @config.artifactName.name != ""
|
|
22
|
+
baseFilename = @config.artifactName.name
|
|
23
|
+
else
|
|
24
|
+
baseFilename = "lib#{@projectName}.a"
|
|
25
|
+
end
|
|
26
|
+
@archive_name ||= File.join([@output_dir, baseFilename])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def calcCmdlineFile()
|
|
30
|
+
@archive_name + ".cmdline"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def ignore?
|
|
34
|
+
Bake.options.linkOnly or Bake.options.prepro
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def needed?
|
|
38
|
+
# lib
|
|
39
|
+
return "because library does not exist" if not File.exists?(@archive_name)
|
|
40
|
+
|
|
41
|
+
aTime = File.mtime(@archive_name)
|
|
42
|
+
|
|
43
|
+
# sources
|
|
44
|
+
@compileBlock.objects.each do |obj|
|
|
45
|
+
return "because object #{obj} does not exist" if not File.exists?(obj)
|
|
46
|
+
return "because object #{obj} is newer than executable" if aTime < File.mtime(obj)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def execute
|
|
53
|
+
|
|
54
|
+
Dir.chdir(@projectDir) do
|
|
55
|
+
if @compileBlock.objects.empty?
|
|
56
|
+
puts "No source files, library won't be created" if Bake.options.verbose >= 2
|
|
57
|
+
return true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
cmdLineCheck = false
|
|
61
|
+
cmdLineFile = calcCmdlineFile()
|
|
62
|
+
|
|
63
|
+
return true if ignore?
|
|
64
|
+
reason = needed?
|
|
65
|
+
if not reason
|
|
66
|
+
cmdLineCheck = true
|
|
67
|
+
reason = config_changed?(cmdLineFile)
|
|
68
|
+
end
|
|
69
|
+
archiver = @tcs[:ARCHIVER]
|
|
70
|
+
|
|
71
|
+
cmd = Utils.flagSplit(archiver[:COMMAND], false) # ar
|
|
72
|
+
cmd += Bake::Utils::flagSplit(archiver[:FLAGS],true) # --all_load
|
|
73
|
+
cmd += archiver[:ARCHIVE_FLAGS].split(" ")
|
|
74
|
+
|
|
75
|
+
if archiver[:ARCHIVE_FLAGS_SPACE]
|
|
76
|
+
cmd << @archive_name
|
|
77
|
+
else
|
|
78
|
+
cmd[cmd.length-1] += @archive_name
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
cmd += @compileBlock.objects
|
|
82
|
+
|
|
83
|
+
if cmdLineCheck and BlockBase.isCmdLineEqual?(cmd, cmdLineFile)
|
|
84
|
+
success = true
|
|
85
|
+
else
|
|
86
|
+
BlockBase.prepareOutput(@archive_name)
|
|
87
|
+
|
|
88
|
+
BlockBase.writeCmdLineFile(cmd, cmdLineFile)
|
|
89
|
+
success, consoleOutput = ProcessHelper.run(cmd, false, false)
|
|
90
|
+
process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], "Creating #{@archive_name}", reason, success)
|
|
91
|
+
|
|
92
|
+
check_config_file()
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
Bake::Bundle.instance.addLib(@archive_name, isMainProject? ? @config : nil)
|
|
96
|
+
|
|
97
|
+
return success
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def clean
|
|
102
|
+
Dir.chdir(@projectDir) do
|
|
103
|
+
if File.exist?@output_dir
|
|
104
|
+
puts "Deleting folder #{@output_dir}" if Bake.options.verbose >= 2
|
|
105
|
+
FileUtils.rm_rf(@output_dir)
|
|
106
|
+
end
|
|
107
|
+
end unless Bake.options.filename
|
|
108
|
+
return true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
115
|
end
|
data/lib/blocks/lint.rb
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
require 'blocks/compile'
|
|
2
|
-
|
|
3
|
-
module Bake
|
|
4
|
-
module Blocks
|
|
5
|
-
class Lint < Compile
|
|
6
|
-
|
|
7
|
-
def initialize(block, config, referencedConfigs, tcs)
|
|
8
|
-
super(block,config, referencedConfigs, tcs)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def execute
|
|
12
|
-
success = true
|
|
13
|
-
Dir.chdir(@projectDir) do
|
|
14
|
-
compiler = @tcs[:COMPILER][:CPP]
|
|
15
|
-
calcSources
|
|
16
|
-
|
|
17
|
-
noFilesToLint = (@source_files.length == 0)
|
|
18
|
-
|
|
19
|
-
if Bake.options.lint_min >= 1 and Bake.options.lint_min >= @source_files.length
|
|
20
|
-
noFilesToLint = true
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
if Bake.options.lint_max >= 0 and Bake.options.lint_max < Bake.options.lint_min
|
|
24
|
-
noFilesToLint = true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
if noFilesToLint
|
|
28
|
-
Bake.formatter.printInfo("No files to lint", @config)
|
|
29
|
-
else
|
|
30
|
-
@source_files = @source_files[Bake.options.lint_min..Bake.options.lint_max]
|
|
31
|
-
|
|
32
|
-
cmd = [compiler[:COMMAND]]
|
|
33
|
-
cmd += compiler[:COMPILE_FLAGS]
|
|
34
|
-
|
|
35
|
-
cmd += @include_array[:CPP]
|
|
36
|
-
cmd += @define_array[:CPP]
|
|
37
|
-
|
|
38
|
-
cmd += @tcs[:LINT_POLICY]
|
|
39
|
-
|
|
40
|
-
cmd += @source_files
|
|
41
|
-
|
|
42
|
-
printCmd(cmd, "Linting #{@source_files.length} file(s)...", nil, false)
|
|
43
|
-
success, consoleOutput = ProcessHelper.run(cmd, false)
|
|
44
|
-
process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "Linting...", nil, success)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
return success
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def clean
|
|
51
|
-
return true
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
1
|
+
require 'blocks/compile'
|
|
2
|
+
|
|
3
|
+
module Bake
|
|
4
|
+
module Blocks
|
|
5
|
+
class Lint < Compile
|
|
6
|
+
|
|
7
|
+
def initialize(block, config, referencedConfigs, tcs)
|
|
8
|
+
super(block,config, referencedConfigs, tcs)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def execute
|
|
12
|
+
success = true
|
|
13
|
+
Dir.chdir(@projectDir) do
|
|
14
|
+
compiler = @tcs[:COMPILER][:CPP]
|
|
15
|
+
calcSources
|
|
16
|
+
|
|
17
|
+
noFilesToLint = (@source_files.length == 0)
|
|
18
|
+
|
|
19
|
+
if Bake.options.lint_min >= 1 and Bake.options.lint_min >= @source_files.length
|
|
20
|
+
noFilesToLint = true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if Bake.options.lint_max >= 0 and Bake.options.lint_max < Bake.options.lint_min
|
|
24
|
+
noFilesToLint = true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if noFilesToLint
|
|
28
|
+
Bake.formatter.printInfo("No files to lint", @config)
|
|
29
|
+
else
|
|
30
|
+
@source_files = @source_files[Bake.options.lint_min..Bake.options.lint_max]
|
|
31
|
+
|
|
32
|
+
cmd = [compiler[:COMMAND]]
|
|
33
|
+
cmd += compiler[:COMPILE_FLAGS]
|
|
34
|
+
|
|
35
|
+
cmd += @include_array[:CPP]
|
|
36
|
+
cmd += @define_array[:CPP]
|
|
37
|
+
|
|
38
|
+
cmd += @tcs[:LINT_POLICY]
|
|
39
|
+
|
|
40
|
+
cmd += @source_files
|
|
41
|
+
|
|
42
|
+
printCmd(cmd, "Linting #{@source_files.length} file(s)...", nil, false)
|
|
43
|
+
success, consoleOutput = ProcessHelper.run(cmd, false)
|
|
44
|
+
process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "Linting...", nil, success)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
return success
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def clean
|
|
51
|
+
return true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/blocks/makefile.rb
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
require 'blocks/has_execute_command'
|
|
2
|
-
|
|
3
|
-
module Bake
|
|
4
|
-
module Blocks
|
|
5
|
-
|
|
6
|
-
class Makefile
|
|
7
|
-
include HasExecuteCommand
|
|
8
|
-
|
|
9
|
-
MAKE_COMMAND = "make"
|
|
10
|
-
MAKE_FILE_FLAG = "-f"
|
|
11
|
-
MAKE_DIR_FLAG = "-C"
|
|
12
|
-
MAKE_CLEAN = "clean"
|
|
13
|
-
|
|
14
|
-
def initialize(config, referencedConfigs, block)
|
|
15
|
-
@config = config
|
|
16
|
-
@projectDir = config.get_project_dir
|
|
17
|
-
@path_to = ""
|
|
18
|
-
@flags = adjustFlags("",config.flags) if config.flags
|
|
19
|
-
@makefile = config.name
|
|
20
|
-
@target = config.target != "" ? config.target : "all"
|
|
21
|
-
calcPathTo(referencedConfigs)
|
|
22
|
-
calcCommandLine
|
|
23
|
-
calcCleanLine
|
|
24
|
-
|
|
25
|
-
block.lib_elements << LibElement.new(LibElement::LIB_WITH_PATH, config.lib) if config.lib != ""
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def calcCommandLine
|
|
29
|
-
@commandLine = remove_empty_strings_and_join([
|
|
30
|
-
MAKE_COMMAND, @target,
|
|
31
|
-
@flags,
|
|
32
|
-
MAKE_DIR_FLAG, File.dirname(@makefile),
|
|
33
|
-
MAKE_FILE_FLAG, File.basename(@makefile),
|
|
34
|
-
@path_to])
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def calcCleanLine
|
|
38
|
-
@cleanLine = remove_empty_strings_and_join([
|
|
39
|
-
MAKE_COMMAND, MAKE_CLEAN,
|
|
40
|
-
@flags,
|
|
41
|
-
MAKE_DIR_FLAG, File.dirname(@makefile),
|
|
42
|
-
MAKE_FILE_FLAG, File.basename(@makefile),
|
|
43
|
-
@path_to])
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def calcPathTo(referencedConfigs)
|
|
47
|
-
@path_to = ""
|
|
48
|
-
if @config.pathTo != ""
|
|
49
|
-
pathHash = {}
|
|
50
|
-
@config.pathTo.split(",").each do |p|
|
|
51
|
-
nameOfP = p.strip
|
|
52
|
-
dirOfP = nil
|
|
53
|
-
if referencedConfigs.include?nameOfP
|
|
54
|
-
dirOfP = referencedConfigs[nameOfP].first.get_project_dir
|
|
55
|
-
else
|
|
56
|
-
Bake.options.roots.each do |r|
|
|
57
|
-
absIncDir = r+"/"+nameOfP
|
|
58
|
-
if File.exists?(absIncDir)
|
|
59
|
-
dirOfP = absIncDir
|
|
60
|
-
break
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
if dirOfP == nil
|
|
65
|
-
Bake.formatter.printError("Project '#{nameOfP}' not found", @config)
|
|
66
|
-
ExitHelper.exit(1)
|
|
67
|
-
end
|
|
68
|
-
pathHash[nameOfP] = File.rel_from_to_project(File.dirname(@projectDir),File.dirname(dirOfP))
|
|
69
|
-
end
|
|
70
|
-
path_to_array = []
|
|
71
|
-
pathHash.each { |k,v| path_to_array << "PATH_TO_#{k}=#{v}" }
|
|
72
|
-
@path_to = path_to_array.join(" ")
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def execute
|
|
78
|
-
return true if Bake.options.linkOnly
|
|
79
|
-
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def startupStep
|
|
83
|
-
return true if Bake.options.linkOnly
|
|
84
|
-
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def exitStep
|
|
88
|
-
return true if Bake.options.linkOnly
|
|
89
|
-
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def clean
|
|
93
|
-
return true if Bake.options.linkOnly
|
|
94
|
-
return executeCommand(@cleanLine, "No rule to make target 'clean'.", @config.validExitCodes) unless Bake.options.filename
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
end
|
|
100
|
-
end
|
|
1
|
+
require 'blocks/has_execute_command'
|
|
2
|
+
|
|
3
|
+
module Bake
|
|
4
|
+
module Blocks
|
|
5
|
+
|
|
6
|
+
class Makefile
|
|
7
|
+
include HasExecuteCommand
|
|
8
|
+
|
|
9
|
+
MAKE_COMMAND = "make"
|
|
10
|
+
MAKE_FILE_FLAG = "-f"
|
|
11
|
+
MAKE_DIR_FLAG = "-C"
|
|
12
|
+
MAKE_CLEAN = "clean"
|
|
13
|
+
|
|
14
|
+
def initialize(config, referencedConfigs, block)
|
|
15
|
+
@config = config
|
|
16
|
+
@projectDir = config.get_project_dir
|
|
17
|
+
@path_to = ""
|
|
18
|
+
@flags = adjustFlags("",config.flags) if config.flags
|
|
19
|
+
@makefile = config.name
|
|
20
|
+
@target = config.target != "" ? config.target : "all"
|
|
21
|
+
calcPathTo(referencedConfigs)
|
|
22
|
+
calcCommandLine
|
|
23
|
+
calcCleanLine
|
|
24
|
+
|
|
25
|
+
block.lib_elements << LibElement.new(LibElement::LIB_WITH_PATH, config.lib) if config.lib != ""
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def calcCommandLine
|
|
29
|
+
@commandLine = remove_empty_strings_and_join([
|
|
30
|
+
MAKE_COMMAND, @target,
|
|
31
|
+
@flags,
|
|
32
|
+
MAKE_DIR_FLAG, File.dirname(@makefile),
|
|
33
|
+
MAKE_FILE_FLAG, File.basename(@makefile),
|
|
34
|
+
@path_to])
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def calcCleanLine
|
|
38
|
+
@cleanLine = remove_empty_strings_and_join([
|
|
39
|
+
MAKE_COMMAND, MAKE_CLEAN,
|
|
40
|
+
@flags,
|
|
41
|
+
MAKE_DIR_FLAG, File.dirname(@makefile),
|
|
42
|
+
MAKE_FILE_FLAG, File.basename(@makefile),
|
|
43
|
+
@path_to])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def calcPathTo(referencedConfigs)
|
|
47
|
+
@path_to = ""
|
|
48
|
+
if @config.pathTo != ""
|
|
49
|
+
pathHash = {}
|
|
50
|
+
@config.pathTo.split(",").each do |p|
|
|
51
|
+
nameOfP = p.strip
|
|
52
|
+
dirOfP = nil
|
|
53
|
+
if referencedConfigs.include?nameOfP
|
|
54
|
+
dirOfP = referencedConfigs[nameOfP].first.get_project_dir
|
|
55
|
+
else
|
|
56
|
+
Bake.options.roots.each do |r|
|
|
57
|
+
absIncDir = r+"/"+nameOfP
|
|
58
|
+
if File.exists?(absIncDir)
|
|
59
|
+
dirOfP = absIncDir
|
|
60
|
+
break
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
if dirOfP == nil
|
|
65
|
+
Bake.formatter.printError("Project '#{nameOfP}' not found", @config)
|
|
66
|
+
ExitHelper.exit(1)
|
|
67
|
+
end
|
|
68
|
+
pathHash[nameOfP] = File.rel_from_to_project(File.dirname(@projectDir),File.dirname(dirOfP))
|
|
69
|
+
end
|
|
70
|
+
path_to_array = []
|
|
71
|
+
pathHash.each { |k,v| path_to_array << "PATH_TO_#{k}=#{v}" }
|
|
72
|
+
@path_to = path_to_array.join(" ")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def execute
|
|
78
|
+
return true if Bake.options.linkOnly
|
|
79
|
+
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def startupStep
|
|
83
|
+
return true if Bake.options.linkOnly
|
|
84
|
+
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def exitStep
|
|
88
|
+
return true if Bake.options.linkOnly
|
|
89
|
+
return executeCommand(@commandLine, nil, @config.validExitCodes)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def clean
|
|
93
|
+
return true if Bake.options.linkOnly
|
|
94
|
+
return executeCommand(@cleanLine, "No rule to make target 'clean'.", @config.validExitCodes) unless Bake.options.filename
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
end
|