-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (111 loc) · 3.42 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
import java.nio.file.Files
plugins {
id 'signing'
id 'java-library'
id 'maven-publish'
id('io.github.gradle-nexus.publish-plugin') version '1.1.0'
}
group 'io.github.fabricio20'
version '1.4.0'
description 'A Java event framework'
sourceCompatibility = targetCompatibility = 8
repositories {
mavenCentral()
}
dependencies {
implementation('org.slf4j:slf4j-api:2.0.3')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.1')
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.9.1')
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
// -- Library build settings
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
baseName = project.name
manifest {
attributes 'Implementation-Version': version
}
}
javadoc {
failOnError = true
options.memberLevel = JavadocMemberLevel.PUBLIC
options.author()
options.encoding = 'UTF-8'
}
// -- Maven Central & GitHub Packages Publishing
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = project.findProperty("sonatype.user") ?: System.getenv("SONATYPE_USER")
password = project.findProperty("sonatype.pass") ?: System.getenv("SONATYPE_PASS")
}
}
}
publishing {
repositories {
maven {
name = "GitHub"
url = uri("https://maven.pkg.github.com/Fabricio20/Eventti")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = 'Eventti'
description = 'A Java event framework'
url = 'https://github.com/Fabricio20/Eventti'
licenses {
license {
name = 'MIT'
url = 'https://github.com/Fabricio20/Eventti/blob/master/LICENSE'
}
}
developers {
developer {
id = 'Fabricio20'
name = 'Fabricio W'
}
}
scm {
url = 'https://github.com/Fabricio20/Eventti'
connection = 'scm:git://github.com/Fabricio20/Eventti.git'
developerConnection = 'scm:git://github.com/Fabricio20/Eventti.git'
}
}
}
}
}
String getSigningKey() {
def signingKey
def file = project.findProperty("singing.secretKeyFile")
if (file != null && new File(file).exists()) {
signingKey = new String(Files.readAllBytes(new File(file).toPath()))
} else {
signingKey = project.findProperty("signing.key") ?: System.getenv("GPG_KEY")
}
return signingKey
}
def singingKey = getSigningKey()
signing {
def signingPassword = project.findProperty("signing.password") ?: System.getenv("GPG_PASSWORD")
useInMemoryPgpKeys(singingKey, signingPassword)
sign publishing.publications.mavenJava
}