-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
144 lines (121 loc) · 4.02 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
plugins {
id 'java'
id "signing"
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
version = "${project_version}" + (isSnapshot() ? '+' + getBuildNumber() : '')
description = 'An API lib to make requests to NodeCDN'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation group: 'io.github.openfeign', name: 'feign-okhttp', version: '11.2'
implementation group: 'io.github.openfeign', name: 'feign-gson', version: '11.2'
implementation group: 'io.github.openfeign', name: 'feign-slf4j', version: '11.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.2'
testImplementation group: 'io.github.openfeign', name: 'feign-mock', version: '11.2'
}
//test {
// useJUnitPlatform()
//}
task sourcesJar(type: Jar, dependsOn: classes) {
description = 'Creates a JAR containing the source code.'
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
description = 'Creates a JAR containing the JavaDocs.'
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}
artifacts {
archives sourcesJar
archives javadocJar
}
jar {
manifest {
attributes([
'Timestamp' : System.currentTimeMillis(),
'Specification-Title' : project.archivesBaseName,
'Specification-Vendor' : project.vendor,
'Specification-Version' : project.version,
'Implementation-Title' : project.archivesBaseName,
'Implementation-Version' : project.version,
'Implementation-Vendor' : project.vendor,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})"
])
}
}
gradle.taskGraph.whenReady { taskGraph ->
ext."signing.gnupg.keyName" = "A35B3CEC"
}
signing {
useGpgCmd()
sign configurations.archives
}
tasks.withType(Sign) {
onlyIf { !isSnapshot() }
}
nexusPublishing {
packageGroup = "com.diluv"
repositories {
sonatype {
stagingProfileId = "1282c5e0d73bd2"
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
transitionCheckOptions {
maxRetries.set(40)
delayBetween.set(java.time.Duration.ofMillis(5000))
}
}
publishing {
publications {
mavenJava(MavenPublication) {
group = project.group
artifactId = project.name
version = project.version
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = project.name
description = project.description
url = 'https://github.com/Diluv/NodeCDN-Api'
scm {
connection = 'scm:git:git://github.com/Diluv/NodeCDN-Api.git'
developerConnection = 'scm:git:ssh://github.com/Diluv/NodeCDN-Api.git'
url = 'https://github.com/Diluv/NodeCDN-Api'
}
licenses {
license {
name = 'GNU Lesser General Public License v2.1'
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
}
}
developers {
developer {
id = 'lclc98'
name = 'lclc98'
email = '[email protected]'
}
}
}
}
}
}
static String getBuildNumber() {
return System.getenv("GITHUB_RUN_NUMBER") ?: "0"
}
static boolean isSnapshot() {
String ref = System.getenv("GITHUB_REF");
if (ref != null && ref.startsWith("refs/tags/v")) {
return false
}
return true
}