Lines Matching +full:post +full:- +full:require +full:- +full:hook
11 import build-request ;
15 import config-cache ;
25 import property-set ;
32 import virtual-target ;
41 # Shortcut used in this module for accessing used command-line parameters.
46 .debug-config = [ MATCH ^(--debug-configuration)$ : $(.argv) ] ;
49 # line. When running 'bjam --clean main_target' we want to clean only files
52 .results-of-main-targets = ;
55 .out-xml = [ MATCH ^--out-xml=(.*)$ : $(.argv) ] ;
61 # while not strictly necessary, has been added to allow testing Boost-Build's
63 .default-toolset = ;
64 .default-toolset-version = ;
76 rule command-line-free-features ( )
78 return $(.command-line-free-features) ;
89 local r = [ modules.binding build-system ] ;
99 rule set-default-toolset ( toolset : version ? )
101 .default-toolset = $(toolset) ;
102 .default-toolset-version = $(version) ;
105 rule add-pre-build-hook ( function )
107 .pre-build-hook += [ indirect.make $(function) : [ CALLER_MODULE ] ] ;
110 rule add-post-build-hook ( function )
112 .post-build-hook += [ indirect.make $(function) : [ CALLER_MODULE ] ] ;
116 IMPORT build-system : add-pre-build-hook : build-system : set-pre-build-hook ;
117 IMPORT build-system : add-post-build-hook : build-system : set-post-build-hook ;
118 EXPORT build-system : set-pre-build-hook set-post-build-hook ;
128 local rule actual-clean-targets ( )
130 # The cleaning is tricky. Say, if user says 'bjam --clean foo' where 'foo'
137 if [ class.is-a $(t) : project-target ]
139 local project = [ $(t).project-module ] ;
140 .should-clean-project.$(project) = true ;
146 local targets-to-clean ;
147 for local t in $(.results-of-main-targets)
150 targets-to-clean += [ virtual-target.traverse $(t) ] ;
152 targets-to-clean = [ sequence.unique $(targets-to-clean) ] ;
154 local to-clean ;
155 for local t in [ virtual-target.all-targets ]
160 if [ $(t).action ] && ( $(t) in $(targets-to-clean) ||
161 [ should-clean-project [ $(p).project-module ] ] )
163 to-clean += $(t) ;
167 local to-clean-actual ;
168 for local t in $(to-clean)
170 to-clean-actual += [ $(t).actualize ] ;
172 return $(to-clean-actual) ;
178 # code in project-target.find but we can not reuse that code without a
179 # project-targets instance.
181 local rule find-target ( target-id )
183 local split = [ MATCH (.*)//(.*) : $(target-id) ] ;
192 pm = [ project.find $(target-id) : "." ] ;
212 local rule initialize-config-module ( module-name : location ? )
214 project.initialize $(module-name) : $(location) ;
217 USER_MODULE $(module-name) ;
223 # file with the given 'filename' at 'path' into module with name 'module-name'.
225 # on the must-find parameter. Returns a normalized path to the loaded
228 local rule load-config ( module-name : filename : path + : must-find ? )
230 if $(.debug-config)
232 local path-string = $(path) ;
233 if $(path-string) = "" { path-string = . ; }
234 ECHO "notice:" Searching '$(path-string)' for $(module-name)
241 if $(.debug-config)
243 local where-string = $(where:D) ;
244 if $(where-string) = "" { where-string = . ; }
245 where-string = '$(where-string)' ;
246 ECHO "notice:" Loading $(module-name) configuration file '$(filename)'
247 from $(where-string:J=" "). ;
250 # Set source location so that path-constant in config files with
252 # project-config.jam, but may be used in other config files as well.
253 local attributes = [ project.attributes $(module-name) ] ;
254 $(attributes).set source-location : $(where:D) : exact ;
255 modules.load $(module-name) : $(filename) : $(path) ;
256 project.load-used-projects $(module-name) ;
258 else if $(must-find) || $(.debug-config)
260 local path-string = $(path) ;
261 if $(path-string) = "" { path-string = . ; }
262 path-string = '$(path-string)' ;
263 path-string = $(path-string:J=" ") ;
264 if $(must-find)
267 errors.user-error Configuration file '$(filename)' not found "in"
268 $(path-string). ;
271 $(path-string). ;
276 # Parses options of the form --xxx-config=path/to/config.jam
279 # explicitly set to the empty string, in which case, handle-config-option
282 local rule handle-config-option ( name : env ? )
284 local result = [ MATCH ^--$(name)=(.*)$ : $(.argv) ] ;
285 if ! $(result)-is-defined && $(env)
291 result = [ utility.unquote $(result[-1]) ] ;
297 # references and, if non-absolute, root them at the current
308 # -- test-config --
309 # Loaded only if specified on the command-line using the --test-config
310 # command-line parameter. It is ok for this file not to exist even if specified.
315 # -- all-config --
316 # Loaded only if specified on the command-line using the --config command
321 # -- site-config --
322 # Named site-config.jam by default or may be named explicitly using the
323 # --site-config command-line option. If named explicitly, the file is found
326 # /etc (non-Windows), user's home folder or the Boost Build path, in that
327 # order. Not loaded in case the test-config configuration file is loaded,
328 # the file is explicitly set to the empty string or the --ignore-site-config
329 # command-line option is specified.
331 # -- user-config --
332 # Named user-config.jam by default or may be named explicitly using the
333 # --user-config command-line option or the BOOST_BUILD_USER_CONFIG environment
337 # case either the test-config configuration file is loaded or an empty file name
341 # -- project-config --
342 # Named project-config.jam. Looked up in the current working folder and
344 # named explicitly using the --project-config command-line option. If a file
346 # directory and must exist. If an empty file name is passed, project-config
352 local rule load-configuration-files
355 local ignore-site-config =
356 [ MATCH ^(--ignore-site-config)$ : $(.argv) ] ;
357 local ignore-user-config ;
358 local ignore-project-config ;
360 initialize-config-module test-config ;
361 local test-config = [ handle-config-option test-config ] ;
362 if $(test-config)
364 local where = [ load-config test-config : $(test-config:BS) :
365 $(test-config:D) ] ;
368 if $(.debug-config)
374 ignore-site-config = true ;
375 ignore-user-config = true ;
379 initialize-config-module all-config ;
380 local all-config = [ handle-config-option config ] ;
381 if $(all-config)
383 load-config all-config : $(all-config:D=) : $(all-config:D) : required ;
384 if $(.debug-config)
390 if $(all-config)-is-defined
392 if $(.debug-config) && ! $(all-config)
396 ignore-site-config = true ;
397 ignore-user-config = true ;
398 ignore-project-config = true ;
401 local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ;
402 local site-path = /etc $(user-path) ;
405 site-path = [ modules.peek : SystemRoot ] $(user-path) ;
408 if $(.debug-config) && $(ignore-site-config) = --ignore-site-config
411 ECHO "notice: --ignore-site-config command-line option." ;
414 initialize-config-module site-config ;
415 if ! $(ignore-site-config)
417 local site-config = [ handle-config-option site-config ] ;
418 if $(site-config)
420 load-config site-config : $(site-config:D=) : $(site-config:D)
421 : must-exist ;
423 else if ! $(site-config)-is-defined
425 load-config site-config : site-config.jam : $(site-path) ;
427 else if $(.debug-config)
433 initialize-config-module user-config ;
434 if ! $(ignore-user-config)
436 local user-config =
437 [ handle-config-option user-config : BOOST_BUILD_USER_CONFIG ] ;
439 if $(user-config)
441 if $(.debug-config)
445 ECHO " $(user-config)" ;
448 load-config user-config : $(user-config:D=) : $(user-config:D)
449 : must-exist ;
451 else if ! $(user-config)-is-defined
453 load-config user-config : user-config.jam : $(user-path) ;
455 else if $(.debug-config)
461 # We look for project-config.jam from "." upward. I am not sure this is 100%
464 # - We need to load project-config.jam before Jamroot
465 # - We probably need to load project-config.jam even if there is no Jamroot
466 # - e.g. to implement automake-style out-of-tree builds.
467 if ! $(ignore-project-config)
469 local project-config = [ handle-config-option project-config ] ;
470 if $(project-config)
472 initialize-config-module project-config : $(project-config:D=) ;
473 load-config project-config : $(project-config:D=)
474 : $(project-config:D) : must-exist ;
476 else if ! $(project-config)-is-defined
478 local file = [ path.glob "." : project-config.jam ] ;
481 file = [ path.glob-in-parents "." : project-config.jam ] ;
485 initialize-config-module project-config : $(file:D) ;
486 load-config project-config : project-config.jam : $(file:D) ;
489 else if $(.debug-config)
496 project.end-load ;
500 # Autoconfigure toolsets based on any instances of --toolset=xx,yy,...zz or
504 local rule process-explicit-toolset-requests
506 local extra-properties ;
508 local option-toolsets = [ regex.split-list [ MATCH ^--toolset=(.*)$ : $(.argv) ] : "," ] ;
509 local feature-toolsets = [ regex.split-list [ MATCH ^toolset=(.*)$ : $(.argv) ] : "," ] ;
511 for local t in $(option-toolsets) $(feature-toolsets)
513 # Parse toolset-version/properties.
515 local properties = [ feature.expand-subfeatures <toolset>$(toolset) : true ] ;
516 local toolset-property = [ property.select <toolset> : $(properties) ] ;
518 if $(toolset-property:G=) in [ feature.values <toolset> ]
530 # specified but that would require that toolsets correctly handle the
536 if $(.debug-config)
538 ECHO "notice: [cmdline-cfg] toolset $(toolset) not"
539 "previously configured; attempting to auto-configure now" ;
541 local t,v = [ MATCH "([^-]+)-?(.+)?" : $(toolset) ] ;
542 project.push-current ;
544 project.pop-current ;
548 # case toolset has been specified using the "--toolset=..." command-line
550 if ! $(t) in $(.argv) $(feature-toolsets)
552 if $(.debug-config)
554 ECHO "notice:" "[cmdline-cfg]" adding toolset=$(t) to the build
557 extra-properties += toolset=$(t) ;
561 return $(extra-properties) ;
571 local rule should-clean-project ( project )
573 if ! $(.should-clean-project.$(project))-is-defined
576 if ! [ project.is-jamroot-module $(project) ]
578 local parent = [ project.attribute $(project) parent-module ] ;
581 r = [ should-clean-project $(parent) ] ;
584 .should-clean-project.$(project) = $(r) ;
587 return $(.should-clean-project.$(project)) ;
594 # ------
599 if --version in $(.argv)
605 version.verify-engine-version ;
607 load-configuration-files ;
610 local extra-properties = [ process-explicit-toolset-requests ] ;
613 # in the current folder so 'use-project' directives have any chance of being
616 local current-project ;
618 local current-module = [ project.find "." : "." ] ;
619 if $(current-module)
621 current-project = [ project.target $(current-module) ] ;
628 local default-toolset = $(.default-toolset) ;
629 local default-toolset-version = ;
630 if $(default-toolset)
632 default-toolset-version = $(.default-toolset-version) ;
636 default-toolset = gcc ;
639 default-toolset = msvc ;
643 default-toolset = vmsdecc ;
647 default-toolset = darwin ;
652 ECHO "warning: Configuring default toolset" \"$(default-toolset)\". ;
656 ECHO "warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html" ;
658 toolset.using $(default-toolset) : $(default-toolset-version) ;
669 local build-request = [ build-request.from-command-line $(.argv)
670 $(extra-properties) ] ;
671 local target-ids = [ $(build-request).get-at 1 ] ;
672 local properties = [ $(build-request).get-at 2 ] ;
676 if ! $(current-project) && ! $(target-ids)
679 errors.user-error no Jamfile "in" current directory found, and no target
688 local clean ; if "--clean" in $(.argv) { clean = true ; }
689 local cleanall ; if "--clean-all" in $(.argv) { cleanall = true ; }
699 local explicitly-requested-files
702 # List of Boost Build meta-targets, virtual-targets and actual Jam targets
705 local virtual-targets ;
706 local actual-targets ;
709 # Process each target specified on the command-line and convert it into
713 for local id in $(target-ids)
722 if $(current-project)
724 t = [ $(current-project).find $(id) : no-error ] ;
728 t = [ find-target $(id) ] ;
735 explicitly-requested-files += $(id) ;
745 targets += [ project.target [ project.module-name "." ] ] ;
748 if [ option.get dump-generators : : true ]
756 local first-project = [ $(targets[0]).project ] ;
757 local first-project-root-location = [ $(first-project).get project-root ] ;
758 local first-project-root-module = [ project.load
759 $(first-project-root-location) ] ;
760 local first-project-root = [ project.target $(first-project-root-module) ] ;
761 local first-build-build-dir = [ $(first-project-root).build-dir ] ;
762 configure.set-log-file $(first-build-build-dir)/config.log ;
763 config-cache.load $(first-build-build-dir)/project-cache.jam ;
774 expanded += [ build-request.convert-command-line-elements $(properties) ] ;
775 expanded = [ build-request.expand-no-defaults $(expanded) ] ;
779 xexpanded += [ property-set.create [ feature.split $(e) ] ] ;
785 expanded = [ property-set.empty ] ;
794 .command-line-free-features = [ property-set.create [ $(p).free ] ] ;
798 if ! [ class.is-a $(t) : project-target ]
800 .results-of-main-targets += $(g[2-]) ;
802 virtual-targets += $(g[2-]) ;
808 for t in $(virtual-targets)
810 actual-targets += [ $(t).actualize ] ;
813 config-cache.save ;
817 # so we can hook into Jam to collect build data while its building and have
820 if $(.out-xml)
823 rule full-target-name ( target )
827 local project-path = [ $(project).get location ] ;
828 return $(project-path)//$(name) ;
833 rule out-xml ( xml-file : constituents * )
842 local bb-version = [ version.boost-build ] ;
843 .header on $(xml-file) =
844 "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
845 "$(nl)<build format=\"1.0\" version=\"$(bb-version)\">"
846 "$(nl) <os name=\"$(os[1])\" platform=\"$(os[2])\"><![CDATA[$(os[3-]:J= )]]></os>"
851 .footer on $(xml-file) =
855 .contents on $(xml-file) +=
857 for local t in [ virtual-target.all-targets ]
863 local name = [ full-target-name $(t) ] ;
868 dependencies += [ full-target-name $(s) ] ;
872 local jam-target = [ $(t).actual-name ] ;
874 .contents on $(xml-file) +=
881 "$(nl) <jam-target><![CDATA[$(jam-target)]]></jam-target>"
886 .contents on $(xml-file) +=
889 # Build $(xml-file) after $(constituents). Do so even if a
891 INCLUDES $(xml-file) : $(constituents) ;
892 ALWAYS $(xml-file) ;
893 __ACTION_RULE__ on $(xml-file) =
894 build-system.out-xml.generate-action ;
895 out-xml.generate $(xml-file) ;
902 rule out-xml.generate-action ( args * : xml-file
906 [ on $(xml-file) return $(.header) $(.contents) $(.footer) ] ;
907 local f = @($(xml-file):E=$(contents)) ;
911 # out-xml.generate-action.
912 actions quietly out-xml.generate { }
914 # Define the out-xml file target, which depends on all the targets so
916 out-xml $(.out-xml) : $(actual-targets) ;
919 # statistics about each actual target in a variable "on" the --out-xml
922 rule out-xml.collect ( xml-file : target : command status start end user
928 .contents on $(xml-file) +=
935 local action-name = [ $(action).action-name ] ;
936 local action-sources = [ $(action).sources ] ;
937 local action-props = [ $(action).properties ] ;
940 .contents on $(xml-file) +=
941 "$(nl) <name><![CDATA[$(action-name)]]></name>" ;
944 .contents on $(xml-file) +=
946 for local source in $(action-sources)
948 local source-actual = [ $(source).actual-name ] ;
949 .contents on $(xml-file) +=
950 "$(nl) <source><![CDATA[$(source-actual)]]></source>" ;
952 .contents on $(xml-file) +=
957 .contents on $(xml-file) +=
959 for local prop in [ $(action-props).raw ]
961 local prop-name = [ MATCH ^<(.*)>$ : $(prop:G) ] ;
962 .contents on $(xml-file) +=
963 … "$(nl) <property name=\"$(prop-name)\"><![CDATA[$(prop:G=)]]></property>" ;
965 .contents on $(xml-file) +=
971 .contents on $(xml-file) +=
972 "$(nl) <jam-target><![CDATA[$(target)]]></jam-target>"
976 .contents on $(xml-file) +=
984 __ACTION_RULE__ = build-system.out-xml.collect
985 [ modules.peek build-system : .out-xml ] ;
989 build-system :
990 out-xml.collect
991 out-xml.generate-action
993 build-system.out-xml.collect
994 build-system.out-xml.generate-action
1004 local k = [ option.get keep-going : true : true ] ;
1015 EXIT "error: Invalid value for the --keep-going option" ;
1028 if $(explicitly-requested-files)
1034 UPDATE $(explicitly-requested-files:G=e) $(.out-xml) ;
1038 UPDATE clean-all ;
1042 common.Clean clean : [ actual-clean-targets ] ;
1047 configure.print-configure-checks-summary ;
1049 for local function in $(.pre-build-hook)
1054 DEPENDS all : $(actual-targets) ;
1060 # as otherwise if could execute out-of-sequence when
1062 if $(.out-xml)
1064 UPDATE_NOW $(.out-xml) : : ignore-minus-n ;
1066 for local function in $(.post-build-hook)
1076 UPDATE all $(.out-xml) ;