forked from openstreetmap/osmosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
134 lines (114 loc) · 3.89 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
task wrapper(type: Wrapper) {
gradleVersion = '4.2'
}
apply plugin: 'idea'
/* Build collections containing each type of project. These collections will
* be used to apply common configurations to projects of the same type.
*/
def packageProjects = allprojects.findAll { project -> project.path.equals(':package') }
def buildProjects = allprojects.findAll { project -> project.path.equals(':build-support') }
def dockerProjects = allprojects.findAll { project -> project.path.equals(':db-server') }
// Java projects are all those that aren't in the previous collections.
def javaProjects = subprojects.findAll { project -> !packageProjects.contains(project) && !buildProjects.contains(project) && !dockerProjects.contains(project) }
// Apply common project configuration
subprojects {
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
// All projects use a common group id.
group = 'org.openstreetmap.osmosis'
// Load the project version dynamically from Git. For release builds, don't add a suffix.
def versionSuffix = "RELEASE".equals(osmosisBuildType) ? '' : '-' + osmosisBuildType
version = 'git describe --always --dirty'.execute().in.text.trim() + versionSuffix
// Enable access to artefact dependency repositories.
repositories {
// Standard Maven repository.
mavenCentral()
}
}
// Apply common configurations to all projects supporting Java.
configure(javaProjects) {
apply plugin: 'checkstyle'
apply plugin: 'java'
apply plugin: 'jdepend'
apply plugin: 'maven'
apply plugin: 'signing'
sourceCompatibility = 1.8
test {
/*
* Pass on each of our custom properties to the unit tests if they have
* been provided.
*/
['db.apidb.authfile', 'db.pgsql.authfile'].each {
propName ->
if (System.getProperties().containsKey(propName)) {
jvmArgs '-D' + propName + '=' + System.getProperty(propName)
}
}
//testLogging.showStandardStreams = true
}
dependencies {
testCompile group: 'junit', name: 'junit', version: dependencyVersionJunit
}
checkstyle {
configFile = new File(rootDir, 'build-support/checkstyle.xml')
configProperties.samedir = configFile.parentFile
}
// Build javadoc and source jars and include in published artifacts.
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
// Sign all published artifacts if signing is enabled.
signing {
sign configurations.archives
required = Boolean.valueOf(osmosisSigningEnabled)
}
// Configure the maven plugin to upload artefacts to the Sonatype repository.
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// We upload to the Sonatype SNAPSHOT repository unless it is a release build in
// which case we upload to the staging repository.
def sonatypeRepoUrl = "RELEASE".equals(osmosisBuildType) ?
'https://oss.sonatype.org/service/local/staging/deploy/maven2/' :
'https://oss.sonatype.org/content/repositories/snapshots/'
repository(url: sonatypeRepoUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name project.name
packaging 'jar'
description 'Osmosis is a Java application and library for processing OSM data.'
url 'http://wiki.openstreetmap.org/wiki/Osmosis'
scm {
url 'https://github.com/openstreetmap/osmosis'
connection 'scm:git:git://github.com/openstreetmap/osmosis.git'
developerConnection 'scm:git:ssh://git@github.com/openstreetmap/osmosis.git'
}
licenses {
license {
name 'Public Domain'
}
}
developers {
developer {
id 'brett'
name 'Brett Henderson'
email 'brett@bretth.com'
}
}
}
}
}
}
}