|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64880 - trunk/tools/build/v2/build
From: ghost_at_[hidden]
Date: 2010-08-18 03:38:44
Author: vladimir_prus
Date: 2010-08-18 03:38:43 EDT (Wed, 18 Aug 2010)
New Revision: 64880
URL: http://svn.boost.org/trac/boost/changeset/64880
Log:
Fix default build and other things.
Text files modified:
trunk/tools/build/v2/build/alias.py | 6 ++----
trunk/tools/build/v2/build/project.py | 4 ++--
trunk/tools/build/v2/build/targets.py | 32 +++++++++++++++++++++++++-------
trunk/tools/build/v2/build/virtual_target.py | 2 +-
4 files changed, 30 insertions(+), 14 deletions(-)
Modified: trunk/tools/build/v2/build/alias.py
==============================================================================
--- trunk/tools/build/v2/build/alias.py (original)
+++ trunk/tools/build/v2/build/alias.py 2010-08-18 03:38:43 EDT (Wed, 18 Aug 2010)
@@ -46,13 +46,11 @@
return base.add(subvariant.sources_usage_requirements())
@metatarget
-def alias(name, sources, requirements=None, default_build=None, usage_requirements=None):
+def alias(name, sources=[], requirements=[], default_build=[], usage_requirements=[]):
+
project = get_manager().projects().current()
targets = get_manager().targets()
- if default_build:
- default_build = default_build[0]
-
targets.main_target_alternative(AliasTarget(
name, project,
targets.main_target_sources(sources, name, no_renaming=True),
Modified: trunk/tools/build/v2/build/project.py
==============================================================================
--- trunk/tools/build/v2/build/project.py (original)
+++ trunk/tools/build/v2/build/project.py 2010-08-18 03:38:43 EDT (Wed, 18 Aug 2010)
@@ -421,7 +421,7 @@
attributes.set("requirements", property_set.empty(), exact=True)
attributes.set("usage-requirements", property_set.empty(), exact=True)
- attributes.set("default-build", [], exact=True)
+ attributes.set("default-build", property_set.empty(), exact=True)
attributes.set("projects-to-build", [], exact=True)
attributes.set("project-root", None, exact=True)
attributes.set("build-dir", None, exact=True)
@@ -860,7 +860,7 @@
def add_rule_for_type(self, type):
rule_name = type.lower().replace("_", "-")
- def xpto (name, sources = [], requirements = [], default_build = None, usage_requirements = []):
+ def xpto (name, sources = [], requirements = [], default_build = [], usage_requirements = []):
return self.manager_.targets().create_typed_target(
type, self.registry.current(), name[0], sources,
requirements, default_build, usage_requirements)
Modified: trunk/tools/build/v2/build/targets.py
==============================================================================
--- trunk/tools/build/v2/build/targets.py (original)
+++ trunk/tools/build/v2/build/targets.py 2010-08-18 03:38:43 EDT (Wed, 18 Aug 2010)
@@ -185,12 +185,9 @@
project: Project where the main target is to be declared
"""
if specification:
- result = specification
-
+ return property_set.create_with_validation(specification)
else:
- result = project.get ('default-build')
-
- return property_set.create_with_validation (result)
+ return project.get ('default-build')
def start_building (self, main_target_instance):
""" Helper rules to detect cycles in main target references.
@@ -663,6 +660,9 @@
if len (self.alternatives_) == 1:
return self.alternatives_ [0]
+ if debug:
+ print "Property set for selection:", property_set
+
for v in self.alternatives_:
properties = v.match (property_set, debug)
@@ -853,7 +853,12 @@
# A cache for build requests
self.request_cache = {}
- self.user_context_ = self.manager_.errors().capture_user_context()
+ # Result of 'capture_user_context' has everything. For example, if this
+ # target is declare as result of loading Jamfile which was loaded when
+ # building target B which was requested from A, then we'll have A, B and
+ # Jamroot location in context. We only care about Jamroot location, most
+ # of the times.
+ self.user_context_ = self.manager_.errors().capture_user_context()[-1:]
self.always_ = False
@@ -1030,7 +1035,7 @@
condition = b2.util.set.difference (bcondition, ccondition)
if debug:
- print " next alternative: required properties:", str(condition)
+ print " next alternative: required properties:", [str(p) for p in condition]
if b2.util.set.contains (condition, property_set.all()):
@@ -1360,7 +1365,20 @@
t.main_target_requirements(requirements, project),
t.main_target_default_build(default_build, project),
t.main_target_usage_requirements(usage_requirements, project)))
+
+
+def create_metatarget(klass, name, sources, requirements=[], default_build=[], usage_requirements=[]):
+ from b2.manager import get_manager
+ t = get_manager().targets()
+ project = get_manager().projects().current()
+
+ return t.main_target_alternative(
+ klass(name, project,
+ t.main_target_sources(sources, name),
+ t.main_target_requirements(requirements, project),
+ t.main_target_default_build(default_build, project),
+ t.main_target_usage_requirements(usage_requirements, project)))
def metatarget_function_for_class(class_):
Modified: trunk/tools/build/v2/build/virtual_target.py
==============================================================================
--- trunk/tools/build/v2/build/virtual_target.py (original)
+++ trunk/tools/build/v2/build/virtual_target.py 2010-08-18 03:38:43 EDT (Wed, 18 Aug 2010)
@@ -535,7 +535,7 @@
if tag:
if len(tag) > 1:
- self.manager_.errors()(
+ get_manager().errors()(
"""<tag>@rulename is present but is not the only <tag> feature""")
tag = tag[0]
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