forked from Legacy-Fabric/Legacy-Intermediaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
112 lines (97 loc) · 3.29 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
import cuchaz.enigma.command.ConvertMappingsCommand
buildscript {
repositories {
maven {
name "Fabric Repository"
url 'https://maven.fabricmc.net'
}
}
dependencies {
classpath "cuchaz:enigma:0.14.2.138"
}
}
plugins {
id 'maven'
id 'maven-publish'
id 'signing'
id 'com.jfrog.bintray' version '1.8.5'
}
def localMappingsPath = "$buildDir/v2Mappings"
new File(localMappingsPath).mkdirs()
def versionsToUpdate = []
file("versionsToUpdate.txt").eachLine { versionsToUpdate.add(it) }
def versions = []
file('mappings').eachFile {
if (!it.name.endsWith(".tiny")) return
def mcVer = it.name.replace(".tiny", "")
getLogger().lifecycle(":loading mappings for $mcVer")
File v1MappingFile = it
File v2MappingFile = new File("$localMappingsPath/${it.name}")
def conversionTask = "convert${it.name}ToV2"
tasks.register(conversionTask) {
group = "V2 Conversion"
inputs.file(v1MappingFile)
outputs.file(v2MappingFile)
doLast {
new ConvertMappingsCommand().run(
"tiny",
v1MappingFile.path,
"tinyv2:official:intermediary",
v2MappingFile.path
)
}
}
Jar makeV1Jar = makeJar(mcVer, v1MappingFile, false)
Jar makeV2Jar = makeJar(mcVer, v2MappingFile, true)
build.dependsOn makeV1Jar
build.dependsOn makeV2Jar
makeV2Jar.dependsOn conversionTask
publishing {
publications {
create("${mcVer}_mavenJava", MavenPublication) {
groupId 'net.fabricmc'
artifactId "intermediary"
version mcVer
artifact(makeV1Jar.archiveFile) {
builtBy makeV1Jar
}
artifact(makeV2Jar.archiveFile) {
builtBy makeV2Jar
classifier = "v2"
}
}
}
}
if (versionsToUpdate.contains(mcVer))
versions.add(mcVer)
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
publications = versions.collect { "${it}_mavenJava" }
publish = true
override = true // I don't think we care about overriding them
pkg {
repo = "Legacy-Fabric-Maven"
name = "Legacy-Intermediaries"
userOrg = "legacy-fabric"
licenses = ["CC0-1.0"]
version {
githubRepo = 'Legacy-Fabric/Legacy-Intermediaries'
websiteUrl = 'https://github.com/Legacy-Fabric/Legacy-Intermediaries'
issueTrackerUrl = 'https://github.com/Legacy-Fabric/Legacy-Intermediaries/issues'
vcsUrl = 'https://github.com/Legacy-Fabric/Legacy-Intermediaries.git'
}
}
}
def makeJar(String mcVersion, File mappings, boolean v2) {
def jarFilename = "intermediary-" + mcVersion + (v2 ? "-v2" : "")
return task("${mcVersion}_makeJar" + (v2 ? "v2" : ""), type: Jar) {
baseName jarFilename
from(file(mappings)) {
into "mappings"
rename mappings.name, "mappings.tiny"
}
destinationDirectory = file("build/jars")
}
}