From 3f27cb14b28d87ea9319fe0c8133bf7b72596dfc Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 28 Feb 2013 17:59:15 +0000 Subject: [PATCH] Make BoostBook errors lazy to avoid causing an error when BoostBook isn't used. [SVN r83204] --- src/tools/boostbook.jam | 45 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/tools/boostbook.jam b/src/tools/boostbook.jam index ead3d370b..de83dec64 100644 --- a/src/tools/boostbook.jam +++ b/src/tools/boostbook.jam @@ -150,6 +150,11 @@ local rule lock-config ( ) if ! $(.config-locked) { .config-locked = true ; + + if $(.error-message) + { + print-error $(.error-message) ; + } } } @@ -164,6 +169,18 @@ local rule modify-config ( ) } } +rule print-error ( location message * ) +{ + ECHO error: at $(location) ; + ECHO error: $(message) ; + EXIT ; +} + +rule make-error ( message * ) +{ + return [ errors.nearest-user-location ] $(message) ; +} + rule find-boost-in-registry ( keys * ) { @@ -188,8 +205,8 @@ rule check-docbook-xsl-dir ( ) if ! [ path.glob $(.docbook-xsl-dir) : common/common.xsl ] { import errors ; - errors.user-error BoostBook: could not find docbook XSL stylesheets - in: [ path.native $(.docbook-xsl-dir) ] ; + .error-message = [ make-error BoostBook: could not find docbook XSL stylesheets + in: [ path.native $(.docbook-xsl-dir) ] ] ; } else if $(.debug-configuration) { @@ -207,8 +224,8 @@ rule check-docbook-dtd-dir ( ) if ! [ path.glob $(.docbook-dtd-dir) : docbookx.dtd ] { import errors ; - errors.user-error BoostBook: could not find docbook DTD in: [ - path.native $(.docbook-dtd-dir) ] ; + .error-message = [ make-error BoostBook: could not find docbook DTD in: [ + path.native $(.docbook-dtd-dir) ] ] ; } else if $(.debug-configuration) { @@ -223,14 +240,12 @@ rule check-boostbook-xsl-dir ( ) { if ! $(.boostbook-xsl-dir) { - import errors ; - errors.user-error BoostBook: could not find boostbook XSL stylesheets. ; + .error-message = [ make-error BoostBook: could not find boostbook XSL stylesheets. ] ; } else if ! [ path.glob $(.boostbook-xsl-dir) : docbook.xsl ] { - import errors ; - errors.user-error BoostBook: could not find docbook XSL stylesheets in: - [ path.native $(.boostbook-xsl-dir) ] ; + .error-message = [ make-error BoostBook: could not find docbook XSL stylesheets in: + [ path.native $(.boostbook-xsl-dir) ] ] ; } else if $(.debug-configuration) { @@ -244,14 +259,12 @@ rule check-boostbook-dtd-dir ( ) { if ! $(.boostbook-dtd-dir) { - import errors ; - errors.user-error BoostBook: could not find boostbook DTD. ; + .error-message = [ make-error BoostBook: could not find boostbook DTD. ] ; } else if ! [ path.glob $(.boostbook-dtd-dir) : boostbook.dtd ] { - import errors ; - errors.user-error BoostBook: could not find boostbook DTD in: [ - path.native $(.boostbook-dtd-dir) ] ; + .error-message = [ make-error BoostBook: could not find boostbook DTD in: [ + path.native $(.boostbook-dtd-dir) ] ] ; } else if $(.debug-configuration) { @@ -266,8 +279,8 @@ rule check-boostbook-dir ( boostbook-dir ? ) if $(boostbook-dir) && ! [ path.glob $(boostbook-dir) : xsl ] { import errors ; - errors.user-error BoostBook: could not find boostbook in: [ path.native - $(boostbook-dir) ] ; + .error-message = [ make-error BoostBook: could not find boostbook in: [ path.native + $(boostbook-dir) ] ] ; } }