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

Legacy configurations should be skipped #850

Open
Vampire opened this issue Mar 15, 2024 · 3 comments
Open

Legacy configurations should be skipped #850

Vampire opened this issue Mar 15, 2024 · 3 comments

Comments

@Vampire
Copy link
Contributor

Vampire commented Mar 15, 2024

Givne this trivial build:

./build.gradle.kts
plugins {
    java
    id("org.openjfx.javafxplugin") version "0.1.0"
    id("com.github.ben-manes.versions") version "0.51.0"
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.openjfx:javafx-base:17")
}

./gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

./settings.gradle.kts
rootProject.name = "foo"

If you execute the dependency updates task, it fails to resolve javafx-base.
The reason is, that the legacy (consumable and resolvable) configuration default is checked which extends runtimeElements.
It has the javafx-base dependency, but it does not have the necessary attributes set to properly select one of the variants, as those are only set on the proper resolvable configurations, i.e. runtime classpath and compile classpath for all source sets.

The plugin should probably better ignore those legacy configurations and only consider those that are resolvable but not consumable.

@ben-manes
Copy link
Owner

I assumed that the legacy configurations are scheduled for removal so this warning would go away? It must still be there assuming someone uses it, so if so then it should be resolved for them. I'd rather skip if something obvious, like no declared dependencies. Would that skip these naturally?

@ben-manes
Copy link
Owner

In the meantime, if annoying you, you can use filterConfigurations.

@Vampire
Copy link
Contributor Author

Vampire commented Mar 15, 2024

I assumed that the legacy configurations are scheduled for removal so this warning would go away?

Yeah, hopefully one day. :-D

I'd rather skip if something obvious, like no declared dependencies. Would that skip these naturally?

Those legacy configurations can be used in a multitude of variations.
And that they are still there is just for backwards compatibility.
The "no declared dependencies" could indeed be a good marker.
If someone is aware how to properly define the configurations, no legacies should be created by him.
If someone is half-aware of how to do it properly, separating "dependencyScope" from "resolvable" configuration but does not set the properties properly, he probably does it wrong for both and the "dependencyScope" one would be left to be checked by the plugin. On the other hand, the "resolvable" one would probably have the necessary attributes. But currently it would check both and then also have a problem with missing attributes. On the other hand focussing on the ones without dependencies would also not be right, as another common bad pattern is to have one dependency that is used for "dependencyScope" and "resolvable" at the same time. So the question is how much or which legacy patterns one wants to support.

In the meantime, if annoying you, you can use filterConfigurations

Ah, perfect, forgot about that, thanks. This works perfectly fine:

tasks.dependencyUpdates {
    filterConfigurations = Spec {
        !it.isCanBeConsumed
    }
}

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

2 participants