-
Notifications
You must be signed in to change notification settings - Fork 275
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
Misdetected cycle between :extractIncludeTestProto and :compileKotlin #624
Comments
Could you please provide minimal reprodusible project? |
Could you describe your project configuration in more detail?
|
Hello @rougsig as far as it's a private project I can't share it, I'm trying to create another project with the same conditions as the one that is failing that I can share with you.
|
Face a similar problem in a project that uses spotless. After upgrading from 0.8.19 to 0.9.1 getting
On 0.8.19 the project builds fine. |
@Spikhalskiy What is the spotless version?
Is it created by a spotless plugin or by you? |
6.11.0 with googleJavaFormat('1.15.0') and ktlint('0.47.1')
This dependency is setup in the project (our own) gradle build script. And it's been working with 0.8.x versions of this plugin. |
When trying to upgrade from 0.8.18 to 0.9.1, we are seeing a similar issue:
With 0.8.18 it works like a charm, only change is an upgrade from 0.8.18 to 0.9.1. |
@samzurcher Hello. Do you add ksp plugin and it'a all? No extra build script configuration? |
We do have a rather complex build, use code in buildSrc and the KSP plugin to process our code. But all is fine with our build with version 0.8.19 but changing to 0.9.1 results in the above gradle problem. |
I have a very bad feeling about this. I think there's something very fundamentally wrong. spotlessApply is not a task accepting input and producing output. Instead, it seems it would be rewriting source files in-place. That invalidates Gradle's dependency system and is bad except when run in a separate gradle invocation on non-generated source code. Even with fixing the circular dependency, I expect there will need to be further spotless configuration to exclude the generated code. I think it is inherently broken to do |
We want to force linting on every build before classes are compiled.
correct
This may be ideologically wrong, but it serves the purpose and it works fine until 0.9.x version of this plugin.
Honestly, for the majority of users of any build system, it's not important to be "pure or not pure" from the point of view of the build system. Build systems come and go. If it works and serves the purpose - it's good enough. We are not Gradle purists. |
I was getting really confused by the spotless thing, because I couldn't figure out how it worked without spotless, but I now notice:
|
No, not an ideological thing. It means your build is unsound. You are compiling .java files at the same time those files are rewritten. Whether it "works fine" could depend on things like "how many cores does your machine have" or "whether Chrome is running" or "how an object computes its hash code."
For a build without any generated code, adding the dependency to |
This discussion in Spotless: diffplug/spotless#453 shows that
is an intended usage of spotless. This approach works in our project with 0.8.x of this plugin, but with 0.9.x it leads to:
|
The reason it worked in 0.8.x is because 0.8.x was broken and wasn't adding the generated source to the source sets. Since that spotless task is for both main and test, there can be no guarantee it will work with code generated during the gradle build. Maybe it will work if we make a fix for the ksp issue or such, but there is no way to guarantee it will work unless you use separate spotless tasks for main vs test (dunno if spotless has those or not). |
Thank you for the explanation, it makes sense. In our project, we disable spotless for generated code anyway by doing |
@samzurcher, do you know why your kspKotlin depends on generateProto? I played around with the KSP playground example a wasn't able to get such a dependency naturally. |
@ejona86, we set the dependency |
* Do not use compileClasspath as source of proto files * Add failing test case for #624 * Fix codenarc problems
Fixed by #631 |
After upgrading to version 0.9.1 when we run
./gradlew build
task inside a Kotlin project we get the following error:Here is our plugins definition in the build.gradle.kts file:
Any help to fix it would be appreciated.
The text was updated successfully, but these errors were encountered: