You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Andrew Moore <rp...@gmail.com> on 2009/10/28 21:19:50 UTC

Is there a way to delay building a sub project?


Hi, 

I want to add a sub project to our buildr project that only runs if I
specifically specify it, and not when I run the basic clean, build, package
commands from the root. These are basically integration type tests that I
want our continuous integration system to run, after it deploys, initializes
and starts up our web application.

I figure either I define the sub project dynamically in a task (which I
haven't been able to get working) or I have some sort of way of testing what
buildr command was used when the sub project's tasks are invoked and somehow
enable or disable them to run based on that command (i.e., if the command
invoking buildr contains the text: "root-proj:integration-sub-project:" or
the directory the command ran from ends with "/integration-sub-project").

Any ideas how I can accomplish this? 

Thanks in advance for the help!

Regards,

Andrew



-- 
View this message in context: http://n2.nabble.com/Is-there-a-way-to-delay-building-a-sub-project-tp3907935p3907935.html
Sent from the Apache Buildr - User mailing list archive at Nabble.com.

Re: Is there a way to delay building a sub project?

Posted by Peter Schröder <ps...@blau.de>.
hi andrew,

we had quite the same problem and we are solving it with a mix of  
subprojects, environment-variables and buildr-integration-setup

the tests we want to run for integration-tests (we call them system- 
tests) are seperated into a different source directory called test- 
system. we include that directory only if the environment-variable is  
set to test-system and then also do some integration.setup work for  
deploying servers etc. on foreign hosts.

this setup works quite well because we have a generic type of handling  
for all our projects (which are about 50) and we can also use it to  
separate other tests f.e. functional-tests (we separate unit (no db),  
functional (inmemory) and system (yes they really run on the target- 
systems).

kind regards,
peter


Am 29.10.2009 um 01:17 schrieb Andrew Moore:

>
> Well, I'm not sure that fixes my issue... on the continuous  
> integration
> environment I still need it to compile and run its JUnits after I do  
> a lot
> of other deployment related tasks... I did end up getting a task that
> defines my project on the fly. A pretty serious hack I think, but  
> now I can
> build and run these integration tasks by adding a call to my buildr  
> task
> from the command our build plan uses.
>
> New build plan command:
>
> buildr clean build package myroot:deploy-to-remote-server
> myroot:start-remote-app-server myroot:integration-tests -e
> my-remote-server-environment
>
>
> And approximately what I ended up doing for my "integration-tests"  
> task:
>
>
>
>  # integration-tests
>  task 'integration-tests' do
>
>    Buildr.application.switch_to_namespace "myroot".split(':') do
>
>      Project.define('myroot:integration-tests', {}) do
>          #define the project
>          #compile.with ...etc.
>      end
>
>    end
>
>    project('myroot:integration-tests').clean.invoke
>    project('myroot:integration-tests').build.invoke
>
>  end #integration-tests
>
>
> Any ideas on doing this better (as I'm not a ruby expert at all)  
> would be
> helpful!
>
> Regards,
>
> Andrew
>
>
> -- 
> View this message in context: http://n2.nabble.com/Is-there-a-way-to-delay-building-a-sub-project-tp3907935p3909001.html
> Sent from the Apache Buildr - User mailing list archive at Nabble.com.


Re: Is there a way to delay building a sub project?

Posted by Andrew Moore <rp...@gmail.com>.
Well, I'm not sure that fixes my issue... on the continuous integration
environment I still need it to compile and run its JUnits after I do a lot
of other deployment related tasks... I did end up getting a task that
defines my project on the fly. A pretty serious hack I think, but now I can
build and run these integration tasks by adding a call to my buildr task
from the command our build plan uses.

New build plan command:

buildr clean build package myroot:deploy-to-remote-server
myroot:start-remote-app-server myroot:integration-tests -e
my-remote-server-environment


And approximately what I ended up doing for my "integration-tests" task:



  # integration-tests
  task 'integration-tests' do

    Buildr.application.switch_to_namespace "myroot".split(':') do

      Project.define('myroot:integration-tests', {}) do
          #define the project
          #compile.with ...etc.
      end

    end
    
    project('myroot:integration-tests').clean.invoke
    project('myroot:integration-tests').build.invoke
    
  end #integration-tests


Any ideas on doing this better (as I'm not a ruby expert at all) would be
helpful!

Regards,

Andrew


-- 
View this message in context: http://n2.nabble.com/Is-there-a-way-to-delay-building-a-sub-project-tp3907935p3909001.html
Sent from the Apache Buildr - User mailing list archive at Nabble.com.

Re: Is there a way to delay building a sub project?

Posted by Assaf Arkin <as...@labnotes.org>.
On Wed, Oct 28, 2009 at 1:19 PM, Andrew Moore <rp...@gmail.com>wrote:

>
>
> Hi,
>
> I want to add a sub project to our buildr project that only runs if I
> specifically specify it, and not when I run the basic clean, build, package
> commands from the root. These are basically integration type tests that I
> want our continuous integration system to run, after it deploys,
> initializes
> and starts up our web application.
>
> I figure either I define the sub project dynamically in a task (which I
> haven't been able to get working) or I have some sort of way of testing
> what
> buildr command was used when the sub project's tasks are invoked and
> somehow
> enable or disable them to run based on that command (i.e., if the command
> invoking buildr contains the text: "root-proj:integration-sub-project:" or
> the directory the command ran from ends with "/integration-sub-project").
>

You can use environment variables:

if ENV["CI"]
  define ....
  end
end

and then run buildr compile CI=true


You can use multiple parent projects (which can share the same base
directory):
http://github.com/apache/ode/blob/trunk/Buildfile

Assaf


> Any ideas how I can accomplish this?
>
> Thanks in advance for the help!
>
> Regards,
>
> Andrew
>
>
>
> --
> View this message in context:
> http://n2.nabble.com/Is-there-a-way-to-delay-building-a-sub-project-tp3907935p3907935.html
> Sent from the Apache Buildr - User mailing list archive at Nabble.com.
>