|
Boost-Build : |
From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-10-08 14:53:34
Hi All,
I did some experiments with order sensitive features. Take a look on the
attached .diff files for reference. Note that this is just a concept not
the final patch. :)
So the problem is that presently all properties are sorted and so there
is no way to control their order. In some cases this is not acceptable,
for example when Platform SDK is used together with MSVC.
The solution is to join all order-sensitive properties using "&&" syntax
before they get sorted:
<include>b <include>a -> <include>b&&a
All property sets are created by the 'property-set.add' rule so the
joining logic can be added here.
The second problem is merging different property sets. They can come
from different places: it can be properties of a target, project
properties, usage properties, etc. I didn't find any better way to deal
with it but to add new properties in front of existing ones.
pset1 = [ property-set.create <include>b <include>a ] ;
pset2 = [ property-set.create <include>z <include>y ] ;
# The result - '<include>z&&y&&b&&a'
pset1 = [ $(pset1).add $(pset2) ] ;
This works in case of include directories but in reality the order will
depend on the order of processing corresponding property sets.
Open questions:
1. What is the order of precedence of different property sets a user may
define? We have:
- project properties;
- target properties;
- project usage requirements;
- target usage requirements;
- parent project properties;
- anything else?
2. Should different kind properties (include and sources for instance)
have different precedence order?
3. Do we need to control order of values after two property sets get
merged (i.e. new properties are added in front or to the end of existing)?
Best regards/Venlig hilsen,
Alexey Pakhunov.
--------------050209060402040805040003 Content-Type: text/plain;
name="property-set.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="property-set.jam.diff"
Index: property-set.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/property-set.jam,v
retrieving revision 1.23
diff -u -r1.23 property-set.jam
--- property-set.jam 8 Apr 2005 13:23:04 -0000 1.23
+++ property-set.jam 8 Oct 2005 18:39:25 -0000
@@ -39,6 +39,8 @@
{
self.raw = $(raw-properties) ;
+ ECHO p-set $(self.raw) ;
+
for local p in $(raw-properties)
{
if ! $(p:G)
@@ -283,7 +285,9 @@
{
if ! $(self.added.$(ps))
{
- self.added.$(ps) = [ property-set.create $(self.raw) [ $(ps).raw ] ] ;
+ # Add new properties in front of the existing ones. This affects
+ # order sensitive properties only. The rest will be sorted any way.
+ self.added.$(ps) = [ property-set.create [ $(ps).raw ] $(self.raw) ] ;
}
return $(self.added.$(ps)) ;
}
@@ -340,10 +344,50 @@
}
+
+# Join all values of each order sensitive property into a single value.
+# So '<include>a <include>b' will became '<include>a&&b'
+local rule join-order-sensitive ( raw-properties * )
+{
+ local sorted ;
+ local unsorted ;
+
+ for local i in $(raw-properties)
+ {
+ local g = $(i:G) ;
+ if order-sensitive in [ feature.attributes $(g) ]
+ {
+ if $(g) in $(unsorted)
+ {
+ unsorted-$(g) += $(i:G=) ;
+ }
+ else
+ {
+ unsorted += $(g) ;
+ unsorted-$(g) = $(i:G=) ;
+ }
+ }
+ else
+ {
+ sorted += $(i) ;
+ }
+ }
+
+ for local i in $(unsorted)
+ {
+ sorted += $(i)$(unsorted-$(i):J="&&") ;
+ }
+
+ return $(sorted) ;
+}
+
+
# Creates new 'property-set' instance for the given raw properties,
# or returns an already existing ones.
rule create ( raw-properties * )
{
+ raw-properties = [ join-order-sensitive $(raw-properties) ] ;
+
raw-properties = [ sequence.unique
[ sequence.insertion-sort $(raw-properties) ] ] ;
@@ -355,7 +399,7 @@
}
return $(.ps.$(key)) ;
}
-NATIVE_RULE property-set : create ;
+#NATIVE_RULE property-set : create ;
# Creates new 'property-set' instances after checking
# that all properties are valid and converting incidental
--------------050209060402040805040003 Content-Type: text/plain;
name="builtin.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="builtin.jam.diff"
Index: builtin.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/builtin.jam,v
retrieving revision 1.180
diff -u -r1.180 builtin.jam
--- builtin.jam 22 Sep 2005 13:51:58 -0000 1.180
+++ builtin.jam 8 Oct 2005 18:49:48 -0000
@@ -50,7 +50,7 @@
feature extern-c-nothrow : off on : propagated ;
feature debug-symbols : on off : propagated ;
feature define : : free ;
-feature "include" : : free path ; #order-sensitive ;
+feature "include" : : free path order-sensitive ;
feature cflags : : free ;
feature cxxflags : : free ;
feature fflags : : free ;
@@ -94,15 +94,15 @@
feature source : : free dependency incidental ;
feature library : : free dependency incidental ;
feature file : : free dependency incidental ;
-feature find-shared-library : : free ; #order-sensitive ;
-feature find-static-library : : free ; #order-sensitive ;
-feature library-path : : free path ; #order-sensitive ;
+feature find-shared-library : : free order-sensitive ;
+feature find-static-library : : free order-sensitive ;
+feature library-path : : free path order-sensitive ;
# Internal feature.
feature library-file : : free dependency ;
feature name : : free ;
feature tag : : free ;
-feature search : : free path ; #order-sensitive ;
+feature search : : free path order-sensitive ;
feature location : : free path ;
feature dll-path : : free path ;
--------------050209060402040805040003--
Boost-Build 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