[bbv2] Shell for specific project?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[bbv2] Shell for specific project?

Johan Nilsson-4
Hi,

I'm playing around a bit with Bbv2 and the SHELL rule. I've got a "deps"
subdirectory within my project, containing source depedencies for my
project. I've created some Ruby scipts under deps/build to do cvs updates
for boost, storing the sources under deps/src/boost.

I've been running these update/build/install scripts manually, but I figured
I could instead run them using the SHELL built-in (which basically works
fine) on explicit request. This is my simplified project layout.

---
<project-root>
    project-root.jam
    boost-build.jam
    Jamfile.v2
    <deps>
        <build>
            Jamfile.v2
            update.rb
            build.rb
            update_boost.rb
            build_boost.rb
            ... etc ...
---

I added this to my root Jamfile:

---
alias deps : deps/build ;
explicit deps ;
---

and this into a new Jamfile under deps/build:

---
path-constant CD : . ;

import path ;

update_args = [ path.native $(CD) ] ;
update_args = [ path.join $(update_args) update.rb ] ;
build_args = [ path.native $(CD) ] ;
build_args = [ path.join $(build_args) build.rb ] ;

#
# Update and build dependencies
#
ECHO [ SHELL "ruby "$(update_args) ] ;
ECHO [ SHELL "ruby "$(build_args) ] ;
---

This works as far as to execute the 'update' and 'build' scripts. What I'd
like to do is to add support for selecting only to update or build the
dependencies. I tried the below changes, but both of the shell arguments
always execute (which is probably expected, as I don't really understand
what I'm doing):

--- root Jamfile ---
alias deps_build : deps/build//build ;
alias deps_update : deps/build//update ;

--- deps/build Jamfile ---
path-constant CD : . ;

import path ;

update_args = [ path.native $(CD) ] ;
update_args = [ path.join $(update_args) update.rb ] ;
build_args = [ path.native $(CD) ] ;
build_args = [ path.join $(build_args) build.rb ] ;

#
# Update and build dependencies
#
project update ;
ECHO [ SHELL "ruby "$(update_args) ] ;
project build ;
ECHO [ SHELL "ruby "$(build_args) ] ;
---

Some related questions:

1) Is is possible to tell SHELL not to capture output, and simply echo it to
the console as it goes? For my specific situation the output could get
really huge when many things have changed since last update, or the first
time the scripts are run.

2) Can I make other projects depend on the successful execution of specific
shell commands?

Thanks // Johan



_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Vladimir Prus
On Tuesday 24 January 2006 11:21, Johan Nilsson wrote:

> #
> # Update and build dependencies
> #
> project update ;
> ECHO [ SHELL "ruby "$(update_args) ] ;
> project build ;
> ECHO [ SHELL "ruby "$(build_args) ] ;

This won't work in two ways:

1. You can't define two projects in one Jamfile. At the very least, this was
never intended to work and is likely to fail.

2. The ECHO statements have no relation to projects -- they are executed when
Jamfiles are read, unlike targets -- which are declared in the current
project.

> Some related questions:
>
> 1) Is is possible to tell SHELL not to capture output, and simply echo it
> to the console as it goes? For my specific situation the output could get
> really huge when many things have changed since last update, or the first
> time the scripts are run.

I don't know. Anyone?

> 2) Can I make other projects depend on the successful execution of specific
> shell commands?

If you want shell command to be executed during project building, and not
during parsing, you need to use special targets. For example:

  notfile whatever : @your_action : hello ;

  actions your_action
  {
      ruby whatever
  }

  exe hello : hello.cpp : <dependency>whatever ;

In this case, 'hello' won't be build if the 'ruby whatever' target fails.

In case that's no sufficient for your use case, please clarify what else is
needed.

- Volodya


_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Rene Rivera
Vladimir Prus wrote:

> On Tuesday 24 January 2006 11:21, Johan Nilsson wrote:
>
>> Some related questions:
>>
>> 1) Is is possible to tell SHELL not to capture output, and simply echo it
>> to the console as it goes? For my specific situation the output could get
>> really huge when many things have changed since last update, or the first
>> time the scripts are run.
>
> I don't know. Anyone?

No, seeing as the whole point of SHELL is to capture the output ;-)
...Why not use a regular action at instead?


--
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Johan Nilsson-4
In reply to this post by Vladimir Prus
Vladimir Prus wrote:

> On Tuesday 24 January 2006 11:21, Johan Nilsson wrote:
>
>> #
>> # Update and build dependencies
>> #
>> project update ;
>> ECHO [ SHELL "ruby "$(update_args) ] ;
>> project build ;
>> ECHO [ SHELL "ruby "$(build_args) ] ;
>
> This won't work in two ways:
>
> 1. You can't define two projects in one Jamfile. At the very least,
> this was never intended to work and is likely to fail.

Ok.

>
> 2. The ECHO statements have no relation to projects -- they are
> executed when Jamfiles are read, unlike targets -- which are declared
> in the current project.

Understood.

>
>> Some related questions:
>>

[snip]

>> 2) Can I make other projects depend on the successful execution of
>> specific shell commands?
>
> If you want shell command to be executed during project building, and
> not during parsing, you need to use special targets. For example:
>
>  notfile whatever : @your_action : hello ;

"@" ? And why is "hello" there?

>
>  actions your_action
>  {
>      ruby whatever
>  }
>
>  exe hello : hello.cpp : <dependency>whatever ;
>
> In this case, 'hello' won't be build if the 'ruby whatever' target
> fails.

During certain periods, such as when I'm using boost straight from the
latest cvs, I'd like it to be built regardless of whether "your_action"
completes successfully or not (there might be 'partial' success). IIRC there
was some "ignore" flag in classic Jam?

>
> In case that's no sufficient for your use case, please clarify what
> else is needed.

See above.

// Johan




_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Johan Nilsson-4
In reply to this post by Rene Rivera
Rene Rivera wrote:

> Vladimir Prus wrote:
>> On Tuesday 24 January 2006 11:21, Johan Nilsson wrote:
>>
>>> Some related questions:
>>>
>>> 1) Is is possible to tell SHELL not to capture output, and simply
>>> echo it to the console as it goes? For my specific situation the
>>> output could get really huge when many things have changed since
>>> last update, or the first time the scripts are run.
>>
>> I don't know. Anyone?
>
> No, seeing as the whole point of SHELL is to capture the output ;-)
> ...Why not use a regular action at instead?

Because I'm dense ... ?

// Johan



_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Vladimir Prus
In reply to this post by Johan Nilsson-4
On Monday 30 January 2006 11:00, Johan Nilsson wrote:

> >
> >  notfile whatever : @your_action : hello ;
>
> "@" ?

The "@" is supposed to mean that "your_action" is the name of a rule, not
target or something else.

> And why is "hello" there?

Sorry, it should not be there, I've copied it from another example where it
made sense. It's a list of soruces to 'whatever', and in your case it can be
empty.

> >  actions your_action
> >  {
> >      ruby whatever
> >  }
> >
> >  exe hello : hello.cpp : <dependency>whatever ;
> >
> > In this case, 'hello' won't be build if the 'ruby whatever' target
> > fails.
>
> During certain periods, such as when I'm using boost straight from the
> latest cvs, I'd like it to be built regardless of whether "your_action"
> completes successfully or not (there might be 'partial' success). IIRC
> there was some "ignore" flag in classic Jam?

I don't think classic Jam had such "ignore" flag. You might try to make your
"ruby whatever" action detect the mode of operation and either return the
real exit status, or always return 0.

- Volodya



_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Johan Nilsson-4
Vladimir Prus wrote:
> On Monday 30 January 2006 11:00, Johan Nilsson wrote:
>
>>>
>>>  notfile whatever : @your_action : hello ;
>>
>> "@" ?
>
> The "@" is supposed to mean that "your_action" is the name of a rule,
> not target or something else.

Ok.

>
>> And why is "hello" there?
>
> Sorry, it should not be there, I've copied it from another example
> where it made sense. It's a list of soruces to 'whatever', and in
> your case it can be empty.

Ok. It made your example look like a case of circular dependencies.

>
>>>  actions your_action
>>>  {
>>>      ruby whatever
>>>  }
>>>
>>>  exe hello : hello.cpp : <dependency>whatever ;
>>>
>>> In this case, 'hello' won't be build if the 'ruby whatever' target
>>> fails.
>>
>> During certain periods, such as when I'm using boost straight from
>> the latest cvs, I'd like it to be built regardless of whether
>> "your_action" completes successfully or not (there might be
>> 'partial' success). IIRC there was some "ignore" flag in classic Jam?
>
> I don't think classic Jam had such "ignore" flag. You might try to
> make your "ruby whatever" action detect the mode of operation and
> either return the real exit status, or always return 0.

What about: http://public.perforce.com/public/jam/src/Jam.html (search for
"actions ignore")?

// Johan



_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: [bbv2] Shell for specific project?

Vladimir Prus
On Monday 30 January 2006 11:31, Johan Nilsson wrote:

> >> During certain periods, such as when I'm using boost straight from
> >> the latest cvs, I'd like it to be built regardless of whether
> >> "your_action" completes successfully or not (there might be
> >> 'partial' success). IIRC there was some "ignore" flag in classic Jam?
> >
> > I don't think classic Jam had such "ignore" flag. You might try to
> > make your "ruby whatever" action detect the mode of operation and
> > either return the real exit status, or always return 0.
>
> What about: http://public.perforce.com/public/jam/src/Jam.html (search for
> "actions ignore")?

Ah, sorry. I think we have tihs too, but the only way to use this is:

  if $(the-mode-where-return-value-should-be-ignored)
  {
                actions ignore whatever
         {
         }
  }
  else
  {    
         actions whatever
         {
         }
  }

I.e. you'll have to duplicate the body of actions.

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