Giter Club home page Giter Club logo

Comments (3)

SteveTheEngineer avatar SteveTheEngineer commented on May 30, 2024

What's your ForgeGradle version? If it's 5, try downgrading it to 4.

from mixingradle.

dualdragoon avatar dualdragoon commented on May 30, 2024

I'm using the version of gradle and ForgeGradle that come with the newest Forge MDK. It uses Gradle 7.1.1 which is incompatible with older versions of ForgeGradle. Isn't there some way to just remove the first line from the file before the processor runs or better yet for the processor to skip the first line if it starts with that? I can't be the only person having this issue.

from mixingradle.

FoxSamu avatar FoxSamu commented on May 30, 2024

ForgeGradle 5 comes with a new TSRG format, adding the tsrg2 left right in the beginning, and adding static indications to static method mappings. Mixin's Annotation Processor doesn't know how to deal with those.

I fixed it with this workaround:

// Generate a fixed tsrg file after generating the default tsrg file
createMcpToSrg {
    outputs.upToDateWhen {false}
    doLast {
        fixFG5TsrgForMixinAP(output.get().asFile, file("${buildDir}/fixMcpToSrg/output.tsrg"))
    }
}

// Tell mixin to use the fixed TSRG file
mixin {
    reobfSrgFile = file("${buildDir}/fixMcpToSrg/output.tsrg")
}

// Function that actually fixes the TSRG file
static def fixFG5TsrgForMixinAP(File inFile, File outFile) {
    // Make directory if needed
    outFile.parentFile.mkdirs()

    try (Scanner scanner = new Scanner(inFile); PrintWriter out = new PrintWriter(outFile)) {
        boolean firstLine = true
        while (scanner.hasNextLine()) {
            String next = scanner.nextLine()

            // Skip first 'tsrg left right' header line
            if (firstLine) {
                firstLine = false
                continue
            }

            // Skip 'static' indicators
            if (next.trim() == "static") {
                continue
            }

            // Export line otherwise
            out.println(next)
        }
    }
}

See this issue: SpongePowered/Mixin#526

from mixingradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.