Skip to content

Commit

Permalink
Add yarnCommon task that opens enigma with only common classes (#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn authored May 27, 2022
1 parent d1d7184 commit f2b6c84
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Compared to launching Enigma externally, the gradle task adds a name guesser plu
### `yarnUnpicked`
Same as above, but unpicks the constants and launches Enigma with them. Can be a little bit slower to get going.

### `yarnCommon`
Same as `yarn`, but will only show common classes.

### `build`
Build a GZip'd archive containing a tiny mapping between official (obfuscated), [intermediary](https://github.com/FabricMC/intermediary), and yarn names ("named") and packages enigma mappings into a zip archive..
Expand Down
74 changes: 50 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def clientJar = new File(cacheFilesMinecraft, "${minecraft_version}-client.jar")
def serverBootstrapJar = new File(cacheFilesMinecraft, "${minecraft_version}-serverboostrap.jar")
// The real server jar, expected from the bootstrap
def serverJar = new File(cacheFilesMinecraft, "${minecraft_version}-server.jar")
def serverIntermediaryJar = file("${minecraft_version}-server-intermediary.jar")
def libraries = new File(cacheFilesMinecraft, "libraries")
def libs = new File("build/libs/")

Expand Down Expand Up @@ -424,44 +425,44 @@ task mapIntermediaryJar(dependsOn: [downloadMcLibs, downloadIntermediary, mergeJ
//Force the task to always run
outputs.upToDateWhen { false }


doLast {
logger.lifecycle(":mapping minecraft to intermediary")
def tinyInput = downloadIntermediary.dest
mapJar(intermediaryJar, mergedFile, tinyInput, libraries, "official", "intermediary")
}
}

task yarnUnpicked(dependsOn: "unpickIntermediaryJar", type: JavaExec) {
group = yarnGroup

classpath = configurations.enigmaRuntime
mainClass = 'cuchaz.enigma.gui.Main'
task mapServerIntermediaryJar(dependsOn: [downloadMcLibs, downloadIntermediary, extractServerJar]) {
group = mapJarGroup
inputs.files downloadMcLibs.outputs.files.files
outputs.file(serverIntermediaryJar)

args '-jar'
args unpickedJar.getAbsolutePath()
args '-mappings'
args mappingsDir.getAbsolutePath()
args '-profile'
args 'enigma_profile.json'
//Force the task to always run
outputs.upToDateWhen { false }

jvmArgs "-Xmx2048m"
doLast {
logger.lifecycle(":mapping minecraft server to intermediary")
def tinyInput = downloadIntermediary.dest
mapJar(serverIntermediaryJar, serverJar, tinyInput, libraries, "official", "intermediary")
}
}

task yarn(dependsOn: mapIntermediaryJar, type: JavaExec) {
task yarnUnpicked(dependsOn: "unpickIntermediaryJar", type: EnigmaTask) {
group = yarnGroup
jar = unpickedJar
mappings = mappingsDir
}

classpath = configurations.enigmaRuntime
mainClass = 'cuchaz.enigma.gui.Main'

args '-jar'
args intermediaryJar.getAbsolutePath()
args '-mappings'
args mappingsDir.getAbsolutePath()
args '-profile'
args 'enigma_profile.json'
task yarn(dependsOn: mapIntermediaryJar, type: EnigmaTask) {
group = yarnGroup
jar = intermediaryJar
mappings = mappingsDir
}

jvmArgs "-Xmx2048m"
task yarnCommon(dependsOn: mapServerIntermediaryJar, type: EnigmaTask) {
group = yarnGroup
jar = serverIntermediaryJar
mappings = mappingsDir
}

task checkMappings(dependsOn: mapIntermediaryJar) {
Expand Down Expand Up @@ -1051,3 +1052,28 @@ class WithV2FileOutput extends DefaultTask {
@OutputFile
File v2Output
}

abstract class EnigmaTask extends JavaExec {
@Input
abstract Property<File> getJar()

@Input
abstract Property<File> getMappings()

EnigmaTask() {
classpath = project.configurations.enigmaRuntime
mainClass.set('cuchaz.enigma.gui.Main')
}

@TaskAction
void exec() {
args '-jar'
args jar.get().absolutePath
args '-mappings'
args mappings.get().absolutePath
args '-profile'
args 'enigma_profile.json'
jvmArgs "-Xmx2048m"
super.exec()
}
}

0 comments on commit f2b6c84

Please sign in to comment.