Hi,

I tried the plugins and it works well.

I also made the following improvements:

1) Integrate the plugin with maven scm capability, i.e. use APIs to call "svn status" to detect if there are any local changes against SVN repo. (Pretty fast for a single module).

2) Add a "scm" parameter to configure if "svn status" will be used or not. For example,
mvn org.apache.tuscany.sca:tuscany-maven-incremental-build:build -Dscm=false

3) Add an exception if the build is run against a pom module as we haven't implemented it yet.

If there are no objections to my changes, I'll commit them.

Thanks,
Raymond

----- Original Message ----- From: "Jean-Sebastien Delfino" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, December 04, 2007 5:26 PM
Subject: How to run incremental builds of the Tuscany SCA tree


I'm sharing this as I think it could be useful to others.

I like to build the java/sca tree before committing code changes to check that my changes are not going to break any other module.

This gives me a peace of mind as I don't have to worry about build breaks and is also nice to other contributors as I know that I'm not breaking their modules.

Unfortunately Maven is not particularly smart about detecting changes and rebuilding only impacted modules and the brute force "mvn clean install" on the whole tree takes long and makes my Thinkpad's CPU overheat.

So I thought it would be nice to teach Maven how to do more incremental builds:

- recompile and retest with mvn clean install the modules that have compile dependencies on the modules I've changed

- only retest the modules that have runtime and test dependencies on the modules I've changed.

I developed a little Maven plugin to do it. It's really simple and leverages the Maven dependency model, see for yourself at [1].

Here's how I use the plugin to run incremental builds:

1. To mark that a module has changed, create a .modified marker file at its root. This is what the plugin recognizes as an indication that the module has changed. I was thinking about running "svn st" automatically from the plugin but for now I've found simpler to just use a shell script like follows to create/remove these .modified marker files:

st=`svn st | grep -v ".modified"`
if [ "x$st" != "x" ]
then
  echo "Modified"
  echo "$st"
  touch .modified
else
  echo "Not modified"
  rm -f .modified
fi

This is for Linux, I'm sure that it can be translated to a Windows script.

2. To run the incremental build, from java/sca run:
mvn -o org.apache.tuscany.sca:tuscany-maven-incremental-build:build

This will recompile and/or retest only the modules affected by the changed modules. Faster and more reliable, and greener as my Thinkpad now uses less energy :)

Hope this helps. I'm interested in your feedback if you use it and like it, or not :) or want to help improve it.

[1] https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java
--
Jean-Sebastien

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to