-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
121 lines (104 loc) · 3.19 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
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
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 buildProjects = allprojects.findAll { project -> project.path.equals(':build-support') }
// Java projects are all those that aren't in the previous collections.
def javaProjects = subprojects.findAll { project -> !buildProjects.contains(project) }
// Apply common project configuration
subprojects {
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
// All projects use a common group id.
group = 'io.github.igorgatis'
// Load the project version dynamically from Git. For release builds, don't add a suffix.
def versionSuffix = "RELEASE".equals(settingsBuildType) ? '' : '-' + settingsBuildType
version = 'git describe --always --dirty --tags'.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: 'maven-publish'
apply plugin: 'signing'
sourceCompatibility = 1.8
dependencies {
testImplementation 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(settingsSigningEnabled)
}
// Configure the maven-publish plugin to upload artifacts to the Sonatype repository.
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = project.name
packaging = 'jar'
description = 'Spark data source for OpenStreetMap Protobuf files.'
url = 'https://github.com/igorgatis/spark-osmpbf'
scm {
connection = 'scm:git:git://github.com/igorgatis/spark-osmpbf.git'
developerConnection = 'scm:git:ssh://[email protected]/igorgatis/spark-osmpbf.git'
url = 'https://github.com/igorgatis/spark-osmpbf'
}
licenses {
license {
name = 'Public Domain'
}
}
developers {
developer {
id = 'igorgatis'
name = 'Igor Gatis'
email = '[email protected]'
}
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = "RELEASE".equals(settingsBuildType) ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
}