Skip to content

Conversation

@joshfriend
Copy link
Collaborator

No description provided.

@joshfriend joshfriend force-pushed the jf/settings-dsl branch 7 times, most recently from 4acf3af to c682fa6 Compare November 5, 2025 00:57
Copy link

@autonomousapps autonomousapps left a comment

Choose a reason for hiding this comment

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

Just some minor nits!

Comment on lines 23 to 27
* enabled.set(true)
* repo {
* url.set("https://repo.example.com/maven")
* username.set("myuser")
* password.set("mypassword")

Choose a reason for hiding this comment

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

Not a big deal, but Kotlin DSL magic lets us use = now instead of set(...).

Although, that said, I usually prefer for my DSLs to only expose functions and not the properties directly. I think it's more maintainable in the end.

Comment on lines 120 to 121
* Sets the repository username and disallows further changes. Convenience method for Groovy
* DSL.

Choose a reason for hiding this comment

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

I mean, I would consider just exposing this for both DSLs.

Comment on lines -116 to +121
private fun Project.configureSandbagPom(pom: MavenPom) {
private fun Project.configureArtifactPom(pom: MavenPom) {

Choose a reason for hiding this comment

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

This is a better naming convention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

private lateinit var extension: ArtifactSwapExtension

override fun apply(target: Settings) = target.run {
extension = extensions.create("artifactSwap", ArtifactSwapExtension::class.java)

Choose a reason for hiding this comment

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

I usually like to embed this in the extension class as a factory function.

Comment on lines 139 to 140
gradle.settingsEvaluated {
logger.lifecycle("publish enabled ${extension.publishing.enabled.get()}")
if (extension.publishing.enabled.get()) {

Choose a reason for hiding this comment

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

Why is it important to evaluate that property here? (I'm just always suspicious of things that "look like" afterEvaluate. Is this preferable to checking the final value of enabled in each project context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the values from extensions are never available in the initial plugin application, you can only read them in afterSettings (or afterEvaluate for plugins)


val Project.sandbagHashFile: File
get() = File(rootDir, providers.gradleProperty(SANDBAG_HASH_FILE).get())
val Project.artifactHashFile: File

Choose a reason for hiding this comment

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

Is there a reason we're using java.io instead of the Gradle API (like RegularFile)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thats the type that using file() in build.gradle gave me.

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.

4 participants