mod time checking on source sets

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

mod time checking on source sets

by Philip Crotwell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Is there a easy way to compare two source sets to see if the first has
changed since the second was generated?

For example, I have some java that is generated from corba idl. It
would be nice to be able to make an idl source set and a java source
set within the project, and only run the idl compiler if the most
recent mod time in the idl source is after the the earliest mod time
in the java source set. Another case I have is generating html
documentation pages from a xml schema. I would like to only have that
done when the schema changes as it is somewhat time consuming.

I am sure some small amount of groovy could accomplish this, but as
the concept of "use X to generate Y, but only if X is newer than Y"
seems a pretty fundamental concept in a build system and so I was
hoping that this was already solved in Gradle. It appears that Ant has
something similar in its "DependSet" but it seems to remove files
rather than giving a boolean comparison, or at least it is not clear
to me how to make use of it.

thanks,
Philip

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: mod time checking on source sets

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Philip Crotwell wrote:

> Hi
>
> Is there a easy way to compare two source sets to see if the first has
> changed since the second was generated?
>
> For example, I have some java that is generated from corba idl. It
> would be nice to be able to make an idl source set and a java source
> set within the project, and only run the idl compiler if the most
> recent mod time in the idl source is after the the earliest mod time
> in the java source set. Another case I have is generating html
> documentation pages from a xml schema. I would like to only have that
> done when the schema changes as it is somewhat time consuming.
>
> I am sure some small amount of groovy could accomplish this, but as
> the concept of "use X to generate Y, but only if X is newer than Y"
> seems a pretty fundamental concept in a build system and so I was
> hoping that this was already solved in Gradle.

Very nearly. This is what I am currently working on in trunk. There
should be something working in the next few days.

Generally, there will be some way to declare the inputs and outputs of a
task and the task will only be executed if the inputs have changed in
some way since the outputs were generated.

I'm not sure of the exact syntax yet. For what we call enhanced tasks
(those that you use by type such as Compile or Jar), we'll probably use
annotations attached to the task's properties. For simple tasks,
there'll be some way to say 'this task uses x as input' and 'this task
generated y as output'.

We will also use this same information to automatically wire task
dependencies together, so that a task will automatically depend on those
tasks which produce it's input files.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email