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

Exclusions are calculated unnecessarily for non-transitive configurations #372

Conversation

fp7
Copy link
Contributor

@fp7 fp7 commented Dec 18, 2023

All direct dependencies of a configuration are included by default and all other are excluded by default for non transitive configurations. It is therefore unnecessary to calculate exclusions.

All direct dependencies of a configuration are included by default and
all other are excluded by default for non transitive configurations. It
is therefore unnecessary to calculate exclusions.
@fp7 fp7 force-pushed the fp7/ignore-exclusions-in-non-transitive-configurations branch from aeafbbf to d94f45c Compare December 18, 2023 16:11
@wilkinsona
Copy link
Contributor

Thanks for the proposal. What's the motivation for this change? Is it purely an optimisation to improve performance or have you seen incorrect behavior with non-transitive configurations? If it's the former, can you please describe the performance problem that you were facing?

@fp7
Copy link
Contributor Author

fp7 commented Jan 10, 2024

(Sorry for the delay.)

It is neither performance nor incorrect behaviour. The dependency-management-plugin logged the following message in combination with spotless and eclipse groovy based formatting.

Errors occurred while building effective model from /home/repro/.gradle/caches/modules-2/files-2.1/org.eclipse.platform/org.eclipse.swt/3.124.100/95a7ddc41b5a1771a7b69a47e9488a2c09ef5098/org.eclipse.swt-3.124.100.pom:
        'dependencies.dependency.artifactId' for org.eclipse.platform:org.eclipse.swt.${osgi.platform}:jar with value 'org.eclipse.swt.${osgi.platform}' does not match a valid id pattern. in org.eclipse.platform:org.eclipse.swt:3.124.100

The placeholder can not be resolved is in this pom: https://repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.swt/3.124.100/org.eclipse.swt-3.124.100.pom

The message gets logged here: https://github.com/spring-gradle-plugins/dependency-management-plugin/blob/c8d0dcfa9573e786fe0d4a247291358317064d69/src/main/java/io/spring/gradle/dependencymanagement/internal/maven/EffectiveModelBuilder.java#L103C4-L103C4

This did not lead to errors, but was a little bit annoying, especially because it was logged for every subproject.

To remove the logged message, as a workaround I added systemProp.osgi.platform=foo to the gradle.properties in my project.

But I also realized that this message would go away when ignoring transitive dependencies in the dependency-management-plugin on non transitive configurations because that is happening eventually anyway.
And that it would also prevent some unnecessary work to be done during dependency resolution.

I created a reproduction repository if needed: https://github.com/fp7/sdm-spotless-logging-repro.
With ./gradlew spotlessApply you see the message.

@wilkinsona wilkinsona changed the title Don't calculate exclusions for non transitive configurations Exclusions are calculated unnecessarily for non-transitive configurations May 2, 2024
@wilkinsona wilkinsona added this to the 1.1.5 milestone May 2, 2024
wilkinsona pushed a commit that referenced this pull request May 2, 2024
All direct dependencies of a configuration are included by default and
all other are excluded by default for non transitive configurations. It
is therefore unnecessary to calculate exclusions.

See gh-372
@wilkinsona wilkinsona closed this in 0676dc0 May 2, 2024
@wilkinsona
Copy link
Contributor

Thanks very much, @fp7.

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

Successfully merging this pull request may close these issues.

3 participants