From 653c8a98d4e94ad13942599a1ab7d2e64374a7eb Mon Sep 17 00:00:00 2001 From: bartsch-dev Date: Tue, 26 Jul 2016 17:55:11 +0200 Subject: [PATCH] define xjc input/ouput dir (subsequent builds will be faster) (#1628) Execute task only when input/output dir changed. --- medline.gradle | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/medline.gradle b/medline.gradle index 6fbce0615c8..919acc0987d 100644 --- a/medline.gradle +++ b/medline.gradle @@ -1,18 +1,22 @@ - configurations { - xjc -} + xjc +} dependencies { - xjc group: 'com.sun.xml.bind', name: 'jaxb-xjc', version: '2.2.4-1' + xjc 'com.sun.xml.bind:jaxb-xjc:2.2.4-1' } -task xjc () << { - ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.xjc.asPath) - - ant.xjc(destdir: 'src/main/gen/', package: 'net.sf.jabref.importer.fileformat.medline'){ - schema(dir: 'src/main/resources/xjc/medline', includes: 'medline.xsd') - } +task xjc { + inputs.dir "src/main/resources/xjc/medline/" + outputs.dir "src/main/gen/net/sf/jabref/importer/fileformat/medline" + + ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.xjc.asPath) + + doLast { + ant.xjc(destdir: 'src/main/gen/', package: 'net.sf.jabref.importer.fileformat.medline') { + schema(dir: 'src/main/resources/xjc/medline', includes: 'medline.xsd') + } + } } -tasks. compileJava.dependsOn xjc +tasks.compileJava.dependsOn xjc