-
Notifications
You must be signed in to change notification settings - Fork 5
/
sonatype.gradle
154 lines (141 loc) · 4.86 KB
/
sonatype.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
145
146
147
148
149
150
151
152
153
154
/*
* Base58 library, a Java implementation of Base58 encode/decode
*
* Copyright (C) 2017-2022 Alan Evans, NovaCrypto
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Original source: https://github.com/NovaCrypto/Base58
* You can contact the authors via github issues.
*/
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'jacoco'
java {
withJavadocJar()
withSourcesJar()
}
jacoco {
toolVersion = '0.8.7'
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = false
}
}
check.dependsOn jacocoTestReport
dependencyUpdates {
resolutionStrategy {
componentSelection { rules ->
rules.all { selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
outputFormatter = { result ->
if (!result.outdated.dependencies.isEmpty()) {
throw new RuntimeException('Abort, there are dependencies to update.')
}
}
}
task('installSharedIdea', type: Copy) {
description = 'Copy the shared intellij files into local .idea/'
group = 'Bootstrap IDE'
from 'ideaShared/'
into '.idea/'
}
def hasMavenCentralCredentials = hasProperty('ossrhUsername')
def hasSigningDetails = hasProperty('signing.keyId')
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'io.github.novacrypto'
artifactId = project.name
version = '2022.01.17'
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = project.name
description = project.description
url = "https://github.com/NovaCrypto/${project.name}"
licenses {
license {
name = 'GNU General Public License v3'
url = 'https://www.gnu.org/licenses/gpl-3.0.html'
}
}
developers {
developer {
id = 'westonal'
name = 'Alan Evans'
email = 'thealanevans@gmail.com'
}
}
scm {
connection = "scm:git:git://github.com/NovaCrypto/${project.name}.git"
developerConnection = "scm:git:ssh://github.com/NovaCrypto/${project.name}.git"
url = "https://github.com/NovaCrypto/${project.name}"
}
}
}
}
if (hasMavenCentralCredentials) {
repositories {
maven {
def stagingRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
def staging = !version.endsWith('SNAPSHOT')
url = staging ? stagingRepoUrl : snapshotsRepoUrl
tasks.create('displayPublishLocation') {
doLast {
println("Publishing $version to${staging ? " staging" : ""} $url")
if (staging) {
println("You will need to promote to a release at https://s01.oss.sonatype.org/#stagingRepositories")
}
}
}
credentials {
// defined in the global local gradle.properties
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}
afterEvaluate {
if (hasMavenCentralCredentials) {
publish.dependsOn(displayPublishLocation)
}
}
if (hasSigningDetails) {
signing {
sign publishing.publications.mavenJava
}
}
check.dependsOn(dependencyUpdates)
generatePomFileForMavenJavaPublication.dependsOn(check)