Skip to content

Commit

Permalink
Merge pull request #246 from matthewrmshin/fcm-make-description
Browse files Browse the repository at this point in the history
fcm make: add `description` setting
  • Loading branch information
scwhitehouse committed Sep 26, 2017
2 parents a783c8a + b3b7a1b commit 6c0ce1a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
14 changes: 14 additions & 0 deletions doc/user_guide/annex_cfg.html
Expand Up @@ -508,6 +508,20 @@ <h2 id="make">FCM Make Configuration</h2>
"make.html">FCM Make</a>.</p>

<dl>
<dt id="make.description">description</dt>

<dd>
<p><dfn>description</dfn>: Specifies a description string for the current
make.</p>

<p><dfn>value</dfn>: A string.</p>

<p><dfn>example</dfn>:</p>
<pre>
description = Release 2.71.82
</pre>
</dd>

<dt id="make.dest">dest</dt>

<dd>
Expand Down
5 changes: 5 additions & 0 deletions lib/FCM/Context/Make.pm
Expand Up @@ -32,6 +32,7 @@ use constant {

__PACKAGE__->class({
ctx_of => '%',
description => '$',
dest => '$',
dest_lock => '$',
error => {},
Expand Down Expand Up @@ -74,6 +75,10 @@ attributes:
A HASH containing the (keys) IDs and the (values) context objects of the make.
=item description
A description string for this make.
=item dest
The destination of this make.
Expand Down
16 changes: 12 additions & 4 deletions lib/FCM/System/Make/Share/Config.pm
Expand Up @@ -37,6 +37,7 @@ my $E = 'FCM::System::Exception';

# Configuration parser label to action map
my %CONFIG_PARSER_OF = (
'description' => \&_parse_description,
'dest' => \&_parse_dest,
'name' => \&_parse_name,
'require-version' => \&_parse_require_version,
Expand Down Expand Up @@ -207,6 +208,12 @@ sub _get_config_reader {
);
}

# Reads the "description" declaration from a config entry.
sub _parse_description {
my ($attrib_ref, $m_ctx, $entry) = @_;
$m_ctx->set_description($entry->get_value());
}

# Reads the "dest" declaration from a config entry.
sub _parse_dest {
my ($attrib_ref, $m_ctx, $entry) = @_;
Expand Down Expand Up @@ -324,10 +331,11 @@ sub _unparse {
: ()
;
}
( [sub {$m_ctx->get_name()}, 'name' ],
[\&_unparse_use , 'use' ],
[\&_unparse_steps , 'steps'],
[sub {$m_ctx->get_dest()}, 'dest' ],
( [sub {$m_ctx->get_name()} , 'name' ],
[\&_unparse_use , 'use' ],
[\&_unparse_steps , 'steps' ],
[sub {$m_ctx->get_dest()} , 'dest' ],
[sub {$m_ctx->get_description()}, 'description' ],
),
),
( map { my $id = $_;
Expand Down
4 changes: 4 additions & 0 deletions lib/FCM/Util/Event.pm
Expand Up @@ -321,6 +321,7 @@ our %S = (
. ' total-time=%.1fs',
make_build_targets_fail_0 => '! %-20s: depends on failed target: %s',
make_build_targets_fail_1 => '! %-20s: update task failed',
make_description => 'description=%s',
make_dest => 'dest=%s',
make_dest_use => 'use=%s',
make_extract_project_tree => 'location %5s:%2d: %s%s',
Expand Down Expand Up @@ -891,6 +892,9 @@ sub _event_make_build_shell_out {
# Notification when a make destination is being set up.
sub _event_make_dest {
my ($m_ctx, $authority) = @_;
if ($m_ctx->get_description()) {
$R->report(sprintf($S{make_description}, $m_ctx->get_description()));
}
$R->report(sprintf($S{make_dest}, $authority . ':' . $m_ctx->get_dest()));
$R->report(sprintf(
$S{make_mode},
Expand Down
1 change: 1 addition & 0 deletions t/fcm-make/00-build-basic/fcm-make.cfg
@@ -1,3 +1,4 @@
description = There is nothing like a good test
steps = build
build.source = $HERE/src
build.target{task} = link
Expand Down
8 changes: 5 additions & 3 deletions t/fcm-make/10-log.t
Expand Up @@ -21,7 +21,7 @@
#-------------------------------------------------------------------------------
. $(dirname $0)/test_header
#-------------------------------------------------------------------------------
tests 11
tests 12
cp -r $TEST_SOURCE_DIR/$TEST_KEY_BASE/* .
#-------------------------------------------------------------------------------
TEST_KEY="$TEST_KEY_BASE"
Expand All @@ -33,8 +33,10 @@ else
$FCM_HOME/doc/etc/fcm-version.js)
VERSION="FCM $VERSION"
fi
file_grep "$TEST_KEY.log.version" "\\[info\\] $VERSION" .fcm-make/log
file_grep "$TEST_KEY.log.mode" '\[info\] mode=new' .fcm-make/log
file_grep "${TEST_KEY}.log.version" "\\[info\\] ${VERSION}" '.fcm-make/log'
file_grep "${TEST_KEY}.log.mode" '\[info\] mode=new' '.fcm-make/log'
file_grep "${TEST_KEY}.log.description" \
'\[info\] description=There is nothing like a good test' '.fcm-make/log'
if [[ $(ls .fcm-make/log-* | wc -l) == 1 ]]; then
pass "$TEST_KEY-n-logs"
else
Expand Down

0 comments on commit 6c0ce1a

Please sign in to comment.