-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathbuild.gradle
112 lines (96 loc) · 3.7 KB
/
build.gradle
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
plugins {
id "vfp.base-conventions"
}
base {
archivesName = "ViaFabricPlus"
}
loom {
accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener")
}
configurations {
jij // jar in jar configuration
modJij // jar in jar configuration for mods
include.extendsFrom modJij
modImplementation.extendsFrom modJij
modCompileOnlyApi.extendsFrom modJij
// Include VV dependencies as jij
jij.extendsFrom vvDependencies
}
dependencies {
// Fabric API
modJij fabricApi.module("fabric-api-base", project.fabric_api_version)
modJij fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)
modJij fabricApi.module("fabric-networking-api-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-command-api-v2", project.fabric_api_version)
modJij fabricApi.module("fabric-lifecycle-events-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-particles-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-registry-sync-v0", project.fabric_api_version)
// Sub projects, since they are Fabric mods as well (mainly to access the game code) we have to first
// implement the namedElements (raw output) to compile against, then include the mappedElements into the output jar
implementation compileOnlyApi(project(path: ":viafabricplus-api", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-api-legacy", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-visuals", configuration: "namedElements"))
include project(":viafabricplus-api")
include project(":viafabricplus-api-legacy")
include project(":viafabricplus-visuals")
// Dependencies exclusively to the root mod
jij("net.raphimc:MinecraftAuth:4.1.1") {
exclude group: "com.google.code.gson", module: "gson"
exclude group: "org.slf4j", module: "slf4j-api"
}
jij "net.lenni0451:Reflect:1.4.0"
jij("net.lenni0451:MCPing:1.4.2") {
exclude group: "com.google.code.gson", module: "gson"
}
jij("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR3-SNAPSHOT") {
exclude group: "io.netty"
}
jij "de.florianmichael:Classic4J:2.1.1-SNAPSHOT"
// Only to compile against for the ModMenu integration
modCompileOnly "com.terraformersmc:modmenu:12.0.0"
// Fabric's jar in jar system doesn't support transitive dependencies, so we have to manually add them
afterEvaluate {
configurations.jij.incoming.resolutionResult.allDependencies.each {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) {
transitive = false
}))
}
}
}
processResources {
filesMatching("fabric.mod.json") {
expand(
"version": project.version,
"description": project.description,
"implVersion": "git-${project.name}-${project.version}:${latestCommitHash().get()}",
"mcVersion": mcVersion()
)
}
}
String mcVersion() {
if (project.supported_versions.isEmpty()) {
return project.minecraft_version
} else {
return project.supported_versions
}
}
Provider<String> latestCommitHash() {
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}
jar {
// Rename the project's license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archivesBaseName}"
}
}
}
idea {
module {
["run"].each {
excludeDirs << file("$it")
}
}
}