On Thu, Mar 11, 2010 at 12:31 PM, Andrey Adamovich <
[email protected]> wrote:
> Hi Hans!
>
> When do you plan to release 0.9?
>
Definitely this month. Hopefully in the week after next week.
>
> At the moment I did the following trick:
>
> //////////////////////////////////////////////////////////////////////
> // XML Bean generation
> //////////////////////////////////////////////////////////////////////
>
> sourceSets {
> schema {
> srcDir = 'src/main/schema'
> }
> }
>
> sourceSets.main.java.srcDirs += ['build/xmlbean.src']
> sourceSets.main.resources.srcDirs += ['build/xmlbean.bin']
>
> task xmlbean {
>
classesGenDir = "$buildDir/xmlbean.bin"
>
srcGenDir = "$buildDir/xmlbean.src"
>
schemaFiles = fileTree(sourceSets.schema.srcDir).matching { include
> '**/*.xsd' }
>
>
outputs.files classesGenDir, srcGenDir
>
inputs.files schemaFiles
>
The above works in 0.9 only. Just grab a snapshot. They are of good quality.
Have also a look in the Java doc for the Task, TaskOutputs and TaskInputs
interfaces.
> doFirst {
>
ant {
>
taskdef(name:'xmlbean', classname:
> 'org.apache.xmlbeans.impl.tool.XMLBean', classpath:
> configurations.compile.asPath)
>
xmlbean(srconly: 'true', srcgendir: srcGenDir, classgendir:
> classesGenDir) {
> fileset(dir: sourceSets.schema.srcDir, includes: '**/*.xsd')
>
You can also turn the schemaFiles file tree into an Ant resource and replace
the above line with: schemaFiles.addToAntBuilder(ant, 'fileset')
> }
> touch(file: 'build/.xmlbean')
> }
> }
>
> }
>
> task xmlbeanClean << {
> ant.delete(file: 'build/.xmlbean')
> ant.delete(dir: 'build/xmlbean.src')
> ant.delete(dir: 'build/xmlbean.bin')
> }
>
You can also do:
task xmlbeanClean(type: Delete) {
from "$buildDir/.xmlbean', "$buildDir/xmlbean.src",
"$buildDir/xmlbean.bin"
}
>
> jar.onlyIf { !ant.properties.xml_build_not_required }
> compileJava.onlyIf { !ant.properties.xml_build_not_required }
> processResources.onlyIf { !ant.properties.xml_build_not_required }
>
With 0.9 you wouldn't need the onlyIf's.
>
> clean.dependsOn xmlbeanClean
>
Doesn't clean already delete the whole build dir?
> compileJava.dependsOn xmlbean
>
>
> Do you see any better way of doing this?
>
Not for 0.8. For 0.9 see above.
- Hans
--
Hans Dockter
Founder, Gradle
http://www.gradle.org, http://twitter.com/gradleorg
CEO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz
>
> Andrey
>
> ------------------------------
> *From:* Hans Dockter <[email protected]>
>
> *To:* [email protected]
> *Sent:* Thu, 11 March, 2010 12:03:25
>
> *Subject:* Re: [gradle-user] Up-to-date
>
> Hi Andrey,
>
> On Thu, Mar 11, 2010 at 10:41 AM, Andrey Adamovich <
> [email protected]> wrote:
>
>> Hmm, the reason I ask is because I have introduced a new task for xmlbean
>> compilation. And I made it dependent on compile task:
>>
>> compileJava.dependsOn xmlbean
>>
>> But it seems that xmlbean generation is forced to be done every time I run
>> gradle build. And that also causes jar recompilation.
>>
>
> you need to tell Gradle what properties of your task are input and output
> values (this works only in 0.9).
>
> Our user's guide doesn't have the chapters on that yet.
>
> If you paster your custom task we can tell how to configure it to take part
> in incremental build.
>
> - Hans
>
> --
> Hans Dockter
> Founder, Gradle
> http://www.gradle.org, http://twitter.com/gradleorg
> CEO, Gradle Inc. - Gradle Training, Support, Consulting
> http://www.gradle.biz
>
>
>
>
>>
>> Andrey
>>
>> ------------------------------
>> *From:* Jesse Eichar <[email protected]>
>> *To:* [email protected]
>> *Sent:* Thu, 11 March, 2010 10:34:32
>> *Subject:* Re: [gradle-user] Up-to-date
>>
>> I am also new to Gradle but I can say it does. I think it depends on the
>> type of task. For example generating a jar will only occur if one of its
>> dependencies has changed.
>>
>> Some aspects are still in the works. For example compilation still does
>> more work than necessary but that is slated to be fixed in the near future.
>>
>> Jesse
>>
>> On Mar 11, 2010, at 10:31 AM, Andrey Adamovich wrote:
>>
>> Hi guys!
>>
>> I'm new to gradle. Does gradle support up-to-date check for tasks? E.g. if
>> artifact is built already it skips the tasks unless you clean the artifact.
>>
>> Andrey
>>
>>
>>
>>
>>
>
>