Hi Hans!
When do you plan to release 0.9?
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 << {
ant.taskdef(name:'xmlbean', classname:
'org.apache.xmlbeans.impl.tool.XMLBean', classpath:
configurations.compile.asPath)
ant.uptodate(property: 'xml_build_not_required', targetfile:
"build/.xmlbean") {
srcfiles(dir: sourceSets.schema.srcDir, includes: '**/*.xsd')
}
if (!ant.properties.xml_build_not_required) {
ant.xmlbean(srconly: 'true', srcgendir: 'build/xmlbean.src', classgendir:
'build/xmlbean.bin') {
fileset(dir: sourceSets.schema.srcDir, includes: '**/*.xsd')
}
ant.touch(file: 'build/.xmlbean')
}
}
task xmlbeanClean << {
ant.delete(file: 'build/.xmlbean')
ant.delete(dir: 'build/xmlbean.src')
ant.delete(dir: 'build/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 }
clean.dependsOn xmlbeanClean
compileJava.dependsOn xmlbean
Do you see any better way of doing this?
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
>>
>>
>
>