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

Move dependency constraints to root build script #462

Closed
wants to merge 1 commit into from

Conversation

RenFraser
Copy link
Contributor

@RenFraser RenFraser commented Apr 16, 2023

This removes the platform project and helps to simplify the build logic around constraining dependency versions by moving it out of the gradle directory and into the root directory. It looks like we've moved the plugins into buildSrc in a similar way, so this follows suit. Hopefully, this will make it easier to maintain.

It also removes duplicate constraint entries and a an error when the language server parses its own codebase and finds the platform project (that's now been removed).

Copy link
Collaborator

@themkat themkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less files = easier to read and understand in my view 🙂 Let's give other people a few days to weigh in with their opinion.

Comment on lines +21 to +22
subprojects {
apply(plugin = "java-library") // needed to register the api() constraint
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using subprojects and imperative plugin applications is the legacy way of doing this andgenerally discouraged in favor of version catalogs and build platforms

Copy link
Contributor Author

@RenFraser RenFraser May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my notes, I've got a version catalog as the alternative to a BOM for modern Gradle. I went with the BOM not too long ago because of the syntax but reading the docs here hat you've linked), I like how we can define libraries in a settings file, such as:

dependencyResolutionManagement {
    versionCatalogs {
        create("libs") {
            version("groovy", "3.0.5")
            version("checkstyle", "8.37")
            library("groovy-core", "org.codehaus.groovy", "groovy").versionRef("groovy")
            library("groovy-json", "org.codehaus.groovy", "groovy-json").versionRef("groovy")
            library("groovy-nio", "org.codehaus.groovy", "groovy-nio").versionRef("groovy")
            library("commons-lang3", "org.apache.commons", "commons-lang3").version {
                strictly("[3.8, 4.0[")
                prefer("3.9")
            }
        }
    }
}

And then use them elsewhere by:

dependencies {
    implementation(libs.groovy.core)
    implementation(libs.groovy.json)
    implementation(libs.groovy.nio)
}

To me, the catalog written this way is clearer than both the TOML syntax and the BOM that's already present. What do you think @themkat and @fwcd ? Perhaps this would be a better way forward.

@RenFraser
Copy link
Contributor Author

I'm going to cancel this PR to focus on more pressing issues with the language server.

@RenFraser RenFraser closed this Aug 1, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants