forked from AscertLLC/openterm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
146 lines (122 loc) · 4.77 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
/*
* This build file was auto generated by running the Gradle 'init' task
* by 'robw' at '21/12/16 15:04' with Gradle 3.2.1
*
*/
ext {
dev_id = 'walkerr'
dev_name = 'Rob Walker'
dev_email = 'robw@ascert.com'
dev_organization = 'Ascert LLC'
dev_organizationUrl = 'http://www.ascert.com'
gpl_name = 'GNU Library General Public License version 2'
gpl_url = 'https://github.com/AscertLLC/openterm/blob/master/LICENSE'
// Make sure we have a default for initial configuration evaluation
isReleaseVersion = false
java_release = project.findProperty('java_release') ?: 1.8
}
allprojects {
repositories {
// Usual ones
mavenCentral()
jcenter()
}
group = "com.ascert.open"
// When it comes to publishing we need to ensure we have the subproject version set
// rather than the root project version
afterEvaluate { project ->
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
// In theory these are deprecated, but the options.release form does not allow --add-exports
// (see https://bugs.openjdk.org/browse/JDK-8178152)
sourceCompatibility = "${java_release}"
targetCompatibility = "${java_release}"
dependencies {
testImplementation group: 'junit', name: 'junit', version: '[4,)'
}
javadoc {
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
}
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
/*
*
* The signing and publishing tasks below are only needed for OSSRH publishing, and will
* require configuration of approriate signing and repository credentials. They should not
* impact local R&D work in any way though, and normal local publishing can be used without any
* setup e.g.
*
* gradle publishToMavenLocal
*/
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
//artifactId = project.artifactId // or maybe archiveBaseName?
from components.java
pom {
name = project.description
url = "https://github.com/AscertLLC/openterm"
packaging = "jar"
licenses {
license {
name = "${gpl_name}"
url = "${gpl_url}"
}
}
developers {
developer {
id = "${dev_id}"
name = "${dev_name}"
email = "${dev_email}"
organization = "${dev_organization}"
organizationUrl = "${dev_organizationUrl}"
}
}
scm {
connection = 'https://github.com/AscertLLC/openterm.git'
developerConnection = 'scm:git:ssh://git@github.com/AscertLLC/openterm.git'
url = 'https://github.com/AscertLLC/openterm'
}
}
}
}
repositories {
maven {
afterEvaluate { project ->
def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
url = (isReleaseVersion) ? releaseRepo : snapshotRepo
//println "repos: " + version
//println "repos: " + isReleaseVersion
//println url
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
}
}
}
}
}
signing {
afterEvaluate { project ->
//println "sign: " + version
//println "sign: " + isReleaseVersion
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}
}
}