Visitar URL original
Add basic support for isolated projects to 1.x by technoir42 · Pull Request #7526 · detekt/detekt · GitHub
Skip to content

Add basic support for isolated projects to 1.x - #7526

Merged
cortinico merged 4 commits into
detekt:release/1.xfrom
technoir42:project-isolation-1.x
Aug 14, 2024
Merged

cortinico merged 4 commits into
detekt:release/1.xfrom
technoir42:project-isolation-1.x

Conversation

@technoir42

@technoir42 technoir42 commented Aug 9, 2024 •

Copy link
Copy Markdown
Contributor

Since 2.0 seems quite far away, it'd be great to add support for isolated projects to 1.x branch. It's quite simple to do and works well on a couple of my projects.

@detekt-ci

detekt-ci commented Aug 9, 2024 •

Copy link
Copy Markdown
Collaborator
Warnings
⚠️ It looks like this PR contains functional changes without a corresponding test.
⚠️ This PR is approved with no milestone set. If merged, it won't appear in the detekt release notes.

Generated by 🚫 dangerJS against 25c52d3

@technoir42
technoir42 force-pushed the project-isolation-1.x branch from 2575421 to f9b5ae4 Compare August 9, 2024 13:18

val defaultConfigFile =
project.file("${project.rootProject.layout.projectDirectory.dir(CONFIG_DIR_NAME)}/$CONFIG_FILE")
val defaultConfigFile = project.rootDir.resolve("$CONFIG_DIR_NAME/$CONFIG_FILE")

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.

Another, more modern alternative is project.isolated.rootProject.projectDirectory.file() which requires Gradle 8.8+, but rootDir seems to work fine for this purpose.

@technoir42
technoir42 force-pushed the project-isolation-1.x branch from f9b5ae4 to f6227d1 Compare August 9, 2024 13:35
@technoir42
technoir42 force-pushed the project-isolation-1.x branch from f6227d1 to 91b1a49 Compare August 9, 2024 13:45
@technoir42
technoir42 force-pushed the project-isolation-1.x branch from 91b1a49 to d404a28 Compare August 9, 2024 13:51
@cortinico

Copy link
Copy Markdown
Member

Since 2.0 seems quite far away, it'd be great to add support for isolated projects to 1.x branch. It's quite simple to do and works well on a couple of my projects.

Is this a pick of another PR @technoir42 ?

@technoir42

Copy link
Copy Markdown
Contributor Author

@cortinico nope, made from scratch

@cortinico

Copy link
Copy Markdown
Member

@cortinico nope, made from scratch

Ok can we have this PR against main then?

@technoir42

technoir42 commented Aug 9, 2024 •

Copy link
Copy Markdown
Contributor Author

@cortinico the main branch does seem to support isolated projects already, but I can add the tests for IP in another PR targeted at main. It's hard to track down where IP support was actually added, so I made the changes from scratch.

Edit: I updated the code that reads Gradle properties with the code from main branch to ensure compatibility with Gradle < 7.4.

@technoir42 technoir42 changed the title Add basic support for isolated projects Add basic support for isolated projects to 1.x Aug 9, 2024
@cortinico
cortinico requested a review from 3flex August 9, 2024 16:38
@3flex

3flex commented Aug 9, 2024

Copy link
Copy Markdown
Member

I don't have time for a close review for a couple of days, but does this fix anything that wasn't already fixed by #7394?

@3flex

3flex commented Aug 12, 2024

Copy link
Copy Markdown
Member

@technoir42:

I can add the tests for IP in another PR targeted at main

This is my preference. Eventually we should enable IP for every Gradle functional test but this isn't possible until the Kotlin Gradle plugin adds multiplatform support (hopefully in Kotlin 2.1.0, see child tasks of KT-57279)

And I think we should also close this PR. I don't think IP support is important enough to make this change in the 1.23.x line, especially because the support will be quite incomplete (see other limitations listed in #7394).

@technoir42

Copy link
Copy Markdown
Contributor Author

@3flex I added tests for IP in #7535.

And I think we should also close this PR. I don't think IP support is important enough to make this change in the 1.23.x line, especially because the support will be quite incomplete (see other limitations listed in #7394).

The cost of backporting changes seems to be trivial and at least some users will benefit from it. For us, detekt is the last plugin which blocks enabling IP and has no workaround due to the internal use of rootProject.layout. So I'd appreciate it if a 1.23.x release could be made with basic IP support, even multiplatform and report merging wouldn't be supported.

@3flex

3flex commented Aug 12, 2024

Copy link
Copy Markdown
Member

@cortinico it's your call whether you want to merge this given you've been maintaining this branch. I don't plan to review in detail though.

@3flex
3flex removed their request for review August 12, 2024 11:46
renovate Bot and others added 4 commits August 14, 2024 11:01
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit 28018e9)
…plugin (detekt#7394)

* fix "cannot dynamically look up a property in the parent project"

* fix "cannot access Project.layout functionality on another project"

* Fix compatibility on Gradle versions < 7.4

(cherry picked from commit f41614f)
…#7483)

* Use compat method to avoid deprecation warnings in Gradle 8.4+

* Create compat functions where Gradle version checks are required

* Ensure Gradle compat checks are done in a single utils file

* Fix root project directory function name

* Throw at call site

* Rename verification exception compat function to be more descriptive

* Inline verificationExceptionCompat for clearer stacktraces

(cherry picked from commit 2444b78)
@technoir42
technoir42 force-pushed the project-isolation-1.x branch from 01f2f5b to 25c52d3 Compare August 14, 2024 10:16
@technoir42

technoir42 commented Aug 14, 2024 •

Copy link
Copy Markdown
Contributor Author

I updated the PR to contain cherry-picks from #7340, #7394, #7483 and #7535.

@BraisGabin @cortinico would it be possible to review this and cut a release from 1.23.x line with these changes?
detekt is the last blocker for us as early adopters of IP.

@cortinico cortinico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code LGTM 👍 Let's merge it and I should be able to make a 1.x release in 1/2 weeks (sorry for the delay)

@cortinico
cortinico merged commit 1eb7bc5 into detekt:release/1.x Aug 14, 2024
@technoir42
technoir42 deleted the project-isolation-1.x branch August 26, 2024 21:44
@technoir42

Copy link
Copy Markdown
Contributor Author

Hey @cortinico, just wanted to kindly ping you about this

I should be able to make a 1.x release in 1/2 weeks (sorry for the delay)

@cortinico

Copy link
Copy Markdown
Member

Yes I'm spent the day yesterday in trying to release a new version from the 1.x branch. The problem is that every pick I do has merge conflicts that need to be resolved manually. This is going to take me a bit longer than expected.

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.

5 participants