forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
231 lines (177 loc) · 6.96 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "application"
apply plugin: 'project-report'
apply plugin: 'pmd'
// enables fatjar, the creation of a jar with all dependencies bundled inside
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'eu.appsatori:gradle-fatjar-plugin:0.2-rc1'
}
}
apply plugin: 'fatjar'
fatJar {
classifier 'fat'
manifest {
attributes 'Main-Class': "net.sf.jabref.JabRefMain"
}
}
version = "2.11dev"
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDirs = ["src/main/java", "src/main/gen"]
}
}
}
configurations {
generateClasspath
antlr3
antlr2
}
dependencies {
// jgoodies
compile 'com.jgoodies:jgoodies-common:1.4.0'
compile 'com.jgoodies:jgoodies-forms:1.6.0'
compile 'com.jgoodies:jgoodies-looks:2.5.2'
compile fileTree(dir: 'lib/jgoodies/', includes: ['*.jar']) // instead of having the source code inside
compile 'org.apache.pdfbox:pdfbox:1.7.1'
compile 'org.apache.pdfbox:fontbox:1.7.1'
compile 'org.apache.pdfbox:jempbox:1.7.1'
// option parser
compile fileTree(dir: 'lib/ritopt/', includes: ['*.jar']) // instead of having the source code inside
compile 'org.openoffice:juh:3.2.1'
compile 'org.openoffice:jurt:3.2.1'
compile 'org.openoffice:ridl:3.2.1'
compile 'org.openoffice:unoil:3.2.1'
antlr2 'antlr:antlr:2.7.7'
antlr3 'org.antlr:antlr:3.4'
compile 'org.antlr:antlr-runtime:3.4'
compile 'mysql:mysql-connector-java:5.0.7'
compile 'org.postgresql:postgresql:9.2-1002-jdbc4'
compile fileTree(dir: 'lib', includes: ['glazedlists-1.8.0_java15.jar', 'jayatana-1.2.4.jar', 'microba.jar', 'spin.jar'])
// not available in maven repository
compile fileTree(dir: 'lib/plugin', includes: ['jpf.jar', 'jpf-boot.jar', 'commons-logging.jar', 'JPFCodeGenerator-rt.jar'])
compile fileTree(dir: 'lib/spl/jersey', includes: ['*.jar'])
compile fileTree(dir: 'lib/spl/sciplore', includes: ['*.jar'])
compile 'junit:junit:3.8.2'
generateClasspath fileTree(dir: 'lib/plugin', includes: ['jpf.jar', 'jpf-boot.jar', 'JPFCodeGenerator.jar', 'velocity-dep-1.5.jar'])
}
// use ant targets with prefix antTargets.XXXXX
ant.importBuild "build-wrapper.xml"
sourceCompatibility = 1.6
mainClassName = "net.sf.jabref.JabRefMain"
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
compileJava {
// files are all encoded using UTF-8
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked"
}
compileTestJava {
// files are all encoded using UTF-8
options.encoding = 'UTF-8'
}
javadoc {
options {
// files are all encoded using UTF-8
encoding = 'UTF-8'
version = true
author = true
}
}
// jabref specific tasks
compileJava.dependsOn "generateSource"
task generateSource(dependsOn: ["generatePluginSource", "generateBstGrammarSource", "generateSearchTreeParserSource"]) {
group = 'JabRef'
description = 'Generates all Java source files.'
}
task generatePluginSource(type: JavaExec) {
group = 'JabRef'
description = 'Generates _JabRefPlugin.java with JPF.'
ext.pluginsDir = "src/main/resources/plugins"
inputs.dir file(ext.pluginsDir)
outputs.file file("src/main/gen/net/sf/jabref/plugin/core/generated/_JabRefPlugin.java")
main = "net.sf.jabref.plugin.util.CodeGenerator"
args = [ext.pluginsDir]
classpath = configurations.generateClasspath
}
task generateBstGrammarSource(type: JavaExec) {
group = 'JabRef'
description = 'Generates BstLexer.java and BstParser.java from the Bst.g grammar file using antlr.'
File antlrSource = file('src/main/antlr3/net/sf/jabref/bst/Bst.g')
inputs.file antlrSource
outputs.file file('src/main/gen/net/sf/jabref/bst/BstLexer.java')
outputs.file file('src/main/gen/net/sf/jabref/bst/BstParser.java')
main = 'org.antlr.Tool'
classpath = configurations.antlr3
args = ["-o", file('src/main/gen/net/sf/jabref/bst/'), antlrSource]
}
task generateSearchLexerSource(type: JavaExec) {
String grammarFile = "Lexer"
group = 'JabRef'
description = "Generates java files for ${grammarFile}.g antlr2."
String packagePath = "net/sf/jabref/search"
File antlr2Path = file("src/main/antlr2")
File genPath = file("src/main/gen")
File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
File destinationDir = file("$genPath/$packagePath")
inputs.file antlrSource
outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
main = 'antlr.Tool'
classpath = configurations.antlr2
args = ["-o", destinationDir, antlrSource]
}
task generateSearchParserSource(type: JavaExec, dependsOn: "generateSearchLexerSource") {
String grammarFile = "Parser"
group = 'JabRef'
description = "Generates java files for ${grammarFile}.g antlr2."
String packagePath = "net/sf/jabref/search"
File antlr2Path = file("src/main/antlr2")
File genPath = file("src/main/gen")
File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
File destinationDir = file("$genPath/$packagePath")
inputs.file antlrSource
outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
main = 'antlr.Tool'
classpath = configurations.antlr2
args = ["-o", destinationDir, antlrSource]
}
task generateSearchTreeParserSource(type: JavaExec, dependsOn: "generateSearchParserSource") {
String grammarFile = "TreeParser"
group = 'JabRef'
description = "Generates java files for ${grammarFile}.g antlr2."
String packagePath = "net/sf/jabref/search"
File antlr2Path = file("src/main/antlr2")
File genPath = file("src/main/gen")
File antlrSource = file("$antlr2Path/$packagePath/${grammarFile}.g")
File destinationDir = file("$genPath/$packagePath")
inputs.file antlrSource
outputs.file file("$destinationDir/SearchExpression${grammarFile}.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}.smap")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.java")
outputs.file file("$destinationDir/SearchExpression${grammarFile}TokenTypes.txt")
main = 'antlr.Tool'
classpath = configurations.antlr2
args = ["-o", destinationDir, antlrSource]
}
// git support in intellij idea
idea.project.ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
}
}