forked from Kir-Antipov/sync-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
115 lines (94 loc) · 3.52 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
113
114
115
plugins {
id "fabric-loom" version "0.9-SNAPSHOT"
id "org.ajoberstar.grgit" version "4.1.0"
}
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
String loaderDependencyVersion = ">=${project.loader_version.split(/\+/)[0]}"
String minecraftDependencyVersion = project.minecraft_version.split(/[+ -]/)[0].replaceFirst(/^(\d+\.\d+)(\.\d+|)$/, '$1.x')
group = project.maven_group
version = "${project.mod_version}${getVersionMetadata()}" as Object
archivesBaseName = "${project.archives_base_name}-mc${minecraftDependencyVersion}"
loom {
accessWidenerPath = file("src/main/resources/sync.accesswidener")
}
repositories {
maven {
name = "Databreaker"
url = "https://maven.gegy.dev/"
}
maven {
name = "Fast Transfer Lib"
url = "https://raw.githubusercontent.com/Technici4n/Technici4n-maven/master/"
}
maven {
name = "Smart Recipes"
url = "https://maven.pkg.github.com/Kir-Antipov/smart-recipes"
credentials {
username = project.findProperty("GITHUB_ACTOR") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")
}
}
}
// To change the versions see the gradle.properties file
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "dev.technici4n:FastTransferLib:${project.ftl_version}"
include "dev.technici4n:FastTransferLib:${project.ftl_version}"
modImplementation "dev.kirantipov:smartrecipes:${project.smartrecipes_version}"
include "dev.kirantipov:smartrecipes:${project.smartrecipes_version}"
// Minecraft 1.17 is slow as heck
modRuntime("supercoder79:databreaker:${project.databreaker_version}") {
transitive = false
}
}
processResources {
def fabricModProperties = [
"version": version,
"fabric": loaderDependencyVersion,
"minecraft": minecraftDependencyVersion
]
filesMatching("fabric.mod.json") {
expand fabricModProperties
}
}
tasks.withType(JavaCompile).configureEach {
// Ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
}
java {
withSourcesJar()
}
jar {
from "LICENSE.md"
}
@SuppressWarnings('GrMethodMayBeStatic') // It cannot
String getVersionMetadata() {
// Release builds don't require additional metadata
String release_tag = System.getenv("RELEASE_TAG")
if (release_tag != null && release_tag.length() != 0) {
return ""
}
// GitHub CI builds only
String build_id = System.getenv("GITHUB_RUN_NUMBER")
if (build_id != null && build_id.length() != 0) {
return "+build.${build_id}"
}
if (grgit != null) {
def head = grgit.head()
def id = head.abbreviatedId
// Flag the build if the build tree is not clean
if (!grgit.status().clean) {
id += "-dirty"
}
return "+rev.${id}"
}
// No tracking information could be found about the build
return "+unknown"
}