-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
179 lines (156 loc) · 5.07 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
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'idea'
id "com.diffplug.spotless" version "5.14.3"
}
group = 'uk.ac.ebi.ena.sra'
archivesBaseName = 'webin-xml'
version = '2.5.4'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
main {
java {
srcDir 'src/main/java'
srcDir 'src/generated/java'
}
resources {
srcDir 'src/main/resources'
include '**/SRA*.xsd'
include '**/ENA*.xsd'
include '**/EGA*.xsd'
include '**/*.xslt'
exclude '**/ENA.embl.xsd'
exclude '**/ENA.root.xsd'
}
}
generated {
java
output.resourcesDir = sourceSets.main.output.resourcesDir
compileClasspath += sourceSets.main.runtimeClasspath
}
}
idea {
module {
sourceDirs += sourceSets.main.output.classesDirs
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
// Group level (enasequence) maven artifactory.
url "https://gitlab.ebi.ac.uk/api/v4/groups/enasequence/-/packages/maven"
credentials(HttpHeaderCredentials) {
name = "Private-Token"
value = project.ext.properties.gitlab_private_token
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
dependencies {
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
implementation(group: 'commons-io', name: 'commons-io', version: '1.3.2')
implementation(group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.11.2')
// Without this, a default JDK class is used for compiling xslts that throws
// javax.xml.transform.TransformerConfigurationException for some reason.
runtime 'net.sf.saxon:saxon:8.7' //9.0, 9.7
// To fix a Null pointer exception thrown when a transformation is applied on an object.
runtime 'net.sf.saxon:saxon-dom:8.7' //9.0, 9.7
testImplementation 'junit:junit:4.12'
testImplementation 'org.xmlunit:xmlunit-core:2.9.1'
testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
testImplementation 'org.skyscreamer:jsonassert:1.5.1'
}
task generateXMLBeanSources () {
doLast{
delete "src/generated/java"
ant.taskdef(name:'xmlbean', classname: 'org.apache.xmlbeans.impl.tool.XMLBean', classpath: configurations.compile.asPath)
sourceSets.main.resources.files.each {File file ->
ant.xmlbean(schema: file.path, classgendir: "build/classes/java/main" , srcgendir: "src/generated/java", classpath: configurations.compile.asPath) {
fileset(dir: file.parentFile) {
include(name: '*.xsdconfig')
}
}
}
}
}
compileJava.dependsOn generateXMLBeanSources
publish.dependsOn build
task classes (overwrite: true) {
}
test {
maxHeapSize = "1024m"
jvmArgs "-Dfile.encoding=UTF-8"
testLogging {
events "failed", "standardOut", "standardError"
}
}
spotless {
encoding 'UTF-8'
lineEndings 'UNIX'
java {
targetExclude 'src/generated/**'
importOrder('java', 'javax', 'org', 'com', '', 'uk')
removeUnusedImports()
googleJavaFormat()
licenseHeader '''/*
* Copyright 2023 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
'''
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.generated.allSource
archiveClassifier = 'sources'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
repositories {
maven {
// Project specific maven repository in Gitlab.
url "https://gitlab.ebi.ac.uk/api/v4/projects/3209/packages/maven"
// Developer token in Gitlab.
credentials(HttpHeaderCredentials) {
name = "Private-Token"
value = project.ext.properties.gitlab_private_token
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
task printSources {
sourceSets.main.allSource.files.each {File file ->
println file
}
}