-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.upload
122 lines (106 loc) · 3.1 KB
/
build.upload
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
apply from: 'build.shared'
apply plugin: 'maven-publish'
apply plugin: 'signing'
sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
maxParallelForks = Math.max(1, (int)(Runtime.getRuntime().availableProcessors() / 2))
}
test.dependsOn("jar")
def findJVM() {
String[] java8Paths = new String[5]
java8Paths[0] = "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/"
java8Paths[1] = "/usr/lib/jvm/java-8-openjdk/jre/lib/"
java8Paths[2] = "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/"
java8Paths[3] = "/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/"
java8Paths[4] = "/usr/lib/jvm/java-8-sun/jre/lib/"
for (String path : java8Paths) {
if (new java.io.File(path).exists()) {
return path
}
}
return null
}
compileJava {
def jvmPath = findJVM()
if (jvmPath == null) {
println 'Unable to find java 8 rt.jar, will cause failure so exiting now'
println ''
System.exit(1)
}
println 'Using java 8: ' + jvmPath
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: jvmPath)
}
compileTestJava {
options.compilerArgs << "-Xlint:all" << "-Xlint:-deprecation" << "-Werror"
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: findJVM())
}
signing {
sign configurations.archives
if (! version.contains('SNAPSHOT')) {
sign publishing.publications
}
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'Threadly'
description = 'A library of tools to assist with safe concurrent java development.'
url = 'http://threadly.org/'
scm {
url = 'scm:git@github.com:threadly/threadly.git'
connection = 'scm:git@github.com:threadly/threadly.git'
developerConnection = 'scm:git@github.com:threadly/threadly.git'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/threadly/threadly/issues'
}
licenses {
license {
name = 'Mozilla Public License Version 2.0'
url = 'https://www.mozilla.org/MPL/2.0/'
distribution = 'repo'
}
}
developers {
developer {
id = 'jent'
name = 'Mike Jensen'
email = 'jent@threadly.org'
}
}
}
from components.java
artifact(sourcesJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}