Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68686 - trunk/tools/build/v2/tools
From: steven_at_[hidden]
Date: 2011-02-06 19:36:37


Author: steven_watanabe
Date: 2011-02-06 19:36:36 EST (Sun, 06 Feb 2011)
New Revision: 68686
URL: http://svn.boost.org/trac/boost/changeset/68686

Log:
Allow quickbook configuration to be overridden. Eliminate duplicate warnings when we fall back on searching PATH.
Text files modified:
   trunk/tools/build/v2/tools/quickbook.jam | 143 +++++++++++++++++++++++----------------
   1 files changed, 85 insertions(+), 58 deletions(-)

Modified: trunk/tools/build/v2/tools/quickbook.jam
==============================================================================
--- trunk/tools/build/v2/tools/quickbook.jam (original)
+++ trunk/tools/build/v2/tools/quickbook.jam 2011-02-06 19:36:36 EST (Sun, 06 Feb 2011)
@@ -112,7 +112,10 @@
 import scanner ;
 import project ;
 import targets ;
-
+import build-system ;
+import path ;
+import common ;
+import errors ;
 
 # The one and only QUICKBOOK type!
 type.register QUICKBOOK : qbk ;
@@ -138,51 +141,23 @@
 #
 class quickbook-binary-generator : generator
 {
- import common modules path targets build-system ;
+ import modules path targets quickbook ;
 
     rule run ( project name ? : property-set : sources * : multiple ? )
     {
+ quickbook.freeze-config ;
         # QuickBook invocation command and dependencies.
- local quickbook-binary = [ modules.peek quickbook : .command ] ;
+ local quickbook-binary = [ modules.peek quickbook : .quickbook-binary ] ;
         local quickbook-binary-dependencies ;
 
- if $(quickbook-binary)
+ if ! $(quickbook-binary)
         {
- # Use user-supplied command.
- quickbook-binary = [ common.get-invocation-command quickbook : quickbook : $(quickbook-binary) ] ;
- }
- else
- {
- # Search for QuickBook sources in sensible places, like
- # $(BOOST_ROOT)/tools/quickbook
- # $(BOOST_BUILD_PATH)/../../quickbook
-
- # And build quickbook executable from sources.
-
- local boost-root = [ modules.peek : BOOST_ROOT ] ;
- local boost-build-path = [ build-system.location ] ;
-
- local quickbook-dir ;
-
- if $(boost-root)
- {
- quickbook-dir += [ path.join $(boost-root) tools ] ;
- }
-
- if $(boost-build-path)
- {
- quickbook-dir += $(boost-build-path)/../.. ;
- }
-
- quickbook-dir = [ path.glob $(quickbook-dir) : quickbook ] ;
-
             # If the QuickBook source directory was found, mark its main target
             # as a dependency for the current project. Otherwise, try to find
             # 'quickbook' in user's PATH
+ local quickbook-dir = [ modules.peek quickbook : .quickbook-dir ] ;
             if $(quickbook-dir)
             {
- quickbook-dir = [ path.make $(quickbook-dir[1]) ] ;
-
                 # Get the main-target in QuickBook directory.
                 local quickbook-main-target = [ targets.resolve-reference $(quickbook-dir) : $(project) ] ;
 
@@ -215,28 +190,6 @@
                     }
                 }
             }
- else
- {
- ECHO "QuickBook warning: The path to the quickbook executable was" ;
- ECHO " not provided. Additionally, couldn't find QuickBook" ;
- ECHO " sources searching in" ;
- ECHO " * BOOST_ROOT/tools/quickbook" ;
- ECHO " * BOOST_BUILD_PATH/../../quickbook" ;
- ECHO " Will now try to find a precompiled executable by searching" ;
- ECHO " the PATH for 'quickbook'." ;
- ECHO " To disable this warning in the future, or to completely" ;
- ECHO " avoid compilation of quickbook, you can explicitly set the" ;
- ECHO " path to a quickbook executable command in user-config.jam" ;
- ECHO " or site-config.jam with the call" ;
- ECHO " using quickbook : /path/to/quickbook ;" ;
-
- # As a last resort, search for 'quickbook' command in path. Note
- # that even if the 'quickbook' command is not found,
- # get-invocation-command will still return 'quickbook' and might
- # generate an error while generating the virtual-target.
-
- quickbook-binary = [ common.get-invocation-command quickbook : quickbook ] ;
- }
         }
 
         # Add $(quickbook-binary-dependencies) as a dependency of the current
@@ -284,13 +237,87 @@
         command ? # path to the QuickBook executable.
     )
 {
- if ! $(.initialized)
+ if $(command)
     {
- .initialized = true ;
+ if $(.config-frozen)
+ {
+ errors.user-error "quickbook: configuration cannot be changed after it has been used." ;
+ }
         .command = $(command) ;
     }
 }
 
+rule freeze-config ( )
+{
+ if ! $(.config-frozen)
+ {
+ .config-frozen = true ;
+
+ # QuickBook invocation command and dependencies.
+
+ .quickbook-binary = $(.command) ;
+
+ if $(.quickbook-binary)
+ {
+ # Use user-supplied command.
+ .quickbook-binary = [ common.get-invocation-command quickbook : quickbook : $(.quickbook-binary) ] ;
+ }
+ else
+ {
+ # Search for QuickBook sources in sensible places, like
+ # $(BOOST_ROOT)/tools/quickbook
+ # $(BOOST_BUILD_PATH)/../../quickbook
+
+ # And build quickbook executable from sources.
+
+ local boost-root = [ modules.peek : BOOST_ROOT ] ;
+ local boost-build-path = [ build-system.location ] ;
+
+ if $(boost-root)
+ {
+ .quickbook-dir += [ path.join $(boost-root) tools ] ;
+ }
+
+ if $(boost-build-path)
+ {
+ .quickbook-dir += $(boost-build-path)/../.. ;
+ }
+
+ .quickbook-dir = [ path.glob $(.quickbook-dir) : quickbook ] ;
+
+ # If the QuickBook source directory was found, mark its main target
+ # as a dependency for the current project. Otherwise, try to find
+ # 'quickbook' in user's PATH
+ if $(.quickbook-dir)
+ {
+ .quickbook-dir = [ path.make $(.quickbook-dir[1]) ] ;
+ }
+ else
+ {
+ ECHO "QuickBook warning: The path to the quickbook executable was" ;
+ ECHO " not provided. Additionally, couldn't find QuickBook" ;
+ ECHO " sources searching in" ;
+ ECHO " * BOOST_ROOT/tools/quickbook" ;
+ ECHO " * BOOST_BUILD_PATH/../../quickbook" ;
+ ECHO " Will now try to find a precompiled executable by searching" ;
+ ECHO " the PATH for 'quickbook'." ;
+ ECHO " To disable this warning in the future, or to completely" ;
+ ECHO " avoid compilation of quickbook, you can explicitly set the" ;
+ ECHO " path to a quickbook executable command in user-config.jam" ;
+ ECHO " or site-config.jam with the call" ;
+ ECHO " using quickbook : /path/to/quickbook ;" ;
+
+ # As a last resort, search for 'quickbook' command in path. Note
+ # that even if the 'quickbook' command is not found,
+ # get-invocation-command will still return 'quickbook' and might
+ # generate an error while generating the virtual-target.
+
+ .quickbook-binary = [ common.get-invocation-command quickbook : quickbook ] ;
+ }
+ }
+ }
+}
+
 
 generators.register [ new quickbook-binary-generator quickbook.quickbook-to-boostbook : QUICKBOOK : XML ] ;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk