2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Minor stylistic Boost Build code changes.

[SVN r45023]
This commit is contained in:
Jurko Gospodnetić
2008-05-02 15:26:44 +00:00
parent b800e2be7a
commit 47b22866b8
3 changed files with 120 additions and 120 deletions

View File

@@ -1077,7 +1077,8 @@ class basic-target : abstract-target
#
rule sources ( )
{
if ! $(self.source-targets) {
if ! $(self.source-targets)
{
for local s in $(self.sources)
{
self.source-targets +=
@@ -1149,9 +1150,8 @@ class basic-target : abstract-target
local grist = $(dependency:G) ;
local id = $(dependency:G=) ;
local result =
[ targets.generate-from-reference $(id) : $(self.project)
: $(property-set) ] ;
local result = [ targets.generate-from-reference $(id) :
$(self.project) : $(property-set) ] ;
$(result-var) += $(result[2-]:G=$(grist)) ;
$(usage-requirements-var) += [ $(result[1]).raw ] ;
@@ -1197,12 +1197,11 @@ class basic-target : abstract-target
local properties = [ $(rproperties).non-dependency ] ;
local usage-requirements ;
generate-dependencies [ $(rproperties).dependency ]
: $(rproperties)
: properties usage-requirements ;
generate-dependencies [ $(rproperties).dependency ] :
$(rproperties) : properties usage-requirements ;
generate-dependencies $(self.sources) : $(rproperties)
: source-targets usage-requirements ;
generate-dependencies $(self.sources) : $(rproperties) :
source-targets usage-requirements ;
if [ modules.peek : .debug-building ]
{
@@ -1227,9 +1226,8 @@ class basic-target : abstract-target
# libraries having the same <library> usage requirement.
source-targets = [ sequence.unique $(source-targets) ] ;
local result =
[ construct $(self.name) :
$(source-targets) : $(rproperties) ] ;
local result = [ construct $(self.name) : $(source-targets) :
$(rproperties) ] ;
if $(result)
{
@@ -1248,7 +1246,7 @@ class basic-target : abstract-target
if [ modules.peek : .debug-building ]
{
ECHO [ targets.indent ]
"Usage requirements from $(self.name) are "
"Usage requirements from $(self.name) are"
[ $(ur).raw ] ;
}
@@ -1259,8 +1257,9 @@ class basic-target : abstract-target
{
if $(rproperties[1]) = "@error"
{
ECHO [ targets.indent ]
"Skipping build of: " [ full-name ] " cannot compute common properties" ;
ECHO [ targets.indent ] "Skipping build of:" [ full-name ]
"cannot compute common properties" ;
}
else if [ $(rproperties).get <build> ] = no
{
@@ -1272,7 +1271,7 @@ class basic-target : abstract-target
ECHO [ targets.indent ] "Skipping build of: " [ full-name ] " unknown reason" ;
}
# We're here either because there's been an error computing
# We are here either because there's been an error computing
# properties, or there's <build>no in properties. In the latter
# case we don't want any diagnostic. In the former case, we need
# diagnostics. FIXME

View File

@@ -28,7 +28,7 @@
#
# The __init__ rule is the constructor, and sets member variables.
#
# New instances are created by invoking [ new <class> <args...> ]::
# New instances are created by invoking [ new <class> <args...> ]:
#
# local x = [ new myclass foo ] ; # x is a new myclass object
# assert.result foo : [ $(x).method1 ] ; # $(x).method1 returns "foo"
@@ -49,18 +49,18 @@
# }
# }
#
# All methods operate virtually, replacing behavior in the base
# classes. For example::
# All methods operate virtually, replacing behavior in the base classes. For
# example::
#
# local y = [ new derived foo ] ; # y is a new derived object
# assert.result fooXXX : [ $(y).method1 ] ; # $(y).method1 returns "foo"
# local y = [ new derived foo ] ; # y is a new derived object
# assert.result fooXXX : [ $(y).method1 ] ; # $(y).method1 returns "foo"
#
# Each class instance is its own core Jam module. All instance
# attributes and methods are accessible without additional
# qualification from within the class instance. All rules imported in
# class declaration, or visible in base classses are also visible.
# Base methods are available in qualified form: base-name.method-name.
# By convention, attribute names are prefixed with "self.".
# Each class instance is its own core Jam module. All instance attributes and
# methods are accessible without additional qualification from within the class
# instance. All rules imported in class declaration, or visible in base classses
# are also visible. Base methods are available in qualified form:
# base-name.method-name. By convention, attribute names are prefixed with
# "self.".
import numbers ;
import errors : * ;
@@ -113,6 +113,7 @@ rule bases ( class )
}
}
rule is-derived ( class : bases + )
{
#local all = $(class) $(bases) ;
@@ -141,13 +142,15 @@ rule is-derived ( class : bases + )
return $(found) ;
}
# Returns true if the 'value' is a class instance.
rule is-instance ( value # The value to check
)
#
rule is-instance ( value )
{
return [ MATCH "^(object\\()[^@]+\\)@.*" : $(value) ] ;
}
# Check if the given value is of the given type.
#
rule is-a (
@@ -161,6 +164,7 @@ rule is-a (
}
}
local rule typecheck ( x )
{
local class-name = [ MATCH "^\\[(.*)\\]$" : [ BACKTRACE 1 ] ] ;
@@ -170,14 +174,14 @@ local rule typecheck ( x )
}
}
local rule __test__ ( )
{
import "class" : * ;
import assert ;
import errors : * ;
# This will be the construction function for a class called
# 'myclass'
# This will be the construction function for a class called 'myclass'.
class myclass
{
import assert : nonempty-variable ;
@@ -277,15 +281,13 @@ local rule __test__ ( )
return $(z) ;
}
# Check that 'assert.equal' visible in base class is visible
# here.
# Check that 'assert.equal' visible in base class is visible here.
rule invariant2 ( )
{
assert.equal 2 : 2 ;
}
# Check that 'nonempty-variable' visible in base class is
# visible here.
# Check that 'nonempty-variable' visible in base class is visible here.
rule invariant3 ( )
{
local v = 10 ;
@@ -336,11 +338,10 @@ local rule __test__ ( )
expect_derived2 $(d) ;
expect_derived2 $(e) ;
# argument checking is set up to call exit(1) directly on
# failure, and we can't hijack that with try, so we'd better
# not do this test by default. We could fix this by having
# errors look up and invoke the EXIT rule instead; EXIT can be
# hijacked (;-)
# Argument checking is set up to call exit(1) directly on failure, and we
# can't hijack that with try, so we'd better not do this test by default.
# We could fix this by having errors look up and invoke the EXIT rule
# instead; EXIT can be hijacked (;-)
if --fail-typecheck in [ modules.peek : ARGV ]
{
try ;
@@ -385,7 +386,7 @@ local rule __test__ ( )
$(b).invariant2 ;
$(b).invariant3 ;
# Check that the __class__ attribute is getting properly set.
# Check that the __class__ attribute is getting properly set.
assert.result myclass : $(a).get-class ;
assert.result derived1 : $(b).get-class ;
assert.result $(a) : $(a).get-instance ;

View File

@@ -4,8 +4,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)
# This module defines the 'install' rule, used to copy a set of targets to a
# single location
# This module defines the 'install' rule, used to copy a set of targets to a
# single location.
import targets ;
import "class" : new ;
@@ -49,6 +49,7 @@ class install-target-class : basic-target
}
# If <location> is not set, sets it based on the project data.
#
rule update-location ( property-set )
{
local loc = [ $(property-set).get <location> ] ;
@@ -62,8 +63,9 @@ class install-target-class : basic-target
return $(property-set) ;
}
# Takes a target that is installed and property set which is
# used when installing.
# Takes a target that is installed and a property set which is used when
# installing.
#
rule adjust-properties ( target : build-property-set )
{
local ps-raw ;
@@ -73,33 +75,31 @@ class install-target-class : basic-target
local ps = [ $(a).properties ] ;
ps-raw = [ $(ps).raw ] ;
# Unless <hardcode-dll-paths>true is in properties, which can
# happen only if the user has explicitly requested it, nuke all
# Unless <hardcode-dll-paths>true is in properties, which can happen
# only if the user has explicitly requested it, nuke all.
# <dll-path> properties
if [ $(property-set).get <hardcode-dll-paths> ] != true
{
ps-raw = [ property.change $(ps-raw) : <dll-path> ] ;
}
# If any <dll-path> properties were specified for installing,
# add them.
# If any <dll-path> properties were specified for installing, add
# them.
local l = [ $(build-property-set).get <dll-path> ] ;
ps-raw += $(l:G=<dll-path>) ;
# Also copy <linkflags> feature from current build
# set, to be used for relinking.
# Also copy <linkflags> feature from current build set, to be used
# for relinking.
local l = [ $(build-property-set).get <linkflags> ] ;
ps-raw += $(l:G=<linkflags>) ;
}
# Remove the <tag> feature on original targets.
ps-raw = [ property.change $(ps-raw) : <tag> ] ;
# And <location>. If stage target has another stage target
# in sources, then we'll get virtual targets with <location>
# property set.
# And <location>. If stage target has another stage target in sources,
# then we'll get virtual targets with <location> property set.
ps-raw = [ property.change $(ps-raw) : <location> ] ;
local d = [ $(build-property-set).get <dependency> ] ;
ps-raw += $(d:G=<dependency>) ;
@@ -110,8 +110,8 @@ class install-target-class : basic-target
ps-raw += $(ns:G=<install-no-version-symlinks>) ;
local d = [ $(build-property-set).get <install-source-root> ] ;
# Make the path absolute: we'll use it to compute relative
# paths and making the path absolute will help.
# Make the path absolute: we'll use it to compute relative paths and
# making the path absolute will help.
if $(d)
{
d = [ path.root $(d) [ path.pwd ] ] ;
@@ -130,8 +130,8 @@ class install-target-class : basic-target
rule construct ( name : source-targets * : property-set )
{
source-targets = [
targets-to-stage $(source-targets) : $(property-set) ] ;
source-targets = [ targets-to-stage $(source-targets) :
$(property-set) ] ;
property-set = [ update-location $(property-set) ] ;
@@ -139,8 +139,8 @@ class install-target-class : basic-target
if $(ename) && $(source-targets[2])
{
errors.error
"When <name> property is used in 'install', only one source is allowed" ;
errors.error "When <name> property is used in 'install', only one"
"source is allowed" ;
}
local result ;
@@ -148,11 +148,11 @@ class install-target-class : basic-target
{
local staged-targets ;
local new-properties =
[ adjust-properties $(i) : $(property-set) ] ;
local new-properties = [ adjust-properties $(i) :
$(property-set) ] ;
# See if something special should be done when staging this
# type. It is indicated by presense of special "staged" type
# See if something special should be done when staging this type. It
# is indicated by the presense of special "INSTALLED_" type.
local t = [ $(i).type ] ;
if $(t) && [ type.registered INSTALLED_$(t) ]
{
@@ -162,8 +162,8 @@ class install-target-class : basic-target
}
else
{
local targets = [ generators.construct $(self.project) $(name) :
INSTALLED_$(t) : $(new-properties) : $(i) ] ;
local targets = [ generators.construct $(self.project)
$(name) : INSTALLED_$(t) : $(new-properties) : $(i) ] ;
staged-targets += $(targets[2-]) ;
}
}
@@ -187,8 +187,9 @@ class install-target-class : basic-target
return [ property-set.empty ] $(result) ;
}
# Given the list of source targets explicitly passed to 'stage',
# returns the list of targets which must be staged.
# Given the list of source targets explicitly passed to 'stage', returns the
# list of targets which must be staged.
#
rule targets-to-stage ( source-targets * : property-set )
{
local result ;
@@ -206,7 +207,7 @@ class install-target-class : basic-target
local ty = [ $(r).type ] ;
if $(ty)
{
# Don't stage searched libs.
# Do not stage searched libs.
if $(ty) != SEARCHED_LIB
{
if $(included-types)
@@ -224,8 +225,8 @@ class install-target-class : basic-target
}
else if ! $(included-types)
{
# Don't install typeless target if there's
# explicit list of allowed types.
# Don't install typeless target if there is an explicit list of
# allowed types.
result += $(r) ;
}
}
@@ -234,6 +235,7 @@ class install-target-class : basic-target
}
# CONSIDER: figure out why we can't use virtual-target.traverse here.
#
rule collect-targets ( targets * )
{
# Find subvariants
@@ -261,6 +263,7 @@ class install-target-class : basic-target
}
# Returns true iff 'type' is subtype of some element of 'types-to-include'.
#
local rule include-type ( type : types-to-include * )
{
local found ;
@@ -280,41 +283,42 @@ class install-target-class : basic-target
# Creates a copy of target 'source'. The 'properties' object should have a
# <location> property which specifies where the target must be placed.
#
rule copy-file ( project name ? : source : properties )
{
local targets ;
name ?= [ $(source).name ] ;
new-a = [
new non-scanning-action $(source) : common.copy : $(properties) ] ;
local new-a = [ new non-scanning-action $(source) : common.copy :
$(properties) ] ;
local source-root = [ $(properties).get <install-source-root> ] ;
if $(source-root)
{
# Get the real path of the target. We probably need to strip
# relative path from the target name at construction...
# Get the real path of the target. We probably need to strip relative
# path from the target name at construction.
local path = [ $(source).path ] ;
path = [ path.root $(name:D) $(path) ] ;
# Make the path absolute. Otherwise, it's hard to compute relative
# path. The 'source-root' is already absolute, see the
# Make the path absolute. Otherwise, it would be hard to compute the
# relative path. The 'source-root' is already absolute, see the
# 'adjust-properties' method above.
path = [ path.root $(path) [ path.pwd ] ] ;
relative = [ path.relative-to $(source-root) $(path) ] ;
# Note: using $(name:D=$(relative)) might be faster
# here, but then we need to explicitly check that
# relative is not ".", otherwise we might get paths like
# Note: using $(name:D=$(relative)) might be faster here, but then we
# need to explicitly check that relative is not ".", otherwise we might
# get paths like
#
# <prefix>/boost/.
#
# try to create it, and mkdir will obviously fail.
name = [ path.root $(name:D=) $(relative) ] ;
targets = [ new file-target $(name) exact : [ $(source).type ]
: $(project) : $(new-a) ] ;
targets = [ new file-target $(name) exact : [ $(source).type ] :
$(project) : $(new-a) ] ;
}
else
{
targets = [ new file-target $(name:D=) exact : [ $(source).type ]
: $(project) : $(new-a) ] ;
targets = [ new file-target $(name:D=) exact : [ $(source).type ] :
$(project) : $(new-a) ] ;
}
return $(targets) ;
@@ -323,12 +327,9 @@ rule copy-file ( project name ? : source : properties )
rule symlink ( name : project : source : properties )
{
local a = [ new action $(source) : symlink.ln :
$(properties) ] ;
local targets = [
new file-target $(name) exact : [ $(source).type ] : $(project) : $(a) ] ;
return $(targets) ;
local a = [ new action $(source) : symlink.ln : $(properties) ] ;
return [ new file-target $(name) exact : [ $(source).type ] : $(project) :
$(a) ] ;
}
@@ -336,10 +337,8 @@ rule relink-file ( project : source : property-set )
{
local action = [ $(source).action ] ;
local cloned-action = [ virtual-target.clone-action $(action) : $(project) :
"" : $(property-set) ] ;
local result = [ $(cloned-action).targets ] ;
return $(result) ;
"" : $(property-set) ] ;
return [ $(cloned-action).targets ] ;
}
@@ -347,6 +346,7 @@ rule relink-file ( project : source : property-set )
# relinking to the new location.
type.register INSTALLED_EXE : : EXE ;
class installed-exe-generator : generator
{
import type ;
@@ -376,6 +376,7 @@ class installed-exe-generator : generator
}
}
generators.register [ new installed-exe-generator ] ;
@@ -383,6 +384,7 @@ generators.register [ new installed-exe-generator ] ;
# links.
type.register INSTALLED_SHARED_LIB : : SHARED_LIB ;
class installed-shared-lib-generator : generator
{
import type ;
@@ -401,12 +403,9 @@ class installed-shared-lib-generator : generator
if [ $(property-set).get <os> ] in NT CYGWIN ||
[ $(property-set).get <target-os> ] in windows cygwin
{
local copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ virtual-target.register $(copied) ] ;
return $(copied) ;
local copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
return [ virtual-target.register $(copied) ] ;
}
else
{
@@ -415,8 +414,8 @@ class installed-shared-lib-generator : generator
if ! $(a)
{
# Non-derived file, just copy.
copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
}
else
{
@@ -427,38 +426,38 @@ class installed-shared-lib-generator : generator
if $(current-dll-path) != $(new-dll-path)
{
# Rpath changed, need to relink.
copied = [ stage.relink-file
$(project) : $(source) : $(property-set) ] ;
copied = [ stage.relink-file $(project) : $(source) :
$(property-set) ] ;
}
else
{
copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
}
}
copied = [ virtual-target.register $(copied) ] ;
local result = $(copied) ;
# If the name is in the form NNN.XXX.YYY.ZZZ, where all
# 'X', 'Y' and 'Z' are numbers, we need to create
# NNN.XXX and NNN.XXX.YYY symbolic links.
# If the name is in the form NNN.XXX.YYY.ZZZ, where all 'X', 'Y' and
# 'Z' are numbers, we need to create NNN.XXX and NNN.XXX.YYY
# symbolic links.
local m = [ MATCH (.*)\\.([0123456789]+)\\.([0123456789]+)\\.([0123456789]+)$
: [ $(copied).name ] ] ;
if $(m)
{
# Symlink without version at all is used to make
# -lsome_library work.
result += [ stage.symlink $(m[1]) : $(project)
: $(copied) : $(property-set) ] ;
result += [ stage.symlink $(m[1]) : $(project) : $(copied) :
$(property-set) ] ;
# Symlinks of some libfoo.N and libfoo.N.M are used
# so that library can found at runtime, if libfoo.N.M.X
# has soname of libfoo.N. That happens when the library
# makes some binary compatibility guarantees. If not,
# it's possible to skip those symlinks.
# Symlinks of some libfoo.N and libfoo.N.M are used so that
# library can found at runtime, if libfoo.N.M.X has soname of
# libfoo.N. That happens when the library makes some binary
# compatibility guarantees. If not, it is possible to skip those
# symlinks.
local suppress =
[ $(property-set).get <install-no-version-symlinks> ] ;
[ $(property-set).get <install-no-version-symlinks> ] ;
if $(suppress) != "on"
{
@@ -478,13 +477,13 @@ generators.register [ new installed-shared-lib-generator ] ;
# Main target rule for 'install'.
#
rule install ( name : sources * : requirements * : default-build * )
{
local project = [ project.current ] ;
# Unless the user has explicitly asked us to hardcode dll paths, add
# <hardcode-dll-paths>false in requirements, to override default
# value.
# <hardcode-dll-paths>false in requirements, to override default value.
if ! <hardcode-dll-paths>true in $(requirements)
{
requirements += <hardcode-dll-paths>false ;
@@ -504,5 +503,6 @@ rule install ( name : sources * : requirements * : default-build * )
] ;
}
IMPORT $(__name__) : install : : install ;
IMPORT $(__name__) : install : : stage ;