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

Tasks :classpathIndexCleanup and :compileTestKotlin don't have a declared dependency causing build to fail #1515

Closed
ChristianIvicevic opened this issue Dec 25, 2023 · 2 comments
Labels
Milestone

Comments

@ChristianIvicevic
Copy link

What happened?

After scaffolding a new plugin using the template I realized that occasionally the (re)buliding the project would fail with the attached error message. Manually adding the following to my build.gradle.kts seems to resolve the issue.

tasks {
  withType<ClasspathIndexCleanupTask> {
    dependsOn(compileTestKotlin)
  }
}

Relevant log output or stack trace

21:44:10: Executing ':classes :testClasses'...

Reusing configuration cache.
> Task :initializeIntelliJPlugin SKIPPED
> Task :processTestResources NO-SOURCE
> Task :checkKotlinGradlePluginConfigurationErrors
> Task :generateLexer UP-TO-DATE
> Task :patchPluginXml UP-TO-DATE
> Task :generateParser UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :verifyPluginConfiguration
> Task :compileKotlin UP-TO-DATE
> Task :compileJava
> Task :classes
> Task :instrumentCode UP-TO-DATE
> Task :classpathIndexCleanup FAILED
> Task :compileTestKotlin FAILED
11 actionable tasks: 5 executed, 6 up-to-date
Configuration cache entry reused.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':classpathIndexCleanup' (type 'ClasspathIndexCleanupTask').
  - Gradle detected a problem with the following location: '/Users/christian.ivicevic/Code/Personal/intellij-clips/build/classes/kotlin/test/classpath.index'.
    
    Reason: Task ':classpathIndexCleanup' uses this output of task ':compileTestKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':compileTestKotlin' as an input of ':classpathIndexCleanup'.
      2. Declare an explicit dependency on ':compileTestKotlin' from ':classpathIndexCleanup' using Task#dependsOn.
      3. Declare an explicit dependency on ':compileTestKotlin' from ':classpathIndexCleanup' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':compileTestKotlin' (type 'KotlinCompile').
  - Gradle detected a problem with the following location: '/Users/christian.ivicevic/Code/Personal/intellij-clips/build/classes/kotlin/test'.
    
    Reason: Task ':classpathIndexCleanup' uses this output of task ':compileTestKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':compileTestKotlin' as an input of ':classpathIndexCleanup'.
      2. Declare an explicit dependency on ':compileTestKotlin' from ':classpathIndexCleanup' using Task#dependsOn.
      3. Declare an explicit dependency on ':compileTestKotlin' from ':classpathIndexCleanup' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 747ms
21:44:11: Execution finished ':classes :testClasses'.

Steps to reproduce

Using the template with the following gradle.properties I can trigger the error by invoking a (re)build from IntelliJ.

pluginSinceBuild=233
pluginUntilBuild=241.*
platformType=IC
platformVersion=2023.3.2
platformPlugins=
gradleVersion=8.5
kotlin.stdlib.default.dependency=false
org.gradle.configuration-cache=true
org.gradle.caching=true
systemProp.org.gradle.unsafe.kotlin.assignment=true

I am running this with our Nightly of 2024.1 in case it matters.

Gradle IntelliJ Plugin version

1.16.1

Gradle version

8.5

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

@Undin
Copy link
Contributor

Undin commented Jan 9, 2024

We in JetBrain Academy plugin have the same issue when you want to make change and run tests.
Can be reproduced with changes in any module inside intellij-plugin directory except educational-core. I don't know why everything is ok with educational-core module but my assumption is it's somehow related to module dependencies - all other modules depend on educational-core

Undin added a commit to JetBrains/educational-plugin that referenced this issue Jan 9, 2024
Previously, if you made any change in any module except `educational-core` and tried running tests, the compilation failed on `:intellij-plugin:educational-core:compileTestKotlin` task.

These changes make exactly what Gradle advices - adds dependency between `classpathIndexCleanup` and `compileTestKotlin` tasks.
See JetBrains/intellij-platform-gradle-plugin#1515
hsz added a commit that referenced this issue Jan 12, 2024
@hsz hsz added this to the next milestone Jan 12, 2024
@hsz
Copy link
Member

hsz commented Jan 12, 2024

Thanks for reporting!

@hsz hsz closed this as completed Jan 12, 2024
Undin added a commit to JetBrains/educational-plugin that referenced this issue Jan 15, 2024
Previously, if you made any change in any module except `educational-core` and tried running tests, the compilation failed on `:intellij-plugin:educational-core:compileTestKotlin` task.

These changes make exactly what Gradle advices - adds dependency between `classpathIndexCleanup` and `compileTestKotlin` tasks.
See JetBrains/intellij-platform-gradle-plugin#1515
Undin added a commit to JetBrains/educational-plugin that referenced this issue Jan 20, 2024
And drop all workarounds which are redundant anymore since the corresponding bugs are fixed in the plugin itself: JetBrains/intellij-platform-gradle-plugin#1515 and JetBrains/intellij-platform-gradle-plugin#1525
Undin added a commit to JetBrains/educational-plugin that referenced this issue Jan 26, 2024
Previously, if you made any change in any module except `educational-core` and tried running tests, the compilation failed on `:intellij-plugin:educational-core:compileTestKotlin` task.

These changes make exactly what Gradle advices - adds dependency between `classpathIndexCleanup` and `compileTestKotlin` tasks.
See JetBrains/intellij-platform-gradle-plugin#1515
Undin added a commit to JetBrains/educational-plugin that referenced this issue Jan 26, 2024
And drop all workarounds which are redundant anymore since the corresponding bugs are fixed in the plugin itself: JetBrains/intellij-platform-gradle-plugin#1515 and JetBrains/intellij-platform-gradle-plugin#1525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants