-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
134 lines (112 loc) · 3.22 KB
/
build.gradle
File metadata and controls
134 lines (112 loc) · 3.22 KB
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
buildscript {
repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
maven {
url = 'https://repo.mattmalec.com/repository/releases'
}
maven {
url = "https://maven.mangorage.org/releases"
}
}
dependencies {
classpath 'com.gradleup.shadow:shadow-gradle-plugin:+'
}
}
plugins {
id 'java'
}
apply plugin: 'maven-publish'
apply plugin: 'com.gradleup.shadow'
group = 'org.mangorage'
version = getLatestGitTag() + "." + getLatestGitVersion()
println("Version -> " + version)
def getLatestGitTag() {
def result = "git describe --long --tags".execute().text.trim()
if (result.empty) {
throw new RuntimeException("Failed to retrieve commit count")
} else {
return result.split("-")[0]
}
}
def getLatestGitVersion() {
def result = "git describe --long --tags".execute().text.trim()
if (result.empty) {
throw new RuntimeException("Failed to retrieve commit count")
} else {
def commitCount = result.split("-")[1].toInteger()
return commitCount;
}
}
repositories {
mavenCentral()
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
implementation("com.google.code.gson:gson:2.10.1")
shadow('com.google.code.gson:gson:2.10.1')
}
test {
useJUnitPlatform()
}
task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
jar {
manifest {
attributes(
'Main-Class': 'org.mangorage.bootstrap.Bootstrap',
'ModuleMainClass': 'org.mangorage.bootstrap.Bootstrap'
)
}
}
shadowJar {
group "main tasks"
archiveClassifier.set('')
excludes.remove('module-info.class')
relocate('com.google.gson', 'mangobot.bootstrap.internal.shaded.com.google.gson')
relocate('joptsimple', 'mangobot.bootstrap.internal.shaded.joptsimple')
}
tasks.register('runMain', JavaExec) {
group = 'application'
description = 'Runs the main class.'
classpath = sourceSets.main.runtimeClasspath
mainClass.set('org.mangorage.bootstrap.Bootstrap') // replace this garbage with your actual main class
}
publishing {
publications.register("mangobotaddon", MavenPublication) {
artifactId = 'mangobotbootstrap'
artifact shadowJar
artifact sourcesJar
pom {
name = 'MangoBotCore'
description = 'The Main Plugin For MangoBot'
url = 'https://github.com/MangoRageBot/MangoBot'
issueManagement {
system = 'github'
url = 'https://github.com/MangoRageBot/MangoBot/issues'
}
developers {
developer {
id = 'mangorage'
name = 'MangoRage'
}
}
}
}
repositories {
maven {
url = "https://maven.mangorage.org/releases"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}