-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
183 lines (162 loc) · 6.25 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
import org.jetbrains.gradle.ext.Application
import org.jetbrains.gradle.ext.GradleTask
import org.jetbrains.gradle.ext.runConfigurations
import org.jetbrains.gradle.ext.settings
import java.io.File
import java.nio.file.Files
import java.nio.file.StandardOpenOption
import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
plugins {
idea
`maven-publish`
id("groovy")
id("org.jetbrains.gradle.plugin.idea-ext") version "+"
}
group = "io.github.ultreon.craftmods"
version = "0.1.0+snapshot." + DateTimeFormatter.ofPattern("yyyy.MM.dd.HH.mm").format(Instant.now().atOffset(ZoneOffset.UTC))
repositories {
mavenCentral()
maven {
name = "UltracraftGitHub"
url = uri("https://maven.pkg.github.com/Ultreon/ultracraft")
credentials {
username = (project.findProperty("gpr.user") ?: System.getenv("USERNAME")) as String
password = (project.findProperty("gpr.key") ?: System.getenv("TOKEN")) as String
}
}
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
content {
includeGroup("space.earlygrey")
includeGroup("com.github.mgsx-dev.gdx-gltf")
includeGroup("com.github.Ultreon")
includeGroup("com.github.jagrosh")
includeGroup("com.github.JnCrMx")
}
}
maven("https://maven.fabricmc.net/")
}
configurations {
create("include") {
isCanBeResolved = true
}
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation("io.github.ultreon.craft:ultracraft-desktop:0.1.0+snapshot.2024.03.24.23.50")
configurations["include"](compileOnly("org.apache.groovy:groovy:4.0.14")!!)
}
tasks.test {
useJUnitPlatform()
}
fun setupIdea() {
mkdir("$projectDir/build/gameutils")
mkdir("$projectDir/run")
mkdir("$projectDir/run/client")
mkdir("$projectDir/run/client/alt")
mkdir("$projectDir/run/client/main")
mkdir("$projectDir/run/server")
val ps = File.pathSeparator!!
val files = configurations["runtimeClasspath"]!!
val classPath = files.asSequence()
.filter { it != null }
.map { it.path }
.joinToString(ps)
//language=TEXT
val conf = """
commonProperties
fabric.development=true
log4j2.formatMsgNoLookups=true
fabric.log.disableAnsi=false
log4j.configurationFile=$projectDir/log4j.xml
""".trimIndent()
val launchFile = file("$projectDir/build/gameutils/launch.cfg")
Files.writeString(
launchFile.toPath(),
conf,
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE
)
val cpFile = file("$projectDir/build/gameutils/classpath.txt")
Files.writeString(
cpFile.toPath(),
classPath,
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE
)
idea {
project {
settings {
withIDEADir {
println("Callback 1 executed with: $absolutePath")
}
runConfigurations {
create(
"Ultracraft Client",
Application::class.java
) { // Create new run configuration "MyApp" that will run class foo.App
jvmArgs =
"-Xmx4g -Dfabric.skipMcProvider=true -Dfabric.dli.config=${launchFile.path} -Dfabric.dli.env=CLIENT -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotClient -Dfabric.zipfs.use_temp_file=false"
mainClass = "net.fabricmc.devlaunchinjector.Main"
moduleName = idea.module.name + ".main"
workingDirectory = "$projectDir/run/client/main/"
programParameters = "--gameDir=."
}
create(
"Ultracraft Client Alt",
Application::class.java
) { // Create new run configuration "MyApp" that will run class foo.App
jvmArgs =
"-Xmx4g -Dfabric.skipMcProvider=true -Dfabric.dli.config=${launchFile.path} -Dfabric.dli.env=CLIENT -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotClient -Dfabric.zipfs.use_temp_file=false"
mainClass = "net.fabricmc.devlaunchinjector.Main"
moduleName = idea.module.name + ".main"
workingDirectory = "$projectDir/run/client/alt/"
programParameters = "--gameDir=."
}
create(
"Ultracraft Server",
Application::class.java
) { // Create new run configuration "MyApp" that will run class foo.App
jvmArgs =
"-Xmx4g -Dfabric.skipMcProvider=true -Dfabric.dli.config=${launchFile.path} -Dfabric.dli.env=SERVER -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotClient -Dfabric.zipfs.use_temp_file=false"
mainClass = "net.fabricmc.devlaunchinjector.Main"
moduleName = idea.module.name + ".main"
workingDirectory = "$projectDir/run/server/"
programParameters = "--gameDir=."
}
}
}
}
}
rootProject.idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
}
this.setupIdea()
publishing {
publications {
create("mavenGroovy", MavenPublication::class) {
//noinspection GrUnresolvedAccess
from(components["java"])
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Ultreon/ultracraft-groovy")
credentials {
username = (project.findProperty("gpr.user") ?: System.getenv("USERNAME")) as String
password = (project.findProperty("gpr.key") ?: System.getenv("TOKEN")) as String
}
}
}
}