forked from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
149 lines (124 loc) · 3.87 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "Fabric"
url = "https://maven.fabricmc.net/"
}
maven {
name = "Jitpack"
url 'https://jitpack.io/'
}
}
dependencies {
classpath 'com.github.Chocohead:Fabric-Loom:e3d1762'
}
}
plugins {
id 'maven-publish'
}
apply plugin: "fabric-loom"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
idea {
module {
downloadJavadoc = true
}
}
eclipse {
classpath {
downloadJavadoc = true
}
}
repositories {
maven {
name = "Jitpack"
url "https://jitpack.io/"
}
}
minecraft {
}
dependencies {
// fabric loader requires log4j, guava, and gson
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8.1'
annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8.1'
annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8.1'
implementation 'com.google.guava:guava:28.0-jre'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
// mixin and fabric loader need asm 9
implementation 'org.ow2.asm:asm:9.0'
implementation 'org.ow2.asm:asm-analysis:9.0'
implementation 'org.ow2.asm:asm-commons:9.0'
implementation 'org.ow2.asm:asm-tree:9.0'
implementation 'org.ow2.asm:asm-util:9.0'
// to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.fromCommit("calmilamsy/BIN-Mappings", "${project.yarn_mappings}") {spec ->
spec.version = "b1.7.3-${project.yarn_mappings}"
}
// convenience stuff
// adds some useful annotations for data classes. does not add any dependencies
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
// adds some useful annotations for miscellaneous uses. does not add any dependencies, though people without the lib will be missing some useful context hints.
compile 'org.jetbrains:annotations:16.0.2'
modImplementation "com.github.minecraft-cursed-legacy:cursed-fabric-loader:${project.loader_version}"
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
// 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
tasks.withType(JavaCompile) {
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) {
classifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}
tasks.publishToMavenLocal.dependsOn(tasks.remapJar)
publishing {
repositories {
mavenLocal()
}
publications {
mavenJava(MavenPublication) {
artifactId project.archives_base_name
artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}.jar") {
classifier null
builtBy remapJar
}
artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}-dev.jar") {
classifier 'dev'
builtBy remapJar
}
pom.withXml {
asNode().dependencies.dependency.each { dep ->
if(dep.artifactId.last().value().last().toLowerCase() in ["cursed-fabric-loader", "stationapi"]) {
assert dep.parent().remove(dep)
}
}
}
}
}
}