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

Can't use RetroFuturaGradle dependencies out of the box #7

Open
Fuyukai opened this issue Aug 20, 2023 · 2 comments
Open

Can't use RetroFuturaGradle dependencies out of the box #7

Fuyukai opened this issue Aug 20, 2023 · 2 comments

Comments

@Fuyukai
Copy link

Fuyukai commented Aug 20, 2023

If you try adding an dependency compiled using RFG with modImplementation and co, you'll get two wrong behaviours depending on version:

7.6 (or lower, presumably): Gradle complains about variant mismatch.
8.3: Gradle brings in the wrong type of dependency automatically.

The solution for both is this incantation:

configurations.all {
    attributes {
        attribute(Attribute.of("com.gtnewhorizons.retrofuturagradle.obfuscation", String::class.java), "srg")
    }
}

Unfortunately, this then breaks dependency resolution (thanks, RFG). Not sure what to do about this, but it's broken either way, so I guess pick the less broken option?

@Fuyukai
Copy link
Author

Fuyukai commented Aug 20, 2023

Actually, another option is (in a repository) disable Gradle module metadata with

            metadataSources {
                mavenPom()
                ignoreGradleMetadataRedirection()
            }

but this breaks dep resolution in a third way (RFG deps usually depend on the dev classifier). This could be fixed on this side though by forcibly stripping the dev classifier from transistive dependencies.

@Fuyukai
Copy link
Author

Fuyukai commented Aug 20, 2023

Adding a repository like this:

    repositories {
        maven {
            url = uri("http://jenkins.usrv.eu:8081/nexus/content/groups/public/")
            isAllowInsecureProtocol = true

            metadataSources {
                mavenPom()
                ignoreGradleMetadataRedirection()
            }
        }
    }

and then forcing dependency selection like this (buildscript syntax):

configurations.all {
    resolutionStrategy.eachDependency {
        artifactSelection {
            if (this.hasSelectors() && requestedSelectors.any { it.classifier == "dev" }) {
                withoutArtifactSelectors()
                selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
            }
        }
    }
}

will correctly force SRG dependencies instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant