Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (141 loc) · 5.36 KB
/
Copy pathbuild.gradle
File metadata and controls
165 lines (141 loc) · 5.36 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
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
configure(
subprojects.findAll {
it.parent == rootProject && !it.name.startsWith("modules")
}
) {
apply plugin: 'java'
group = $group
version = $version
tasks.withType(Jar).configureEach {
archiveBaseName.set("${$modBaseName}")
}
configurations {
library
implementation.extendsFrom library
}
dependencies {
library 'com.github.JnCrMx:discord-game-sdk4j:v0.5.5'
library 'com.fasterxml.jackson.core:jackson-core:2.8.8'
library 'com.fasterxml.jackson.core:jackson-annotations:2.8.8'
library 'com.fasterxml.jackson.core:jackson-databind:2.8.8'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
if (project.name != "common") {
library project(":common")
}
}
repositories {
mavenCentral()
maven { url = "https://jitpack.io" }
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}
}
test {
useJUnitPlatform()
}
jar {
manifest {
attributes([
"Specification-Title" : $modBaseName,
"Specification-Vendor" : $vendor,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : $modBaseName,
"Implementation-Version" : $version,
"Implementation-Vendor" : $vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
if (project.name != "common") {
//destinationDirectory = rootProject.buildDir
doFirst {
archiveClassifier = project.name
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
with copySpec {
from {
configurations.library.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
}
from {
"../LICENSE"
"${project(":common").compileJava.temporaryDir}${File.separator}classes.txt"
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(project.properties.getOrDefault("jdkVersion", 17) as int)
}
}
tasks.withType(JavaExec).configureEach {
if (project.name != "common") {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
}
tasks.withType(JavaCompile).configureEach {
int jdkVersion = project.properties.getOrDefault("jdkVersion", 17) as int
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
if (jdkVersion >= 9)
options.release.set(jdkVersion)
options.encoding = 'UTF-8'
}
if (project.name != "common") {
project.afterEvaluate {
if (project.tasks.findByName('remapJar')) {
remapJar {
inputFile.set project.jar.archiveFile
destinationDirectory = file("${rootProject.buildDir}/libs")
dependsOn project.jar
archiveFileName = project.jar.archiveFileName
}
} else {
jar {
doLast {
copy {
from archiveFile.get().asFile
into "${rootProject.buildDir}/libs"
}
}
}
}
// Fix unimined runs bug
afterEvaluate {
def runClientTask = project.tasks.findByName('runClient')
if (runClientTask != null) {
runClientTask.doFirst {
var classPathFile = null
if (project.name.startsWith("forge")) classPathFile = "legacy_classpath"
if (project.name.startsWith("fabric")) classPathFile = "remapClasspath"
if (classPathFile != null) {
logger.lifecycle("Fixing ${classPathFile}")
copy {
from "${rootProject.buildDir}/unimined/classpaths/${classPathFile}-${project.name}.txt"
into "${rootProject.buildDir}/unimined"
rename { "${classPathFile}.txt" }
}
}
}
}
var classPathFile = null
if (project.name.startsWith("forge")) classPathFile = "legacy_classpath"
if (project.name.startsWith("fabric")) classPathFile = "remapClasspath"
if (classPathFile != null) {
logger.lifecycle("Saving ${classPathFile} for project: ${project.name}")
copy {
from "${rootProject.buildDir}/unimined/${classPathFile}.txt"
into "${rootProject.buildDir}/unimined/classpaths"
rename { "${classPathFile}-${project.name}.txt" }
}
}
}
}
}
}