Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDK] Example for delaying obfuscation until publish does not work. #9605

Open
noeppi-noeppi opened this issue Jun 27, 2023 · 0 comments
Open
Labels
1.20 Triage This request requires the active attention of the Triage Team. Requires labelling or reviews.

Comments

@noeppi-noeppi
Copy link
Contributor

Description of issue:

The MDK shows the following example on how to delay the reobfuscation of the jar file (by the reobfJar) task:

tasks.named('publish').configure {
    dependsOn 'reobfJar'
}

The maven-publish plugin will create a separate task (named publishMavenJavaPublicationToMavenRepository by default) for each publication. This task actually published the artifact. The publish task itself does nothing, it's purpose is to have all those publishing tasks as dependnecies.

Using the shown example from the MDK, both the publishMavenJavaPublicationToMavenRepositoryand the reobfJar task will become dependencies of the publish task. When executing publish, it can happen, that publishMavenJavaPublicationToMavenRepository runs before reobfJar, publishing a deobfuscated jar file to the maven repository.

The correct way to specify that the the reobfJar task should run before the publication, is to use the builtBy method of PublicationArtifact like this:

publishing {
    publications {
        mavenJava(MavenPublication) {
            // All the other configuration of the publication
            artifact(jar) {
                builtBy project.provider { project.tasks.named('reobfJar') }
            }
        }
    }
}

I think, the MDK should direct the modder to this approach or at least not show an example that does not work and publishes deobfuscated jars into the maven.

@noeppi-noeppi noeppi-noeppi added the Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. label Jun 27, 2023
@MinecraftForge MinecraftForge deleted a comment Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Triage This request requires the active attention of the Triage Team. Requires labelling or reviews.
Projects
None yet
Development

No branches or pull requests

2 participants