-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
89 lines (74 loc) · 1.96 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
plugins {
id 'java'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '5.2.0'
}
group 'com.zvyap'
version = "${getProjectVersion()}"
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
implementation 'org.jetbrains:annotations:24.0.1'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
tasks.withType(Test) {
enabled = System.getenv('GLOBAL_TOKEN') != null && System.getenv('GLOBAL_TOKEN_ID') != null
}
test {
systemProperty 'GLOBAL_TOKEN', System.getenv("GLOBAL_TOKEN")
systemProperty 'GLOBAL_TOKEN_ID', System.getenv("GLOBAL_TOKEN_ID")
useJUnitPlatform()
}
jar.mustRunAfter clean
publishToMavenLocal.dependsOn jar
// called by jitpack
task install {
dependsOn test
dependsOn publishToMavenLocal
doLast {
println 'Version: ' + version
}
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
task version() {
doFirst {
println getProjectVersion()
}
}
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId 'com.github.zvyap'
artifactId "Hoyoverse-API"
version project.version
}
}
}
}
String getProjectVersion() {
if(grgit == null) { //No git found
return "LOCAL"
}
def headTag = grgit.tag.list().find {
it.commit == grgit.head()
}
def clean = grgit.status().clean
if (headTag && clean) {
headTag.getName()
} else {
"${grgit.head().id}-SNAPSHOT"
}
}