2 apply plugin: "eclipse"
4 apply plugin: "application"
5 apply plugin: 'project-report'
8 // enables fatjar, the creation of a jar with all dependencies bundled inside
14 classpath 'eu.appsatori:gradle-fatjar-plugin:0.2'
17 apply plugin: 'fatjar'
21 attributes 'Main-Class': "net.sf.jabref.JabRefMain"
27 exceptionFormat "full" // default is "short"
40 srcDirs = ["src/main/java", "src/main/gen"]
54 compile 'com.jgoodies:jgoodies-common:1.4.0'
55 compile 'com.jgoodies:jgoodies-forms:1.6.0'
56 compile 'com.jgoodies:jgoodies-looks:2.5.2'
57 compile fileTree(dir: 'lib/jgoodies/', includes: ['*.jar']) // instead of having the source code inside
59 compile 'org.apache.pdfbox:pdfbox:1.7.1'
60 compile 'org.apache.pdfbox:fontbox:1.7.1'
61 compile 'org.apache.pdfbox:jempbox:1.7.1'
63 compile 'commons-cli:commons-cli:1.3.1'
65 compile 'org.openoffice:juh:3.2.1'
66 compile 'org.openoffice:jurt:3.2.1'
67 compile 'org.openoffice:ridl:3.2.1'
68 compile 'org.openoffice:unoil:3.2.1'
70 antlr2 'antlr:antlr:2.7.7'
71 antlr3 'org.antlr:antlr:3.4'
72 compile 'org.antlr:antlr-runtime:3.4'
74 compile 'mysql:mysql-connector-java:5.0.7'
75 compile 'org.postgresql:postgresql:9.2-1002-jdbc4'
77 compile 'net.java.dev.glazedlists:glazedlists_java15:1.8.0'
78 compile fileTree(dir: 'lib', includes: ['microba.jar', 'spin.jar'])
80 compile 'net.java.dev.jna:jna:4.1.0'
82 compile 'commons-logging:commons-logging:1.0.2'
83 // not available in maven repository
84 compile fileTree(dir: 'lib/plugin', includes: ['jpf.jar', 'jpf-boot.jar', 'JPFCodeGenerator-rt.jar'])
86 compile 'com.sun.jersey:jersey-client:1.14'
87 compile 'com.sun.jersey:jersey-core:1.14'
88 compile 'com.sun.jersey.contribs:jersey-multipart:1.14'
90 compile fileTree(dir: 'lib/spl/sciplore', includes: ['*.jar'])
92 compile 'junit:junit:4.12'
94 generateClasspath fileTree(dir: 'lib/plugin', includes: ['jpf.jar', 'jpf-boot.jar', 'JPFCodeGenerator.jar', 'velocity-dep-1.5.jar'])
97 // use ant targets with prefix antTargets.XXXXX
98 ant.importBuild "build-wrapper.xml"
99 // add jars from this classpath to the classpath for the ant build
100 if (org.gradle.internal.os.OperatingSystem.current().windows) {
101 // according to the discussion at https://github.com/JabRef/jabref/pull/58, the separators are different on Windows and Linux
102 ant.references.jars.setFiles(configurations.compile.asPath.replace(";"," "))
104 ant.references.jars.setFiles(configurations.compile.asPath.replace(":"," "))
107 sourceCompatibility = 1.6
108 mainClassName = "net.sf.jabref.JabRefMain"
110 task wrapper(type: Wrapper) {
111 gradleVersion = '2.4'
115 // files are all encoded using UTF-8
116 options.encoding = 'UTF-8'
117 options.compilerArgs << "-Xlint:unchecked"
121 // files are all encoded using UTF-8
122 options.encoding = 'UTF-8'
127 // files are all encoded using UTF-8
134 // jabref specific tasks
135 compileJava.dependsOn "generateSource"
137 task generateSource(dependsOn: ["generatePluginSource", "generateBstGrammarSource", "generateSearchTreeParserSource"]) {
139 description 'Generates all Java source files.'
142 task generatePluginSource(type: JavaExec) {
144 description 'Generates _JabRefPlugin.java with JPF.'
146 ext.pluginsDir = "src/main/resources/plugins"
148 inputs.dir file(ext.pluginsDir)
149 outputs.file file("src/main/gen/net/sf/jabref/plugin/core/generated/_JabRefPlugin.java")
151 main = "net.sf.jabref.plugin.util.CodeGenerator"
152 args = [ext.pluginsDir]
153 classpath = configurations.generateClasspath
156 task generateBstGrammarSource(type: JavaExec) {
158 description 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr3.'
160 File antlrSource = file('src/main/antlr3/net/sf/jabref/bst/Bst.g')
162 inputs.file antlrSource
163 outputs.file file('src/main/gen/net/sf/jabref/bst/BstLexer.java')
164 outputs.file file('src/main/gen/net/sf/jabref/bst/BstParser.java')
166 main = 'org.antlr.Tool'
167 classpath = configurations.antlr3
168 args = ["-o", file('src/main/gen/net/sf/jabref/bst/'), antlrSource]
171 task generateSearchLexerSource(type: JavaExec) {
172 String grammarFile = "Lexer"
175 description "Generates java files for ${grammarFile}.g antlr2."
177 String packagePath = "net/sf/jabref/search"
178 File antlr2Path = file("src/main/antlr2")
179 File genPath = file("src/main/gen")
181 File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
182 File destinationDir = file("$genPath/$packagePath")
184 inputs.file antlrSource
185 outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
186 outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
187 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
188 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
191 classpath = configurations.antlr2
192 args = ["-o", destinationDir, antlrSource]
195 task generateSearchParserSource(type: JavaExec, dependsOn: "generateSearchLexerSource") {
196 String grammarFile = "Parser"
199 description "Generates java files for ${grammarFile}.g antlr2."
201 String packagePath = "net/sf/jabref/search"
202 File antlr2Path = file("src/main/antlr2")
203 File genPath = file("src/main/gen")
205 File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
206 File destinationDir = file("$genPath/$packagePath")
208 inputs.file antlrSource
209 outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
210 outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
211 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
212 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
215 classpath = configurations.antlr2
216 args = ["-o", destinationDir, antlrSource]
219 task generateSearchTreeParserSource(type: JavaExec, dependsOn: "generateSearchParserSource") {
220 String grammarFile = "TreeParser"
223 description "Generates java files for ${grammarFile}.g antlr2."
225 String packagePath = "net/sf/jabref/search"
226 File antlr2Path = file("src/main/antlr2")
227 File genPath = file("src/main/gen")
229 File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
230 File destinationDir = file("$genPath/$packagePath")
232 inputs.file antlrSource
233 outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
234 outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
235 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
236 outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
239 classpath = configurations.antlr2
240 args = ["-o", destinationDir, antlrSource]
243 // git support in intellij idea
245 withXml { provider ->
246 provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
250 apply plugin: 'jacoco'
251 apply plugin: 'com.github.kt3k.coveralls'
259 classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
265 xml.enabled = true // coveralls plugin depends on xml format report