-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
235 lines (192 loc) · 7.28 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
232
233
234
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0'
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
url new File(rootProject.rootDir, "localLibs")
}
flatDir {
dirs 'localLibs'
}
maven { url "https://grobid.s3.eu-west-1.amazonaws.com/repo/" }
}
apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'base'
apply plugin: 'com.github.kt3k.coveralls'
group 'org.pub2tei'
version '0.2'
description = """transform the myriad of scientific publisher XML into the same TEI XML format, common to GROBID"""
sourceCompatibility = 1.11
targetCompatibility = 1.11
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.run.workingDir = rootProject.rootDir
sourceSets.main.resources {
srcDirs = ["src/main/resources"];
}
processResources {
filesMatching('./config/pub2tei.yml') {
filter {
it.replace('project.version', project.property('version_placeholder'))
}
}
}
configurations {
all*.exclude group: 'org.slf4j', module: "slf4j-log4j12"
all*.exclude group: 'org.slf4j', module: "slf4j-jdk14"
all*.exclude group: 'log4j', module: "log4j"
implementation.setCanBeResolved(true)
}
task install(dependsOn: installShadowDist)
ext {
localLibs = ['saxon9he.jar']
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation "org.hamcrest:hamcrest-all:1.3"
testImplementation "org.easymock:easymock:3.5"
testImplementation "org.xmlunit:xmlunit-matchers:2.10.0"
testImplementation "org.xmlunit:xmlunit-legacy:2.10.0"
// packaging local libs
implementation fileTree(dir: new File(rootProject.rootDir, 'localLibs'), include: localLibs)
implementation(group: 'xml-apis', name: 'xml-apis') {
// otherwise xml-apis 2.0.1 will come from XOM and will result in
// java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
//TODO: sort out this problem better
version {
strictly '1.4.01'
}
}
//implementation "com.google.code.gson:gson:2.8.1"
// GROBID
implementation group: 'org.grobid', name: 'grobid-core', version: '0.8.1'
implementation "black.ninia:jep:4.0.2"
implementation 'ru.vyarus:dropwizard-guicey:7.0.0'
implementation 'io.dropwizard:dropwizard-bom:4.0.0'
implementation 'io.dropwizard:dropwizard-core:4.0.0'
implementation 'io.dropwizard:dropwizard-assets:4.0.0'
implementation 'io.dropwizard:dropwizard-testing:4.0.0'
implementation 'io.dropwizard:dropwizard-forms:4.0.0'
implementation 'io.dropwizard:dropwizard-client:4.0.0'
implementation 'io.dropwizard:dropwizard-auth:4.0.0'
implementation 'io.dropwizard.metrics:metrics-core:4.2.22'
implementation 'io.dropwizard.metrics:metrics-servlets:4.2.22'
implementation "xerces:xercesImpl:2.12.0"
implementation "net.arnx:jsonic:1.3.10"
implementation "net.sf.saxon:Saxon-HE:9.6.0-9"
implementation "xom:xom:1.3.2"
implementation 'javax.xml.bind:jaxb-api:2.3.0'
implementation 'org.apache.opennlp:opennlp-tools:1.9.1'
implementation 'black.ninia:jep:4.0.2'
implementation "org.apache.httpcomponents:httpclient:4.5.3"
implementation "org.apache.lucene:lucene-analyzers-common:4.5.1"
implementation group: 'org.jruby', name: 'jruby-complete', version: '9.2.13.0'
testImplementation "org.xmlunit:xmlunit-matchers:2.10.0"
testImplementation "org.xmlunit:xmlunit-legacy:2.10.0"
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation "com.rockymadden.stringmetric:stringmetric-core_2.10:0.27.3"
//Parsing XML/JSON
//implementation group: 'org.codehaus.woodstox', name: 'stax2-api', version: '4.0.0'
//implementation group: 'org.codehaus.woodstox', name: 'woodstox-core-asl', version: '4.4.1'
implementation "com.fasterxml.jackson.core:jackson-core:2.14.3"
implementation "com.fasterxml.jackson.core:jackson-databind:2.14.3"
// implementation "com.fasterxml.jackson.module:jackson-module-afterburner:2.14.3"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.3"
// compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.3'
implementation 'org.apache.commons:commons-collections4:4.1'
implementation 'commons-beanutils:commons-beanutils:1.9.4'
implementation 'commons-io:commons-io:2.6'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.20'
}
task mainJar(type: ShadowJar) {
zip64 true
from sourceSets.main.output
from {
project.configurations.runtimeClasspath.collect {
it.isDirectory() ? [] : localLibs.contains(it.getName()) ? zipTree(it) : []
}
}
}
distributions {
shadow {
/*contents {
from(new File(rootProject.rootDir, "data/config")) {
into "data/config"
}
}*/
}
}
shadowJar {
archiveClassifier = 'onejar'
mergeServiceFiles()
zip64 true
manifest {
attributes 'Main-Class': 'org.pub2tei.main.Main'
}
//from sourceSets.main.output
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
project.configurations.runtimeClasspath.collect {
it.isDirectory() ? [] : localLibs.contains(it.getName()) ? zipTree(it) : []
}
}
configurations = [project.configurations.runtimeClasspath]
}
jar {
dependsOn mainJar
enabled true
}
artifacts {
archives jar
archives shadowJar
}
//////////
// service
apply plugin: 'application'
application {
mainClassName = 'org.pub2tei.service.ServiceApplication'
run {
def libraries = ""
if (Os.isFamily(Os.FAMILY_MAC)) {
if (Os.OS_ARCH.equals("aarch64")) {
libraries = "${file("../grobid/grobid-home/lib/mac_arm-64").absolutePath}"
} else {
libraries = "${file("../grobid/grobid-home/lib/mac-64").absolutePath}"
}
} else if (Os.isFamily(Os.FAMILY_UNIX)) {
libraries = "${file("../grobid/grobid-home/lib/lin-64/jep").absolutePath}:" +
"${file("../grobid-home/lib/lin-64").absolutePath}:"
} else {
throw new RuntimeException("Unsupported platform!")
}
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) > 0) {
jvmArgs "--add-opens", "java.base/java.lang=ALL-UNNAMED"
}
workingDir = rootProject.rootDir
//def javaLibraryPath = "${System.getProperty('java.library.path')}:" + libraries
//systemProperty "java.library.path", javaLibraryPath
def javaLibraryPath = "${System.getProperty('java.library.path')}:" + libraries
systemProperty "java.library.path", javaLibraryPath
args = ['server', 'resources/config/config.yml']
}
}