-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
128 lines (97 loc) · 3.05 KB
/
build.gradle
File metadata and controls
128 lines (97 loc) · 3.05 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
plugins {
id "application"
}
repositories {
ivy {
name "Cosmic Reach"
url "https://github.com/CRModders/CosmicArchive/raw/main/versions"
patternLayout {
artifact "[classifier]/Cosmic Reach-[revision].jar"
}
// This is required in Gradle 6.0+ as metadata file (ivy.xml) is mandatory
metadataSources {
artifact()
}
content {
includeModule "finalforeach", "cosmicreach"
}
}
maven {
name "JitPack"
url "https://jitpack.io"
}
maven {
name "Quilt"
url "https://maven.quiltmc.org/repository/release"
}
maven {
name "Fabric"
url "https://maven.fabricmc.net/"
}
maven {
name "Sponge"
url "https://repo.spongepowered.org/maven/"
}
mavenCentral()
}
configurations {
cosmicreach // Config to provide the Cosmic Reach project
compileOnly.extendsFrom(cosmicreach) // Allows cosmic reach to be used in the codebase
internal { // Allows to include something without it being in the maven (recommended to be used when including mods)
visible = false
canBeConsumed = false
canBeResolved = false
}
compileClasspath.extendsFrom(internal)
runtimeClasspath.extendsFrom(internal)
testCompileClasspath.extendsFrom(internal)
testRuntimeClasspath.extendsFrom(internal)
}
dependencies {
// Cosmic Reach jar
cosmicreach "finalforeach:cosmicreach:${cosmic_reach_version}:pre-alpha"
// Cosmic Quilt
internal "org.codeberg.CRModders:cosmic-quilt:${cosmic_quilt_version}"
}
processResources {
def resourceTargets = [ // Locations of where to inject the properties
"quilt.mod.json"
]
// Left item is the name in the target, right is the varuable name
def replaceProperties = [
"mod_version" : project.version,
"mod_group" : project.group,
"mod_name" : project.name,
"mod_id" : id,
]
inputs.properties replaceProperties
replaceProperties.put "project", project
filesMatching(resourceTargets) {
expand replaceProperties
}
}
application {
// As Quilt is our loader, use its main class at:
mainClass = "org.quiltmc.loader.impl.launch.knot.KnotClient"
}
applicationDefaultJvmArgs = [
"-Dloader.development=true", // Allows stuff to be found through the classpath
"-Dloader.gameJarPath=" + configurations.cosmicreach.asPath, // Defines path to Cosmic Reach
]
run {
// To run this project in the game, depend on the creation of jar task
dependsOn "jar"
// Change the run directory
File runningDir = new File("run/")
if (!runningDir.exists()) {
runningDir.mkdirs()
}
tasks.run.workingDir = runningDir
}
java {
withSourcesJar()
// withJavadocJar() // If docs are included with the project, this line can be un-commented
// Sets the Java version
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}