staging subprojects

View: New views
9 Messages — Rating Filter:   Alert me  

staging subprojects

by Jim Gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a project tree, and I force the entire tree to be built by invoking the build at the root. I have the following in my Jamroot:

# find all the jam subprojects
JamProjects =
    [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
    ;

#build-project $(BJamProjects) ;
for local proj in $(JamProjects)
{
    build-project $(proj) ;
}


Building works fine. In addition to a lib or exe rule, most of the subprojects have an install rule that looks like this:

install stage
    : theLib
    : <location>$(STAGE_SERVER)
;

Running bjam stage in each of the subprojects works as expected, resulting in a copy of the lib or exe being place in the specified directory. I am having difficulty getting a root build to have each subproject run the stage target. Any suggestions as to how I could accomplish this?

Thanks,
Jim Gallagher

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: staging subprojects

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jim Gallagher wrote:

> Hi,
>
> I have a project tree, and I force the entire tree to be built by
> invoking the build at the root. I have the following in my Jamroot:
>
> # find all the jam subprojects
> JamProjects =
>     [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
>     ;
>
> #build-project $(BJamProjects) ;
> for local proj in $(JamProjects)
> {
>     build-project $(proj) ;
> }
>
>
> Building works fine. In addition to a lib or exe rule, most of the
> subprojects have an install rule that looks like this:
>
> install stage
>     : theLib
>     : <location>$(STAGE_SERVER)
> ;
>
> Running bjam stage in each of the subprojects works as expected,
> resulting in a copy of the lib or exe being place in the specified
> directory. I am having difficulty getting a root build to have each
> subproject run the stage target. Any suggestions as to how I could
> accomplish this?
Basically, you can use found jam projects, replacing the "/Jamfile$" with
"//stage", and e.g. add these to an alias, e.g:

-- Jamroot (partial, untested) --

path-constant all-stage : all-stage ;

alias sub-stages : sub1//stage sub2//stage ; # but generating the target
list automatically

install stage :
    sub-stages
    :
    <location>$(all-stage) # overrides location if exists in sub-stage
    ;

---

See also attached archive.

HTH / Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

substage.zip (1K) Download Attachment

Parent Message unknown Re: staging subprojects

by Jim Gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan,

Thanks for your suggestion. It seems to work fine, but what about when
one of the subprojects should not be staged? I've been experimenting
with trying to define a "null" stage rule for those subprojects, but I
am not having much luck.

Thanks,
Jim


> From: "Johan Nilsson"
> To: boost-build@...
> Subject: Re: [Boost-build] staging subprojects

> Jim Gallagher wrote:
>> Hi,
>>
>> I have a project tree, and I force the entire tree to be built by
>> invoking the build at the root. I have the following in my Jamroot:
>>
>> # find all the jam subprojects
>> JamProjects =
>>     [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
>>     ;
>>
>> #build-project $(BJamProjects) ;
>> for local proj in $(JamProjects)
>> {
>>     build-project $(proj) ;
>> }
>>
>>
>> Building works fine. In addition to a lib or exe rule, most of the
>> subprojects have an install rule that looks like this:
>>
>> install stage
>>     : theLib
>>     : <location>$(STAGE_SERVER)
>> ;
>>
>> Running bjam stage in each of the subprojects works as expected,
>> resulting in a copy of the lib or exe being place in the specified
>> directory. I am having difficulty getting a root build to have each
>> subproject run the stage target. Any suggestions as to how I could
>> accomplish this?
>
> Basically, you can use found jam projects, replacing the "/Jamfile$" with
> "//stage", and e.g. add these to an alias, e.g:
>
> -- Jamroot (partial, untested) --
>
> path-constant all-stage : all-stage ;
>
> alias sub-stages : sub1//stage sub2//stage ; # but generating the target
> list automatically
>
> install stage :
>     sub-stages
>     :
>     <location>$(all-stage) # overrides location if exists in sub-stage
>     ;
>
> ---
>
> See also attached archive.
>
> HTH / Johan
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: staging subprojects

by Jim Gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For those projects that should not be staged, this seems to work:

    install stage ;

    explicit stage ;

Does that appear acceptable?

On Fri, Sep 25, 2009 at 9:41 AM, Jim Gallagher <jim@...> wrote:
Johan,

Thanks for your suggestion. It seems to work fine, but what about when
one of the subprojects should not be staged? I've been experimenting
with trying to define a "null" stage rule for those subprojects, but I
am not having much luck.

Thanks,
Jim


> From: "Johan Nilsson"
> To: boost-build@...
> Subject: Re: [Boost-build] staging subprojects

> Jim Gallagher wrote:
>> Hi,
>>
>> I have a project tree, and I force the entire tree to be built by
>> invoking the build at the root. I have the following in my Jamroot:
>>
>> # find all the jam subprojects
>> JamProjects =
>>     [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
>>     ;
>>
>> #build-project $(BJamProjects) ;
>> for local proj in $(JamProjects)
>> {
>>     build-project $(proj) ;
>> }
>>
>>
>> Building works fine. In addition to a lib or exe rule, most of the
>> subprojects have an install rule that looks like this:
>>
>> install stage
>>     : theLib
>>     : <location>$(STAGE_SERVER)
>> ;
>>
>> Running bjam stage in each of the subprojects works as expected,
>> resulting in a copy of the lib or exe being place in the specified
>> directory. I am having difficulty getting a root build to have each
>> subproject run the stage target. Any suggestions as to how I could
>> accomplish this?
>
> Basically, you can use found jam projects, replacing the "/Jamfile$" with
> "//stage", and e.g. add these to an alias, e.g:
>
> -- Jamroot (partial, untested) --
>
> path-constant all-stage : all-stage ;
>
> alias sub-stages : sub1//stage sub2//stage ; # but generating the target
> list automatically
>
> install stage :
>     sub-stages
>     :
>     <location>$(all-stage) # overrides location if exists in sub-stage
>     ;
>
> ---
>
> See also attached archive.
>
> HTH / Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: staging subprojects

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jim Gallagher wrote:
> Johan,
>
> Thanks for your suggestion. It seems to work fine, but what about when
> one of the subprojects should not be staged? I've been experimenting
> with trying to define a "null" stage rule for those subprojects, but I
> am not having much luck.

Try:

alias stage ;

Alternatives (to avoid every Jamfile having to define this):

As you have the paths to the Jamfiles, you _could_ make a regex search for
e.g. "^\s*install\s+stage" (not sure if this exact regex works with the
Boost.Jam regex engine). Hackish, but workable. As a variation you could add
your own unique tags somewhere inside the Jamfiles to mark file as having a
stage target.

HTH / Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Parent Message unknown Re: staging subprojects

by Jim Gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan,

Sorry, took some short cuts to assemble a quick reply, and made a mess.

OK, a stripped down project:

Jamroot:

import os ;
import feature ;
import type ;

path-constant TOP : . ;

using msvc : : :
    <compileflags>-DWIN32
    <compileflags>-D_CRT_SECURE_NO_WARNINGS
    <compileflags>-D_SECURE_SCL=0
    <compileflags>-I\"C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/PlatformSDK/Include\"
    <compileflags>-I\"C:/Program\ Files/Microsoft\ Platform\ SDK/Include\"
    <compileflags>-Wp64
    <compileflags>/Z7
    <linkflags>-libpath:\"C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/PlatformSDK/Lib\"
    <linkflags>-libpath:\"C:/Program\ Files/Microsoft\ Platform\ SDK/lib\"
    <linkflags>msvcrt.lib
    <linkflags>msvcprt.lib
    <linkflags>kernel32.lib
    <linkflags>oldnames.lib
    <linkflags>/MACHINE:X86
;


variant Debug32 :
        <threading>multi
        <exception-handling>on
        <asynch-exceptions>off
        <extern-c-nothrow>on
        <warnings>on
        <debug-symbols>on
        <optimization>off
        <runtime-debugging>off
        <runtime-link>shared
        <link>shared
        <address-model>32
        <rtti>on
;

project TEST
;


# find all the jam subprojects
JamProjects =
    [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
    ;

#build-project $(JamProjects) ;
for local proj in $(JamProjects)
{
    build-project $(proj) ;
}


alias sub-stages : $(JamProjects)//stage ;

install stage
    :
    sub-stages
    ;
===========================
sub/Jamfile:

lib a :
    a.c
;

lib b :
    b.c
;

lib c :
    c.c
;

install stage-client
    : a c
    : <location>$(TOP)/stage/client
;

install stage-server
    : b c
    : <location>$(TOP)/stage/server
;

explicit stage stage-client stage-server ;
alias stage : stage-client stage-server ;

==================================
Complete output from "bjam Debug32 stage" at the root, then "bjam Debug32 stage" in sub:

C:\TEMP>bjam Debug32 stage
M:/ul081b_bp8.0_integrated_test_20090928_view/ba3/boost-build/build\virtual-target.jam:996: in virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <pstage>c.dll
error: previous virtual target { common%common.copy-c.dll.SHARED_LIB { common%common.copy-c.dll.SHARED_LIB { msvc%msvc.link.dll-c.dll.SHARED_LIB { msvc%msvc.compile.c-c.obj.OBJ { c.c.C } } } } }
error: created from ./stage
error: another virtual target { common%common.copy-c.dll.SHARED_LIB { common%common.copy-c.dll.SHARED_LIB { msvc%msvc.link.dll-c.dll.SHARED_LIB { msvc%msvc.compile.c-c.obj.OBJ { c.c.C } } } } }
error: created from ./stage
error: added properties:  none
error: removed properties:  none
M:/ul081b_bp8.0_integrated_test_20090928_view/ba3/boost-build/build\virtual-target.jam:459: in actualize-no-scanner from module object(file-target)@144
M:/ul081b_bp8.0_integrated_test_20090928_view/ba3/boost-build/build\virtual-target.jam:111: in object(file-target)@144.actualize from module object(file-target)@144
M:/ul081b_bp8.0_integrated_test_20090928_view/ba3/boost-build\build-system.jam:488: in load from module build-system
M:\ul081b_bp8.0_integrated_test_20090928_view\ba3\devutils\..\boost-build\kernel\modules.jam:261: in import from module modules
M:\ul081b_bp8.0_integrated_test_20090928_view\ba3\devutils\..\boost-build\kernel\bootstrap.jam:132: in boost-build from module
M:\ul081b_bp8.0_integrated_test_20090928_view\ba3\devutils\..\boost-build\boost-build.jam:1: in module scope from module

C:\TEMP>cd sub

C:\TEMP\sub>bjam Debug32 stage
...found 33 targets...
...updating 23 targets...
MkDir1 C:\TEMP\stage
MkDir1 C:\TEMP\stage\server
MkDir1 bin
MkDir1 bin\msvc-8.0
MkDir1 bin\msvc-8.0\Debug32
compile-c-c++ bin\msvc-8.0\Debug32\b.obj
b.c
msvc.link.dll bin\msvc-8.0\Debug32\b.dll
   Creating library bin\msvc-8.0\Debug32\b.lib and object bin\msvc-8.0\Debug32\b.exp
common.copy C:\TEMP\stage\server\b.dll
        1 file(s) copied.
common.copy C:\TEMP\stage\server\b.lib
        1 file(s) copied.
compile-c-c++ bin\msvc-8.0\Debug32\c.obj
c.c
msvc.link.dll bin\msvc-8.0\Debug32\c.dll
   Creating library bin\msvc-8.0\Debug32\c.lib and object bin\msvc-8.0\Debug32\c.exp
common.copy C:\TEMP\stage\server\c.dll
        1 file(s) copied.
common.copy C:\TEMP\stage\server\c.lib
        1 file(s) copied.
MkDir1 C:\TEMP\stage\client
compile-c-c++ bin\msvc-8.0\Debug32\a.obj
a.c
msvc.link.dll bin\msvc-8.0\Debug32\a.dll
   Creating library bin\msvc-8.0\Debug32\a.lib and object bin\msvc-8.0\Debug32\a.exp
common.copy C:\TEMP\stage\client\a.dll
        1 file(s) copied.
common.copy C:\TEMP\stage\client\a.lib
        1 file(s) copied.
common.copy C:\TEMP\stage\client\c.dll
        1 file(s) copied.
common.copy C:\TEMP\stage\client\c.lib
        1 file(s) copied.
...updated 23 targets...

C:\TEMP\sub>

Thanks,
Jim



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: staging subprojects

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jim Gallagher wrote:
> Johan,
>
> Sorry, took some short cuts to assemble a quick reply, and made a
> mess.
>
> OK, a stripped down project:

I can see the same problem, and stripped down the project even further to:

=============================
Jamroot:

import os ;
import feature ;
import type ;

path-constant TOP : . ;

project TEST ;

# find all the jam subprojects
JamProjects =
     [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
     ;

for local proj in $(JamProjects)
{
    build-project $(proj) ;
}


alias sub-stages : $(JamProjects)//stage ;

install stage
    :
    sub-stages
    ;

===========================
 sub/Jamfile:

 lib a :
     a.c
 ;

 lib b :
     b.c
 ;

 lib c :
     c.c
 ;

 install stage-client
     : a c
     : <location>$(TOP)/stage/client
 ;

 install stage-server
     : b c
     : <location>$(TOP)/stage/server
 ;

 explicit stage stage-client stage-server ;
alias stage : stage-client stage-server ;

==================================

Judging from the output when running e.g. "bjam -q debug" message it seems
like the "<location>" in the subprojects isn't being respected/detected; it
looks like c.dll is attempted to get installed into "$(TOP)/stage" from both
of the sub-targets. I'll take another look at it when I have some spare
time.

/ Johan




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: staging subprojects

by Steven Watanabe-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

AMDG

Johan Nilsson wrote:

> Jim Gallagher wrote:
>> Johan,
>>
>> Sorry, took some short cuts to assemble a quick reply, and made a
>> mess.
>>
>> OK, a stripped down project:
>
> I can see the same problem, and stripped down the project even further
> to:
>
> =============================
> Jamroot:
>
> import os ;
> import feature ;
> import type ;
>
> path-constant TOP : . ;
>
> project TEST ;
>
> # find all the jam subprojects
> JamProjects =
>     [ MATCH (.*)/Jamfile : [ glob-tree Jamfile ] ]
>     ;
>
> for local proj in $(JamProjects)
> {
>    build-project $(proj) ;
> }
>
>
> alias sub-stages : $(JamProjects)//stage ;
>
> install stage
>    :
>    sub-stages
>    ;

You shouldn't use install here.  This use of install
finds c twice.  Just use

alias stage : $(JamProjects)//stage ;

In Christ,
Steven Watanabe

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Parent Message unknown Re: staging subprojects

by Jim Gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah, the magic incantation. Works great!

Steven and Johan, thanks for your help.

Jim



You shouldn't use install here.  This use of install
finds c twice.  Just use

alias stage : $(JamProjects)//stage ;


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build