-
Notifications
You must be signed in to change notification settings - Fork 288
/
Copy pathbuild.gradle
239 lines (196 loc) · 7.46 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
235
236
237
238
239
import org.jodconverter.Deps
import org.jodconverter.Plugins
// External dependencies for the build script
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
//Needed only for SNAPSHOT versions
//maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath Plugins.coveralls
classpath Plugins.nebulaIntegTest
classpath Plugins.nexusStaging
classpath Plugins.spotless
}
}
description = '''
JODConverter automates conversions between office document formats
using LibreOffice or Apache OpenOffice. It automates all conversions
supported by the running instance of OpenOffice/LibreOffice.
'''
group = 'org.jodconverter'
version = '4.4.8'
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Properties
ext {
baselineJavaVersion = JavaVersion.VERSION_1_8
sourceEncoding = "UTF-8"
// Set up different sub-project lists for individual configuration
javaProjects = subprojects.findAll {
new File(it.projectDir, 'src/main/java').directory
}
//releasedProjects = javaProjects.findAll {
// !it.name.contains('jodconverter-sample')
//}
releasedProjects = javaProjects
librariesProjects = releasedProjects.findAll {
!it.name.contains('jodconverter-cli')
}
defaultJvmArgs = []
// "JEP 403: Strongly Encapsulate JDK Internals" causes some tests to
// fail when they try to access internals (often via mocking libraries).à
// We use `--add-opens` as a workaround for now.
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
defaultJvmArgs.addAll(
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED"
)
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Configuration
// Configuration to apply to all the projects
allprojects {
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
}
// Configure Java projects
configure(javaProjects) {
//println("Configuring java for ${project.name}")
apply from: "${rootProject.projectDir}/gradle/java-config.gradle"
}
// Configure Java libraries projects
configure(librariesProjects) {
//println("Configuring java-library for ${project.name}")
apply plugin: 'java-library'
apply from: "${rootProject.projectDir}/gradle/publish-config.gradle"
}
// Distribution configuration
configure(releasedProjects) {
apply plugin: 'distribution'
// exclude jodconverter-cli since it has its own distribution configuration
if (!project.name.contains('jodconverter-cli')) {
distributions {
main {
distributionBaseName = project.name
contents {
from jar, sourcesJar, javadocJar
}
}
}
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Project
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'distribution'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'io.codearte.nexus-staging'
// Configure the distribution task by copying all the distributions of the subprojects to the root project.
project.tasks["distZip"].configure {
description 'Create full distribution zip'
group 'Distribution'
archiveBaseName.set(project.name)
//from releasedProjects.collect { it.tasks.matching { it.name == 'distZip' || it.name == 'distTar' } }
from releasedProjects.collect { it.distZip }
}
project.tasks["distZip"].dependsOn releasedProjects*.distZip
nexusStaging {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
// Exclude folders from IDEA project
idea {
module {
excludeDirs += file('.idea')
}
}
def librariesSources = librariesProjects.sourceSets.main
tasks.register('javadocAll', Javadoc) {
description 'Aggregates Javadoc API documentation of all libraries.'
group 'Documentation'
dependsOn librariesProjects.build
source librariesSources.allJava
destinationDir = file("$buildDir/docs/javadoc")
classpath = files(librariesSources.compileClasspath)
options.with {
windowTitle = "JODConverter API Documentation"
docTitle = "JODConverter $project.version API Documentation"
header = "JODConverter $project.version API"
bottom = 'Copyright © 2022 - present; <a href="https://github.com/jodconverter/jodconverter">JODConverter</a>. All rights reserved.'
//author = false
//breakIterator = true
charSet = 'UTF-8'
docEncoding = 'UTF-8'
encoding = 'UTF-8'
memberLevel = JavadocMemberLevel.PROTECTED
source = baselineJavaVersion
links(
"https://docs.oracle.com/javase/8/docs/api/",
"https://api.libreoffice.org/docs/java/ref/",
"https://commons.apache.org/proper/commons-lang/javadocs/api-release/",
"https://docs.spring.io/spring-boot/docs/${Deps.springBootVersion}/api/"
)
}
options.addBooleanOption('Xdoclint:none')
//options.addStringOption('Xdoclint:none', '-quiet')
inputs.files(librariesSources.allSource + librariesSources.compileClasspath)
outputs.dir destinationDir
}
// Creates an aggregated JaCoCo executionData for all
// the tests (unit tests and integration tests) found
// in sub Java projects
tasks.register('jacocoMerge', JacocoMerge) {
description = 'Aggregates JaCoCo test and integration test coverage reports of all projects.'
group = "Reporting"
// Gather execution data from all subprojects
releasedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
// Code coverage report for all the sub (java) projects
tasks.register('jacocoRootReport', JacocoReport) {
description = 'Generates an aggregate report from all subprojects'
dependsOn releasedProjects.test, releasedProjects.integrationTest, jacocoMerge
additionalSourceDirs.setFrom(files(releasedProjects.sourceSets.main.allSource.srcDirs))
sourceDirectories.setFrom(files(releasedProjects.sourceSets.main.allSource.srcDirs))
classDirectories.setFrom(files(releasedProjects.sourceSets.main.output))
executionData jacocoMerge.destinationFile
reports {
html.required.set(true) // human readable
xml.required.set(true) // required by coveralls
}
}
coveralls {
sourceDirs = releasedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
//tasks.coveralls {
// group = 'Coverage reports'
// description = 'Uploads the aggregated coverage report to Coveralls'
//
// dependsOn jacocoRootReport
// onlyIf { System.env.'CI' }
//}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Utilities
tasks.register('printConfigurations') {
group "Help"
doLast {
subprojects.findAll().each { p ->
println "${p}"
p.configurations.each { println " | " + it.name }
println ""
}
}
}