Boost logo

Boost-Build :

From: Michael Stevens (Michael.Stevens_at_[hidden])
Date: 2003-07-25 02:01:48


Hi Volodya,

>
> Some nits. You don't have to call "raw" to compare property-sets. Just
>
> $(self.default-build) != $(d)
>
> should suffice.

Thanks for picking up these nits. I mostly wrote this code by example
without any deeper understanding of the internals!
My intention was that the comparision would check for identical
property-set values, rather then identical property set inheritance. (In
the same way that a type equivilance can be defined either in terms of
identical structure or identical inheritance)
I observed that .raw produced the property-set values so I guessed that
was what I wanted.

> Another nit: is that your mailer has wrapped the patch ;-) Probably,
> attachement will be safer.

Arggg.
Attached is a new diff with modifed test. It also corrects the error output.

>
> Last nit: when your patch is applied,
> the "default_build" test no longer passes :-) Not a big surprise,
> since we
> check for the current logic.
>
> If you have some time to to run the test and change it, that would be
> great.
> Of course, if you don't have the time right now, I'll be happy to
> apply the
> patch and change the test myself.

Quickly installed python and did a crash (20 minute) teach yourself
course in the python based test system! Patch for test system is
attached. It includes one negative and one postive test or the new rule.
I use a "-n" in the run_build_system command. Hopefully this is the
accepted was of testing without actions.
It could probably do with a second positve test with a non blank default
build. However the only logical usage would be something like:

exe a : a.cpp : : release ;
exe a : b.cpp : <toolset>XXX : release ;
Only problem is my knowledge of Python quoting do not allow me to insert
a valid XXX from the know system toolset!

All the best,
Michael

 --------------080108020603020700070703 Content-Type: text/plain;
name="targets.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="targets.jam.diff"

Index: targets.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/new/targets.jam,v
retrieving revision 1.106
diff -U3 -r1.106 targets.jam
--- targets.jam 21 Jul 2003 08:30:19 -0000 1.106
+++ targets.jam 25 Jul 2003 06:20:46 -0000
@@ -369,20 +369,22 @@
import print ;
import build-request feature property-set ;
import targets : start-building end-building ;

# Add a new alternative for this target
rule add-alternative ( target )
{
local d = [ $(target).default-build ] ;
- if $(self.alternatives) && [ $(d).raw ]
+ if $(self.alternatives) && ( $(self.default-build) != $(d) )
{
- errors.error "default build can be specified only in first alternative"
- : "main target is " [ full-name ] ;
+ errors.error "default build must be identical in all alternatives"
+ : "main target is" [ full-name ]
+ : "with" [ $(d).raw ]
+ : "differing from previous default build" [ $(self.default-build).raw ] ;
}
else
{
self.default-build = $(d) ;
}
self.alternatives += $(target) ;
}
 --------------080108020603020700070703 Content-Type: text/plain;
name="default_build.py.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="default_build.py.diff"

Index: default_build.py
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/test/default_build.py,v
retrieving revision 1.13
diff -U3 -r1.13 default_build.py
--- default_build.py 19 May 2003 09:54:08 -0000 1.13
+++ default_build.py 25 Jul 2003 07:01:35 -0000
@@ -26,29 +26,37 @@
t.expect_addition("bin/$toolset/debug/optimization-space/a.exe")
t.expect_addition("bin/$toolset/release/optimization-space/a.exe")

-# Test that we can declare default build only in the first
-# alternative
+# Test that default-build must be identical in all alternatives. Error case.
t.write("Jamfile", """
-exe a : a.cpp : : debug release ;
-exe a : b.cpp : : debug release ;
+exe a : a.cpp : : debug ;
+exe a : b.cpp : : ;
""")
-expected="""error: default build can be specified only in first alternative
-main target is ./a
+expected="""error: default build must be identical in all alternatives
+main target is ./a
+with
+differing from previous default build <variant>debug

"""
-t.run_build_system("--no-error-backtrace", status=1, stdout=expected)
+t.run_build_system("-n --no-error-backtrace", status=1, stdout=expected)
+
+# Test that default-build must be identical in all alternatives. No Error case, empty default build.
+t.write("Jamfile", """
+exe a : a.cpp : <variant>debug ;
+exe a : b.cpp : <variant>release ;
+""")
+t.run_build_system("-n --no-error-backtrace", status=0)

# Now try a harder example: default build which contains <define>
# should cause <define> to be present when "b" is compiled.
# This happens only of "build-project b" is placed first.
t.write("Jamfile", """
 --------------080108020603020700070703--


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