forked from DavyVerbogt/Colt-s-Cosmetic-Armor-Mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
220 lines (165 loc) · 5.65 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import groovy.transform.Field
import java.util.jar.Attributes
import java.util.jar.JarFile
import java.util.jar.Manifest
import java.util.zip.ZipInputStream
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
final commitId
if (hasProperty("grgit")) {
commitId = "${grgit.head().abbreviatedId}"
} else {
commitId = "NOGIT"
}
version = '1.0'
group = 'com.Colt.ColtCosmeticArmorMod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'ColtCosmeticArmorMod'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
mappings channel: 'snapshot', version: '20201028-1.16.3'
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven {
name "curios"
url "https://maven.theillusivec4.top/"
}
maven {
url "https://www.cursemaven.com"
}
maven {
url "https://maven.tterrag.com/"
}
maven {
name "jei"
url "https://dvs1.progwml6.com/files/maven/"
}
//maven {
// url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
//}
}
configurations {
embed {
transitive = false
}
compile.extendsFrom embed
}
dependencies {
minecraft 'net.minecraftforge:forge:1.16.4-35.1.4'
//implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.16.5:3.0.32')
compileOnly fg.deobf("mezz.jei:jei-1.16.4:7.6.1.71:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.4:7.6.1.71")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.4.0:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.4.0")
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs.addAll(['-Xlint:unchecked', '-Xlint:deprecation'])
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
}
jar.finalizedBy('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
@Field def MAVEN_ARTIFACT = new Attributes.Name("Maven-Artifact")
task makeLibraryMetas {
outputs.upToDateWhen { false }
def temp = getTemporaryDir()
if (temp.exists()) {
delete temp.listFiles()
}
def configuration = configurations.embed
configuration.getResolvedConfiguration().getResolvedArtifacts().forEach { dep ->
def file = dep.getFile()
def mavenArtifact = dep.getId().getComponentIdentifier().toString()
if (!hasMavenArtifactAttribute(file)) {
def manifest = new Manifest()
def attributes = manifest.getMainAttributes()
attributes.put Attributes.Name.MANIFEST_VERSION, "1.0"
attributes.put MAVEN_ARTIFACT, mavenArtifact
new File(temp, file.getName() + ".meta").withOutputStream { os ->
manifest.write(os)
}
}
}
def str = configuration.collect { file -> file.getName() }.join(" ")
def tasks = project.tasks.withType(Jar.class)
tasks.each { task -> task.from temp, { CopySpec spec -> spec.rename '(.+.jar.meta)', 'META-INF/libraries/$1' } }
tasks.each { task -> task.from configuration, { CopySpec spec -> spec.rename '(.+.jar)', 'META-INF/libraries/$1' } }
tasks.each { task -> task.getManifest().getAttributes().putAt 'ContainedDeps', str }
}
tasks.withType(Jar.class).each { task ->
task.dependsOn(makeLibraryMetas)
}
boolean hasMavenArtifactAttribute(File file) {
def zi = new ZipInputStream((InputStream) new FileInputStream(file))
def ze = zi.getNextEntry()
while (ze != null) {
if (ze.getName().equalsIgnoreCase(JarFile.MANIFEST_NAME)) {
def manifest = new Manifest((InputStream) zi)
if (manifest.getMainAttributes().containsKey(MAVEN_ARTIFACT)) {
zi.closeQuietly()
return true
}
}
ze = zi.getNextEntry()
}
try {
zi.close()
}
catch (ignored) {
}
return false
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}