-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
85 lines (76 loc) · 2.4 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
import gradlebuild.ZigBuild
plugins {
id("fpgradle-minecraft") version("0.8.3")
id("gradlebuild.zig")
}
group = "mega"
minecraft_fp {
java {
compatibility = jabel
}
mod {
modid = "megatrace"
name = "MEGATrace"
rootPkg = "$group.trace"
}
mixin {
pkg = "mixin.mixins" //optional
pluginClass = "mixin.plugin.MixinPlugin" //optional, requires pkg set
}
tokens {
tokenClass = "Tags"
}
publish {
changelog = "https://github.com/GTMEGA/MEGATrace/releases/tag/${version}"
maven {
repoUrl = "https://mvn.falsepattern.com/gtmega_releases/"
repoName = "mega"
}
}
}
repositories {
exclusive(mavenpattern(), "com.falsepattern")
}
dependencies {
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.5.4")
}
val zigOutDir = layout.buildDirectory.dir("zig")
zig {
zigVersion = "0.14.0-dev.2435+7575f2121"
outputDir = zigOutDir
targets {
create("x86_64-linux-gnu")
create("aarch64-linux-gnu")
create("x86_64-windows-gnu")
// create("aarch64-windows-gnu") TODO tracy is unhappy on this triple
// create("x86_64-macos-none") TODO MacOS
}.configureEach {
optimizer = "ReleaseSmall"
sources.from(layout.projectDirectory.dir("src/main/zig"))
sources.from(layout.projectDirectory.dir("build.zig"))
sources.from(layout.projectDirectory.dir("build.zig.zon"))
}
}
tasks.withType<ZigBuild>().all {
val zigBuild = this
val isWindows = zigBuild.target.map { it.contains("windows") }
val zigClean = tasks.register<Delete>("zigClean${zigBuild.name.removePrefix("zigBuild")}")
zigBuild.dependsOn(zigClean)
val mod = minecraft_fp.mod;
extraArgs.add(mod.modid.map { "-Dmod_id=$it" })
extraArgs.add(mod.name.map { "-Dmod_name=$it" })
extraArgs.add(mod.version.map { "-Dmod_version=$it" })
extraArgs.add(mod.rootPkg.map { "-Droot_pkg=$it" })
extraArgs.add("-Dstrip")
zigClean.configure {
group = "zig"
delete(zigBuild.outputDirectory)
}
tasks.named<ProcessResources>("processResources") {
into("/natives") {
from(zigBuild.outputDirectory.dir(isWindows.map { if (it) "bin" else "lib" }))
include("*.dll", "*.so")
rename("(\\w+)\\.(dll|so)", "$1-${zigBuild.target.get()}.$2")
}
}
}