11plugins {
2- id ' java'
3- id ' maven-publish'
4- id ' de.undercouch.download ' version ' 4.1.2 '
2+ id ' java'
3+ id ' maven-publish'
4+ id ' com.pocolifo.jarremapper.devplugin ' version ' 1.0-SNAPSHOT '
55}
66
77group ' com.pocolifo'
@@ -10,236 +10,102 @@ version '2.0.0'
1010sourceCompatibility = targetCompatibility = JavaVersion . VERSION_1_8
1111
1212repositories {
13- mavenCentral()
13+ mavenCentral()
1414}
1515
1616dependencies {
17- implementation ' org.ow2.asm:asm-commons:9.2'
17+ implementation ' org.ow2.asm:asm-commons:9.2'
1818
19- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.8.2'
20- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.8.2'
19+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.8.2'
20+ testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.8.2'
2121}
2222
2323test {
24- useJUnitPlatform()
24+ useJUnitPlatform()
2525}
2626
27- publishing {
28- publications {
29- maven(MavenPublication ) {
30- pom {
31- name = ' JAR Remapper'
32- description = ' Library for remapping JARs'
33- artifactId = ' jar-remapper'
34-
35- licenses {
36- license {
37- name = ' Mozilla Public License 2.0'
38- url = ' https://www.mozilla.org/en-US/MPL/2.0/'
39- }
40- }
41-
42- developers {
43- developer {
44- id = ' youngermax'
45- }
46- }
47- }
48-
49- from components. java
50- }
51- }
52-
53- repositories {
54- mavenLocal()
55- }
56- }
57-
58- final legacyYarnVersion = ' 1.8.9+build.202110031151'
59-
60- final resources = new File (' src/test/resources' )
61- final mappings = new File (resources, ' mappings' )
62- final mcp = new File (mappings, ' mcp' )
63-
64- final mcp_189 = new File (mcp, ' 1.8.9' )
65- final yarn1 = new File (mappings, ' yarn' )
66- final yarn2merged = new File (mappings, ' yarnv2' )
67-
68- task setupDirectories {
69- mcp_189. mkdirs()
70- yarn1. mkdirs()
71- yarn2merged. mkdirs()
27+ // jarremapper-dev plugin extension
28+ // - downloads mappings
29+ // - downloads input jars
30+ // - automatically generates tests base on readers, engines, mappings, and input jars
31+ jarremapper {
32+ // how to use the jarremapper extension:
33+
34+ // mappings to use.
35+ // mcp format: mcp/<channel>/<minecraft version>/<mappings version>
36+ // yarn (legacyfabric & fabric) format: <(legacyfabric|fabric)>/<minecraft version>/<build id>
37+ mappings = [
38+ // mcp
39+ ' mcp/stable/1.8.9/22' ,
40+
41+ // legacyfabric
42+ ' legacyfabric/1.8.9/202112162000' ,
43+
44+ // fabric
45+ ' fabric/1.18.1/1'
46+ ]
47+
48+ // minecraft binaries to use.
49+ // format: <(client|server)>/<minecraft version>/<binary hash>
50+ minecraft = [' client/1.8.9/3870888a6c3d349d3771a3e9d16c9bf5e076b908' ,
51+ ' client/1.18.1/7e46fb47609401970e2818989fa584fd467cd036' ]
52+
53+ // mapping readers to generate tests for.
54+ // format: <canonical path of reader class>/<how to obtain a JarMapping>/<mappings this applies to>(+<more mappings>+...): [<files required for constructing>]
55+ readers = [' com.pocolifo.jarremapper.reader.mcp.McpMappingReader/.read()/mcp' : [' joined.srg' , ' joined.exc' , ' methods.csv' , ' fields.csv' , ' params.csv' ],
56+ ' com.pocolifo.jarremapper.reader.tiny.Tiny1MappingReader/.read(\" official\" , \" named\" )/fabric+legacyfabric' : [' mappings.tiny' ],
57+ ' com.pocolifo.jarremapper.reader.tiny.Tiny2MappingReader/.read(\" official\" , \" named\" )/fabric+legacyfabric' : [' mappings-merged.tiny' ]]
58+
59+ // remapping engines to generate tests for.
60+ // format: <canonical name of engine>/<how to obtain an AbstractRemappingEngine>
61+ engines = [
62+ // all StandardRemappingEngine options
63+ ' com.pocolifo.jarremapper.engine.standard.StandardRemappingEngine/new StandardRemappingEngine()' ,
64+ ' com.pocolifo.jarremapper.engine.standard.StandardRemappingEngine/new StandardRemappingEngine().excludeMetaInf()' ,
65+ ' com.pocolifo.jarremapper.engine.standard.StandardRemappingEngine/new StandardRemappingEngine().setRemappingPlugin(new com.pocolifo.jarremapper.SimpleProgressListener())' ,
66+ ' com.pocolifo.jarremapper.engine.standard.StandardRemappingEngine/new StandardRemappingEngine().setRemappingPlugin(new com.pocolifo.jarremapper.SimpleProgressListener()).excludeMetaInf()'
67+ ]
7268}
7369
74- // minecraft 1.8.9
75- task mcpMappings189 (dependsOn : setupDirectories) {
76- final csv = new File (mcp_189, ' stable.zip' )
77- final srg = new File (mcp_189, ' srg.zip' )
78-
79- // csv: params.csv, fields.csv, methods.csv
80- download {
81- src ' https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_stable/22-1.8.9/mcp_stable-22-1.8.9.zip'
82- dest csv
83- overwrite false
84- }
85-
86- copy {
87- from zipTree(csv)
88- into mcp_189
89- }
90-
91- delete csv
92-
93- // srg: joined.srg. joined.exc
94- download {
95- src ' https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp/1.8.9/mcp-1.8.9-srg.zip'
96- dest srg
97- overwrite false
98- }
99-
100-
101-
102- copy {
103- from zipTree(srg). matching {
104- include ' joined.srg' , ' joined.exc'
105- }
106- into mcp_189
107- }
108-
109- delete srg
110- }
111-
112- task yarn189 (dependsOn : setupDirectories) {
113- final yarn1_dest = new File (yarn1, legacyYarnVersion + ' .jar' )
114- final yarn2_dest = new File (yarn2merged, legacyYarnVersion + ' -mergedv2.jar' )
115-
116- // yarn v1
117- download {
118- src ' https://maven.legacyfabric.net/net/fabricmc/yarn/' + legacyYarnVersion + ' /yarn-' + legacyYarnVersion + ' .jar'
119- dest yarn1_dest
120- overwrite true
121- }
122-
123- copy {
124- from zipTree(yarn1_dest). filter {
125- it. isFile() && it. name == ' mappings.tiny'
126- }. singleFile
127-
128- into yarn1
129-
130- rename {
131- ' mappings.tiny'
132- ' mappings-1.8.9.tiny'
133- }
134- }
135-
136- delete yarn1_dest
137-
138- // yarn v2 merged
139- download {
140- src ' https://maven.legacyfabric.net/net/fabricmc/yarn/' + legacyYarnVersion + ' /yarn-' + legacyYarnVersion + ' -mergedv2.jar'
141- dest yarn2_dest
142- overwrite true
143- }
144-
145- copy {
146- from zipTree(yarn2_dest). filter {
147- it. isFile() && it. name == ' mappings.tiny'
148- }. singleFile
149-
150- into yarn2merged
151-
152- rename {
153- ' mappings.tiny'
154- ' mappings-merged-v2-1.8.9.tiny'
155- }
156- }
157-
158- delete yarn2_dest
159- }
160-
161- task minecraft189 (type : Download , dependsOn : setupDirectories) {
162- src ' https://launcher.mojang.com/v1/objects/3870888a6c3d349d3771a3e9d16c9bf5e076b908/client.jar'
163- dest new File (resources, ' minecraft-1.8.9.jar' )
164- overwrite true
165- }
166-
167- task setup189 {
168- dependsOn setupDirectories
169- dependsOn mcpMappings189
170- dependsOn yarn189
171- dependsOn minecraft189
172- }
173-
174- // minecraft latest
175- // updated to 1.17.1
176- final String yarn = ' 1.17.1+build.61'
177- final String mc = ' 1.17.1'
178-
179- task minecraftLatest (type : Download , dependsOn : setupDirectories) {
180- // needs to be updated
181- src ' https://launcher.mojang.com/v1/objects/8d9b65467c7913fcf6f5b2e729d44a1e00fde150/client.jar'
182- dest new File (resources, ' minecraft-' + mc + ' .jar' )
183- overwrite true
184- }
185-
186- task yarnLatest (dependsOn : setupDirectories) {
187- final yarn1_dest = new File (yarn1, yarn + ' .jar' )
188- final yarn2_dest = new File (yarn2merged, yarn + ' -mergedv2.jar' )
189-
190- // yarn v1
191- download {
192- src ' https://maven.fabricmc.net/net/fabricmc/yarn/' + yarn + ' /yarn-' + yarn + ' .jar'
193- dest yarn1_dest
194- overwrite true
195- }
196-
197- copy {
198- from zipTree(yarn1_dest). filter {
199- it. isFile() && it. name == ' mappings.tiny'
200- }. singleFile
201-
202- into yarn1
203-
204- rename {
205- ' mappings.tiny'
206- ' mappings-' + mc + ' .tiny'
207- }
208- }
209-
210- delete yarn1_dest
211-
212- // yarn v2 merged
213- download {
214- src ' https://maven.fabricmc.net/net/fabricmc/yarn/' + yarn + ' /yarn-' + yarn + ' -mergedv2.jar'
215- dest yarn2_dest
216- overwrite true
217- }
218-
219- copy {
220- from zipTree(yarn2_dest). filter {
221- it. isFile() && it. name == ' mappings.tiny'
222- }. singleFile
223-
224- into yarn2merged
225-
226- rename {
227- ' mappings.tiny'
228- ' mappings-merged-v2-' + mc + ' .tiny'
229- }
230- }
231-
232- delete yarn2_dest
233- }
234-
235- task setupLatest {
236- dependsOn setupDirectories
237- dependsOn minecraftLatest
238- dependsOn yarnLatest
70+ publishing {
71+ publications {
72+ maven(MavenPublication ) {
73+ pom {
74+ name = ' JAR Remapper'
75+ description = ' Library for remapping JARs'
76+ artifactId = ' jarremapper'
77+
78+ licenses {
79+ license {
80+ name = ' Mozilla Public License 2.0'
81+ url = ' https://www.mozilla.org/en-US/MPL/2.0/'
82+ }
83+ }
84+
85+ developers {
86+ developer {
87+ id = ' youngermax'
88+ }
89+ }
90+ }
91+
92+ from components[' java' ]
93+ }
94+ }
95+
96+ repositories {
97+ maven {
98+ url System . getenv(" REPO_URL" )
99+ name ' pocolifo'
100+
101+ credentials {
102+ username = System . getenv(" REPO_USERNAME" )
103+ password = System . getenv(" REPO_PASSWORD" )
104+ }
105+
106+ authentication {
107+ basic(BasicAuthentication )
108+ }
109+ }
110+ }
239111}
240-
241- // setup all
242- task setup {
243- dependsOn setup189
244- dependsOn setupLatest
245- }
0 commit comments