update ceedling to 0.29.0

This commit is contained in:
hathach
2019-11-01 17:48:59 +07:00
parent 774a9f63ab
commit b25faa97c2
59 changed files with 1962 additions and 736 deletions

View File

@@ -15,7 +15,6 @@ Define any of these sections in :tools: to provide additional hooks to be called
:pre_link_execute
:post_link_execute
:pre_test_fixture_execute
:pre_test_fixture_execute
:pre_test
:post_test
:pre_release
@@ -24,13 +23,13 @@ Define any of these sections in :tools: to provide additional hooks to be called
:post_build
```
Each of these tools can support an :executable string and an :args list, like so:
Each of these tools can support an :executable string and an :arguments list, like so:
```
:tools:
:post_link_execute:
:executable: objcopy.exe
:args:
:arguments:
- ${1} #This is replaced with the executable name
- output.srec
- --strip-all
@@ -42,11 +41,13 @@ You may also specify an array of executables to be called in a particular place,
:tools:
:post_test:
- :executable: echo
:args: "${1} was glorious!"
:arguments: "${1} was glorious!"
- :executable: echo
:args:
:arguments:
- it kinda made me cry a little.
- you?
```
Please note that it varies which arguments are being parsed down to the
hooks. For now see `command_hooks.rb` to figure out which suits you best.
Happy Tweaking!

View File

@@ -1,6 +1,5 @@
require 'ceedling/plugin'
require 'ceedling/constants'
class CommandHooks < Plugin
attr_reader :config
@@ -23,7 +22,6 @@ class CommandHooks < Plugin
:post_release => ((defined? TOOLS_POST_RELEASE) ? TOOLS_POST_RELEASE : nil ),
:pre_build => ((defined? TOOLS_PRE_BUILD) ? TOOLS_PRE_BUILD : nil ),
:post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ),
:post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ),
:post_error => ((defined? TOOLS_POST_ERROR) ? TOOLS_POST_ERROR : nil ),
}
@plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
@@ -49,14 +47,33 @@ class CommandHooks < Plugin
private
##
# Run a hook if its available.
#
# :args:
# - hook: Name of the hook to run
# - name: Name of file (default: "")
#
# :return:
# shell_result.
#
def run_hook_step(hook, name="")
if (hook[:executable])
args = ( (hook[:args].is_a? Array) ? hook[:args] : [] )
cmd = @ceedling[:tool_executor].build_command_line( hook, args, name )
shell_result = @ceedling[:tool_executor].exec( cmd[:line], cmd[:options] )
# Handle argument replacemant ({$1}), and get commandline
cmd = @ceedling[:tool_executor].build_command_line( hook, [], name )
shell_result = @ceedling[:tool_executor].exec(cmd[:line], cmd[:options])
end
end
##
# Run a hook if its available.
#
# If __which_hook__ is an array, run each of them sequentially.
#
# :args:
# - which_hook: Name of the hook to run
# - name: Name of file
#
def run_hook(which_hook, name="")
if (@config[which_hook])
@ceedling[:streaminator].stdout_puts("Running Hook #{which_hook}...", Verbosity::NORMAL)