Skip to content

Check property existence with providers#1032

Merged
wakingrufus merged 3 commits intoJLLeitschuh:mainfrom
eduardbosch:feature/check-property-isolated-project-compatible
Mar 12, 2026
Merged

Check property existence with providers#1032
wakingrufus merged 3 commits intoJLLeitschuh:mainfrom
eduardbosch:feature/check-property-isolated-project-compatible

Conversation

@eduardbosch
Copy link
Copy Markdown
Contributor

@eduardbosch eduardbosch commented Feb 5, 2026

Make plugin compatible with Isolated Projects

Should fix #805, at least this comment #805 (comment)

@eduardbosch
Copy link
Copy Markdown
Contributor Author

@wakingrufus do you want me to update the changelog? I'm not sure how do you proceed with releases. If you want to manage the changelog or prefer that contributors do it.

@wakingrufus
Copy link
Copy Markdown
Collaborator

@wakingrufus do you want me to update the changelog? I'm not sure how do you proceed with releases. If you want to manage the changelog or prefer that contributors do it.
Yes please, if you can add a line to the changelog in your PR in the proper format, I'll merge this.
Thanks again!

@eduardbosch
Copy link
Copy Markdown
Contributor Author

Changelog updated, and I've also fixed another Project Isolation compatibility with the format task. Let me know if what I removed was strictly necessary. I think it was not.

Comment on lines -41 to -50
val rootProjectName = project.rootProject.name
var parentProject: Project? = project.parent
while (parentProject != null && parentProject.name != rootProjectName) {
val parentProjectPath = parentProject.path
parentProject.plugins.withId("org.jlleitschuh.gradle.ktlint") {
mustRunAfter("$parentProjectPath:${KtLintFormatTask.KOTLIN_SCRIPT_TASK_NAME}")
}
parentProject = parentProject.parent
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@wakingrufus accessing parent plugins violates Project Isolation. I think this task enforcement is not necessary. Can you check it please?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think this task ordering is only a nice to have, but should not be strictly needed

Comment on lines -41 to -50
val rootProjectName = project.rootProject.name
var parentProject: Project? = project.parent
while (parentProject != null && parentProject.name != rootProjectName) {
val parentProjectPath = parentProject.path
parentProject.plugins.withId("org.jlleitschuh.gradle.ktlint") {
mustRunAfter("$parentProjectPath:${KtLintFormatTask.KOTLIN_SCRIPT_TASK_NAME}")
}
parentProject = parentProject.parent
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think this task ordering is only a nice to have, but should not be strictly needed

@wakingrufus wakingrufus force-pushed the feature/check-property-isolated-project-compatible branch from 04d8260 to 7e15068 Compare February 16, 2026 20:32
CHANGELOG.md Outdated
and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]
- Make plugin compatible with Isolated Projects [#1032](https://github.com/JLLeitschuh/ktlint-gradle/pull/1032#issuecomment-3860666022)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this fails validation, I think because the link to the pr has a deeplink to a comment in it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Let's see if that works now 🙂

@eduardbosch eduardbosch force-pushed the feature/check-property-isolated-project-compatible branch 2 times, most recently from 25f1147 to fcf5940 Compare February 18, 2026 15:54
@eduardbosch
Copy link
Copy Markdown
Contributor Author

I fixed the workflows. Sorry for not running them on my local machine beforehand.

@eduardbosch
Copy link
Copy Markdown
Contributor Author

Hey guys, did anyone had time to review this PR?
Could we at least run the checks?

@eduardbosch
Copy link
Copy Markdown
Contributor Author

Friendly reminder. Could someone take a look at this one please?

Make the property check compatible with Isolated Projects
Make format task compatible with Isolated Projects by preventing to access parent project plugins.
I think that restriction was not necessary, and it was introduced a while back while fixing some Gradle 7 warnings. This parent dependency was not related to the warnings, and probably is not needed anymore.
@wakingrufus wakingrufus force-pushed the feature/check-property-isolated-project-compatible branch from fcf5940 to e69999f Compare March 12, 2026 12:48
@wakingrufus wakingrufus merged commit 60dafb8 into JLLeitschuh:main Mar 12, 2026
23 checks passed
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.

Add support for project isolation.

2 participants