forked from SteinGaming/Vextension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
216 lines (201 loc) · 8.08 KB
/
build.gradle.kts
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
classpath("com.github.jengelman.gradle.plugins:shadow:6.1.0")
}
}
//Define Plugins
plugins {
id("java")
id("maven-publish")
id("com.github.johnrengelman.shadow") version "6.1.0"
kotlin("jvm") version "1.6.20"
id("org.jetbrains.dokka") version "1.4.20"
}
//Configure build of docs
tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(File(rootProject.buildDir.path, "vextension-v2.0.0"))
}
//Define Variables for all Projects
allprojects {
//Define Repositorys
repositories {
for (field in Repositories::class.java.declaredFields) {
if (field.name != "INSTANCE") {
println("Added Repository: " + field.get(null))
maven(field.get(null))
}
}
}
//Define Version and Group
this.group = Properties.group
this.version = Properties.version
}
//Default configuration for each module
subprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.dokka")
//Define Dependencies for all Modules
dependencies {
implementation(getDependency("kotlin", "stdlib"))
implementation(getDependency("kotlin", "serialization"))
implementation(getDependency("kotlinx", "coroutines-core"))
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
java {
withSourcesJar()
}
if (System.getProperty("publishName") != null && System.getProperty("publishPassword") != null) {
publishing {
(components["java"] as AdhocComponentWithVariants).withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
publications {
create<MavenPublication>(project.name) {
groupId = Properties.group
artifactId = project.name
version = Properties.version
from(components["java"])
pom {
name.set(project.name)
url.set("https://github.com/VironLab/Vextension")
properties.put("inceptionYear", "2021")
licenses {
license {
name.set("General Public License (GPL v3.0)")
url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("Infinity_dev")
name.set("Florin Dornig")
email.set("infinitydev@vironlab.eu")
}
developer {
id.set("SteinGaming")
name.set("Danial Daryab")
email.set("steingaming@vironlab.eu")
}
}
}
}
repositories {
maven("https://repo.neverstopgaming.net/private/") {
this.name = "nsg-private"
credentials {
this.password = System.getProperty("publishPassword")
this.username = System.getProperty("publishName")
}
}
}
}
}
}
tasks {
//test {
// useJUnitPlatform()
//}
//Set the Name of the Sources Jar
kotlinSourcesJar {
archiveFileName.set("${project.name}-${Properties.version}-${getCommitHash()}-sources.jar")
destinationDirectory.set(file("$projectDir/../out"))
doFirst {
//Set Manifest
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = Properties.version
attributes["Specification-Version"] = Properties.version
attributes["Implementation-Vendor"] = "VironLab.eu"
attributes["Built-By"] = System.getProperty("user.name")
attributes["Build-Jdk"] = System.getProperty("java.version")
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["VironLab-AppId"] = "vextension"
attributes["Commit-Hash"] = getCommitHash()
}
}
}
shadowJar {
//Set the Name of the Output File
archiveFileName.set("${project.name}-${Properties.version}-${getCommitHash()}-full.jar")
destinationDirectory.set(file("$projectDir/../out"))
exclude("META-INF/**")
//Include Commons
if (project.name != "vextension-common") {
dependsOn(":vextension-common:build")
val buildDir = project(":vextension-common").buildDir.path
from("$buildDir/classes/java/main") {
include("**")
}
from("$buildDir/classes/kotlin/main") {
include("**")
}
from("$buildDir/resources/main") {
include("**")
}
}
doFirst {
//Set Manifest
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = Properties.version
attributes["Specification-Version"] = Properties.version
attributes["Implementation-Vendor"] = "VironLab.eu"
attributes["Built-By"] = System.getProperty("user.name")
attributes["Build-Jdk"] = System.getProperty("java.version")
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["VironLab-AppId"] = "vextension"
attributes["Commit-Hash"] = getCommitHash()
}
}
}
jar {
archiveFileName.set("${project.name}-${Properties.version}-${getCommitHash()}.jar")
destinationDirectory.set(file("$projectDir/../out"))
doFirst {
//Set Manifest
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = Properties.version
attributes["Specification-Version"] = Properties.version
attributes["Implementation-Vendor"] = "VironLab.eu"
attributes["Built-By"] = System.getProperty("user.name")
attributes["Build-Jdk"] = System.getProperty("java.version")
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["VironLab-AppId"] = "vextension"
attributes["Commit-Hash"] = getCommitHash()
}
}
//Include Commons
if (project.name != "vextension-common") {
dependsOn(":vextension-common:build")
val buildDir = project(":vextension-common").buildDir.path
from("$buildDir/classes/java/main") {
include("**")
}
from("$buildDir/classes/kotlin/main") {
include("**")
}
from("$buildDir/resources/main") {
include("**")
}
}
}
compileKotlin {
kotlinOptions.jvmTarget = "17"
}
compileJava {
}
withType<JavaCompile> {
this.options.encoding = "UTF-8"
}
}
}