I apologize, I know this has been asked before, but I cannot find the relevant posts.

I am curious about how to properly set up up-to-date checks for a "ad hoc" task. For example, we define a JAXB task which leverages the Ant XJC tool (https://github.com/hibernate/hibernate-core/blob/master/hibernate-core/hibernate-core.gradle#L50):

task jaxb << {
    jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
    jaxbTargetDir.mkdirs()

ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.jaxb.asPath)
    ant.jaxbTargetDir = jaxbTargetDir

ant.xjc(destdir: '${jaxbTargetDir}', package: 'org.hibernate.metamodel.source.hbm.xml.config', binding: 'src/main/xjb/hbm-configuration-bindings.xjb') { schema(dir: 'src/main/resources/org/hibernate', includes: 'hibernate-configuration-4.0.xsd')
    }
ant.xjc(destdir: '${jaxbTargetDir}', package: 'org.hibernate.metamodel.source.hbm.xml.mapping', binding: 'src/main/xjb/hbm-mapping-bindings.xjb') { schema(dir: 'src/main/resources/org/hibernate', includes: 'hibernate-mapping-4.0.xsd')
    }
ant.xjc(destdir: '${jaxbTargetDir}', package: 'org.hibernate.metamodel.source.annotation.xml', binding: 'src/main/xjb/orm-bindings.xjb') { schema(dir: 'src/main/resources/org/hibernate/ejb', includes: 'orm_2_0.xsd')
    }
}
compileJava.dependsOn jaxb

This task always dirties the build. So what is the proper way to define inputs/outputs for such a task?

--
Steve Ebersole <[email protected]>
http://hibernate.org

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

   http://xircles.codehaus.org/manage_email


Reply via email to