build.gradle 8.28 KB
Newer Older
acoburn's avatar
acoburn committed
1
plugins {
Aaron Coburn's avatar
Aaron Coburn committed
2
    id 'com.github.hierynomus.license' version '0.14.0'
3
4
5
    id 'net.researchgate.release' version '2.7.0'
    id 'com.github.ben-manes.versions' version '0.20.0'
    id 'org.gretty' version '2.2.0'
acoburn's avatar
acoburn committed
6
7
8
9
10
11
12
13
14
}

allprojects  {
    apply plugin: 'maven'

    group = 'edu.amherst.acdc'

    repositories {
        mavenCentral()
Aaron Coburn's avatar
Aaron Coburn committed
15
        jcenter()
acoburn's avatar
acoburn committed
16
17
18
        mavenLocal()
    }

Aaron Coburn's avatar
Aaron Coburn committed
19
    ext {
20
        jacocoVersion = '0.8.2'
Aaron Coburn's avatar
Aaron Coburn committed
21
22
    }

acoburn's avatar
acoburn committed
23
24
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
25
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-proc:none"
acoburn's avatar
acoburn committed
26
27
        }
    }
acoburn's avatar
acoburn committed
28

acoburn's avatar
acoburn committed
29
    release {
acoburn's avatar
acoburn committed
30
        tagTemplate = '$name-$version'
Aaron Coburn's avatar
Aaron Coburn committed
31
32
33
        git {
            signTag = true
        }
acoburn's avatar
acoburn committed
34
    }
acoburn's avatar
acoburn committed
35
36
37
38
39
40
41
42
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'maven-publish'
    apply plugin: 'signing'
    apply plugin: 'checkstyle'
    apply plugin: 'com.github.hierynomus.license'
acoburn's avatar
acoburn committed
43
    apply plugin: 'jacoco'
acoburn's avatar
acoburn committed
44
45
46
47
48
49
50
51
52
53

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    ext {
        vendor = 'Amherst College'
        homepage = 'https://www.amherst.edu'
        docURL = 'https://acdc.amherst.edu/wiki'
        license = 'Apache 2'

acoburn's avatar
acoburn committed
54
        camelVersionRange = '[2.18,3)'
55
        jenaVersionRange = '[3.8,4)'
acoburn's avatar
acoburn committed
56
        activemqVersionRange = '[5.14,6)'
57
        fcrepoCamelToolboxVersionRange = '[4.7.1,5)'
acoburn's avatar
acoburn committed
58

acoburn's avatar
acoburn committed
59
        /* Dependencies */
60
        activationApiVersion = '1.2.0'
61
62
63
        activemqVersion = '5.15.6'
        camelVersion = '2.22.1'
        commonsCompressVersion = '1.18'
Aaron Coburn's avatar
Aaron Coburn committed
64
        commonsIoVersion = '2.6'
65
66
        commonsLangVersion = '3.8'
        derbyVersion = '10.14.2.0'
Aaron Coburn's avatar
Aaron Coburn committed
67
        fcrepoCamelToolboxVersion = '4.7.2'
acoburn's avatar
acoburn committed
68
        hk2Version = '2.4.0'
69
70
71
        httpclientVersion = '4.5.6'
        httpcoreVersion = '4.4.10'
        jacksonVersion = '2.9.6'
72
        jaxbVersion = '2.3.0'
73
        jenaVersion = '3.8.0'
acoburn's avatar
acoburn committed
74
75
        junitVersion = '4.12'
        jsonldVersion = '0.8.3'
Aaron Coburn's avatar
Aaron Coburn committed
76
        logbackVersion = '1.2.3'
77
        marmottaVersion = '3.3.0'
acoburn's avatar
acoburn committed
78
79
        postgresqlVersion = '9.4.1208'
        saxonVersion = '9.6.0-7'
Aaron Coburn's avatar
Aaron Coburn committed
80
        slf4jVersion = '1.7.25'
acoburn's avatar
acoburn committed
81
82
83
        woodstoxVersion = '4.4.1'

        /* Transitive deps */
84
        fcrepoClientVersion = '0.2.1'
acoburn's avatar
acoburn committed
85

86
        /* Testing */
87
88
        paxExamVersion = '4.12.0'
        karafVersion = '4.2.1'
Aaron Coburn's avatar
Aaron Coburn committed
89
90
91
        fcrepoVersion = '4.7.5'
        osgiCompendiumVersion = '5.0.0'
        osgiCoreVersion = '6.0.0'
92

acoburn's avatar
acoburn committed
93
94
95
96
97
98
99
100
101
102
103
104
        /* OSGi */
        defaultOsgiImports = 'org.osgi.service.blueprint;version="[1,2)",*'
        projectOsgiVersion = project.version.replaceAll("-SNAPSHOT", ".SNAPSHOT")
    }

    task processConfig(type: Copy) {
        from('src/main/cfg') {
            include '**/*.cfg'
        }
        into 'build/cfg/main'
    }

acoburn's avatar
acoburn committed
105
106
107
108
109
    task sourceJar(type: Jar) {
        classifier 'sources'
        from sourceSets.main.allSource
    }

acoburn's avatar
acoburn committed
110

acoburn's avatar
acoburn committed
111
112
113
114
115
116
117
118
119
120
    task javadocJar(type: Jar) {
        classifier 'javadoc'
        from javadoc
    }

    artifacts {
        archives javadocJar
        archives sourceJar
    }

acoburn's avatar
acoburn committed
121
122
123
124
125
    classes {
        classes.dependsOn processConfig
    }

    checkstyle {
126
127
        configFile = rootProject.file('build/checkstyle/checkstyle.xml')
        configProperties.checkstyleConfigDir = rootProject.file('build/checkstyle/')
acoburn's avatar
acoburn committed
128
129
    }

acoburn's avatar
acoburn committed
130
    jacoco {
Aaron Coburn's avatar
Aaron Coburn committed
131
        toolVersion = jacocoVersion
acoburn's avatar
acoburn committed
132
133
    }

Aaron Coburn's avatar
Aaron Coburn committed
134
135
136
137
138
139
140
    jacocoTestReport {
        reports {
            xml.enabled = true
            html.enabled = true
        }
    }

acoburn's avatar
acoburn committed
141
142
    license {
        include "**/*.java"
143
        header rootProject.file('build/license/HEADER.txt')
acoburn's avatar
acoburn committed
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
        strictCheck true
        mapping {
            java = 'SLASHSTAR_STYLE'
        }
    }

    publishing {
        publications {
            maven(MavenPublication) {
                from components.java
            }
        }
    }

    signing {
        required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
        sign configurations.archives
    }

    uploadArchives {
        repositories.mavenDeployer {
            def sonatypeUsername = project.hasProperty('ossrhUsername') ? ossrhUsername : ""
            def sonatypePassword = project.hasProperty('ossrhPassword') ? ossrhPassword : ""
            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

            repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
                authentication(userName: sonatypeUsername, password: sonatypePassword)
            }

            snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
                authentication(userName: sonatypeUsername, password: sonatypePassword)
            }

            pom.project {
                packaging 'jar'
                url 'https://acdc.amherst.edu/wiki'
                inceptionYear '2015'
                name 'Amherst College Repository Extension Services'
                description 'Repository Extension Services'

                organization {
                    name project.vendor
                    url project.homepage
                }

                developers {
                    developer {
                        id 'acoburn'
                        name 'Aaron Coburn'
                        email 'acoburn @ (domain of organization url)'
                        organization 'Amherst College'
                        organizationUrl 'https://www.amherst.edu'
                        roles {
                            role 'developer'
                        }
                        timezone '-5'
                    }
                    developer {
                        id 'bseeger'
                        name 'Bethany Seeger'
                        email 'bseeger @ (domain of organization url)'
                        organization 'Amherst College'
                        organizationUrl 'https://www.amherst.edu'
                        roles {
                            role 'developer'
                        }
                        timezone '-5'
                    }
                }

                scm {
                    connection 'scm:git:git://gitlab.amherst.edu/acdc/repository-extension-services.git'
                    developerConnection 'scm:git:git@gitlab.amherst.edu:acdc/repository-extension-services.git'
                    url 'https://gitlab.amherst.edu/acdc/repository-extension-services'
                    tag 'HEAD'
                }

                licenses {
                    license {
                        name 'Apache License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0'
                        comments 'Copyright (c) 2016 Amherst College'
                    }
                }
            }
        }
    }
acoburn's avatar
acoburn committed
231

232
233
234
235
236
237
    javadoc {
        if (JavaVersion.current().isJava9Compatible()) {
            options.addBooleanOption('html5', true)
        }
    }

acoburn's avatar
acoburn committed
238
239
240
    if (project.name != 'acrepo-itests') {
        afterReleaseBuild.dependsOn uploadArchives
    }
241
242
243
244
245
246
}

configurations {
    buildToolsConfig
}

acoburn's avatar
acoburn committed
247

248
dependencies {
acoburn's avatar
acoburn committed
249
    buildToolsConfig "edu.amherst.acdc:acrepo-build-tools:0.1.0"
250
}
acoburn's avatar
acoburn committed
251

252
253
254
255
256
257
258
259
260
261
262
263
264
265
// Ignore alpha, beta, milestone and release candidates
dependencyUpdates.resolutionStrategy = {
    componentSelection { rules ->
        rules.all { ComponentSelection selection ->
            boolean rejected = ['alpha', 'beta', 'rc', 'm'].any { qualifier ->
                selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
            }
            if (rejected) {
                selection.reject("Release Candidate")
            }
        }
    }
}

266
267
268
269
270
271
272
273
task processBuildTools(type: Copy) {
    from {
        configurations.buildToolsConfig.collect {
            zipTree(it).matching {
                include 'checkstyle/*.xml'
                include 'license/*.txt'
            }
        }
acoburn's avatar
acoburn committed
274
    }
275
    into 'build'
acoburn's avatar
acoburn committed
276
}
277

acoburn's avatar
acoburn committed
278
task docs(type: Javadoc) {
acoburn's avatar
acoburn committed
279
    outputs.upToDateWhen { false }
acoburn's avatar
acoburn committed
280
281
282
    source subprojects.collect {project -> project.sourceSets.main.allJava }
    classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
    destinationDir = new File(projectDir, "docs/${version}")
acoburn's avatar
acoburn committed
283
284
285
286
287
288
    options {
        links "http://docs.oracle.com/javase/8/docs/api/"
        links "http://camel.apache.org/maven/current/camel-core/apidocs/"
        links "http://marmotta.apache.org/apidocs/"
        links "https://jena.apache.org/documentation/javadoc/jena/"
    }
acoburn's avatar
acoburn committed
289
290
}

291
check.dependsOn processBuildTools
acoburn's avatar
acoburn committed
292
afterReleaseBuild.dependsOn docs
293