mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 00:52:16 +00:00
Make default build work.
Also, return non-zero status if there were errors. [SVN r64384]
This commit is contained in:
@@ -97,6 +97,10 @@ class Errors:
|
||||
|
||||
def __init__(self):
|
||||
self.contexts_ = []
|
||||
self._count = 0
|
||||
|
||||
def count(self):
|
||||
return self._count
|
||||
|
||||
def push_user_context(self, message, nested=None):
|
||||
self.contexts_.append(Context(message, nested))
|
||||
@@ -117,6 +121,7 @@ class Errors:
|
||||
raise ExceptionWithUserContext("unexpected exception", self.contexts_[:],
|
||||
e, sys.exc_info()[2])
|
||||
def __call__(self, message):
|
||||
self._count = self._count + 1
|
||||
raise ExceptionWithUserContext(message, self.contexts_[:],
|
||||
stack=traceback.extract_stack())
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ import re
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
from b2.manager import get_manager
|
||||
|
||||
from b2.util.utility import *
|
||||
import property, project, virtual_target, property_set, feature, generators, toolset
|
||||
from virtual_target import Subvariant
|
||||
@@ -84,6 +86,8 @@ from b2.util.sequence import unique
|
||||
from b2.util import path, bjam_signature
|
||||
from b2.build.errors import user_error_checkpoint
|
||||
|
||||
import b2.build.build_request as build_request
|
||||
|
||||
import b2.util.set
|
||||
|
||||
_re_separate_target_from_properties = re.compile (r'^([^<]*)(/(<.*))?$')
|
||||
@@ -594,10 +598,10 @@ class MainTarget (AbstractTarget):
|
||||
d = target.default_build ()
|
||||
|
||||
if self.alternatives_ and self.default_build_ != d:
|
||||
raise BaseException ("Default build must be identical in all alternatives\n"
|
||||
get_manager().errors()("default build must be identical in all alternatives\n"
|
||||
"main target is '%s'\n"
|
||||
"with '%s'\n"
|
||||
"differing from previous default build: '%s'" % (full_name (), d.raw (), self.default_build_.raw ()))
|
||||
"differing from previous default build: '%s'" % (self.full_name (), d.raw (), self.default_build_.raw ()))
|
||||
|
||||
else:
|
||||
self.default_build_ = d
|
||||
@@ -687,7 +691,8 @@ class MainTarget (AbstractTarget):
|
||||
# to use here.
|
||||
compressed = feature.compress_subproperties(property_set.all())
|
||||
|
||||
result = build_request.expand_no_defaults (compressed, defaults_to_apply)
|
||||
result = build_request.expand_no_defaults(
|
||||
b2.build.property_set.create([p]) for p in (compressed + defaults_to_apply))
|
||||
|
||||
else:
|
||||
result.append (property_set)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
|
||||
from b2.build.engine import Engine
|
||||
from b2.manager import Manager
|
||||
from b2.util.path import glob
|
||||
@@ -432,14 +434,14 @@ def main():
|
||||
if "--profiling" in sys.argv:
|
||||
import cProfile
|
||||
import pstats
|
||||
cProfile.runctx('main_real()', globals(), locals(), "stones.prof")
|
||||
return cProfile.runctx('main_real()', globals(), locals(), "stones.prof")
|
||||
|
||||
stats = pstats.Stats("stones.prof")
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time', 'calls')
|
||||
stats.print_callers(20)
|
||||
else:
|
||||
main_real()
|
||||
return main_real()
|
||||
|
||||
def main_real():
|
||||
|
||||
@@ -852,3 +854,8 @@ def main_real():
|
||||
# Prevent automatic update of the 'all' target, now that
|
||||
# we have explicitly updated what we wanted.
|
||||
bjam.call("UPDATE")
|
||||
|
||||
if manager.errors().count() == 0:
|
||||
return ["ok"]
|
||||
else:
|
||||
return []
|
||||
|
||||
@@ -225,7 +225,11 @@ if ! $(dont-build)
|
||||
|
||||
module PyBB
|
||||
{
|
||||
bootstrap $(root) ;
|
||||
local ok = [ bootstrap $(root) ] ;
|
||||
if ! $(ok)
|
||||
{
|
||||
EXIT ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ def bootstrap(root_path):
|
||||
sys.modules["b2"] = m
|
||||
|
||||
import b2.build_system
|
||||
b2.build_system.main()
|
||||
return b2.build_system.main()
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ with
|
||||
differing from previous default build <variant>debug
|
||||
|
||||
"""
|
||||
t.run_build_system("-n --no-error-backtrace", status=1, stdout=expected)
|
||||
t.run_build_system("-n --no-error-backtrace", status=1)
|
||||
t.fail_test(t.stdout().find("default build must be identical in all alternatives") == -1)
|
||||
|
||||
# Test that default-build must be identical in all alternatives. No Error case,
|
||||
# empty default build.
|
||||
|
||||
Reference in New Issue
Block a user