forked from jsorrell/CarpetSkyAdditions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
129 lines (106 loc) · 3.8 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import java.text.SimpleDateFormat
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}
repositories {
maven {
url 'https://masa.dy.fi/maven'
}
maven {
url "https://maven.shedaniel.me/"
}
maven {
url "https://maven.terraformersmc.com/releases/"
}
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = archives_base_name
version = minecraft_version + "-" + mod_version
loom {
accessWidenerPath = file("src/main/resources/${mod_id}.accesswidener")
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
modImplementation "carpet:fabric-carpet:${carpet_core_version}"
modImplementation(fabricApi.module("fabric-object-builder-api-v1", fabric_api_version))
modImplementation(fabricApi.module("fabric-registry-sync-v0", fabric_api_version))
modImplementation(fabricApi.module("fabric-resource-loader-v0", fabric_api_version))
modImplementation(fabricApi.module("fabric-transitive-access-wideners-v1", fabric_api_version))
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "com.terraformersmc:modmenu:${modmenu_version}"
// javax.annotation.Nullable/Nonnull
modCompileOnly "com.google.code.findbugs:jsr305:3.0.2"
}
task zipTranslationPack(type: Zip) {
archiveFileName = archives_base_name + "-" + project.version + ".translations.zip"
group = "build"
destinationDirectory = file("$buildDir/")
from files('./datapack-translations')
}
task embedDatapack(type: Copy) {
from './datapack'
into "$buildDir/generated/resources/resourcepacks/${datapack_name}"
}
task embedSpawnDatapacks(type: Copy) {
from './alternate-spawn-datapacks'
into "$buildDir/generated/resources/resourcepacks"
}
task fillBuildTemplate(type: Copy) {
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
def templateContext = [
id : mod_id,
name : mod_name,
version : version,
timestamp : df.format(new Date()),
minecraft_version : minecraft_version,
yarn_mappings : yarn_mappings,
embedded_datapack_name: datapack_name,
]
inputs.properties templateContext
from 'src/template/java'
into "$buildDir/generated/java"
expand templateContext
}
sourceSets.main.resources.srcDir "$buildDir/generated/resources"
processResources.dependsOn embedDatapack
processResources.dependsOn embedSpawnDatapacks
sourceSets.main.java.srcDir "$buildDir/generated/java"
compileJava.dependsOn fillBuildTemplate
processResources {
def templateContext = [
id : mod_id,
name : mod_name,
version: version
]
inputs.properties templateContext
// replace stuff in fabric.mod.json, nothing else
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand templateContext
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
// 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
compileJava.options.encoding = "UTF-8"
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
//task sourcesJar(type: Jar, dependsOn: classes) {
// from sourceSets.main.allSource
//}
jar {
from "LICENSE"
}