utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
576 stars 39 forks source link

Gradle Plugin project crashes when running the "tasks" target #551

Closed MartinHaeusler closed 6 months ago

MartinHaeusler commented 8 months ago

Steps to reproduce:

  1. Check out the latest version of the godot-kotlin-jvm project (my git head is at 3467768b9da6c9bc619929c07ecdce26752881d9).
  2. cd kt
  3. ./gradlew tasks (this should produce a list of all available gradle tasks)

What I expected:

I expected gradle to output a list of tasks I can run on it, perhaps with some descriptions.

What happened instead:

First of all, gardle starts to actually run some tasks in :godot-library, which is already weird (I just asked for a task listing). This isn't exactly ideal.

But the real issue is that the overall "build" fails:

* What went wrong:
Execution failed for task ':tasks'.
> Could not create task ':processIdeaSettings'.
   > Cannot set the value of task ':processIdeaSettings' property 'service' of type org.jetbrains.gradle.ext.LayoutFileBuildService using a provider of type org.jetbrains.gradle.ext.LayoutFileBuildService.

Unfortunately running it with --stacktrace doesn't provide a whole lot more insight. Given the fact that both classes seem to have the same qualified name, I assume that a classloading issue is lurking somewhere.

chippmann commented 8 months ago

Good catch! It seems we broke that since the last release. Will fix that before the next release

chippmann commented 8 months ago

Ok i narrowed it down to our preprocessor gradle plugin. Removing that fixes the issue. I'll have a look what causes this. @piiertho FYI

chippmann commented 8 months ago

The problem seems to lay here:

        project.rootProject.ideaExtension.project.settings {
            taskTriggers {
                afterSync(generationTask)
            }
        }

        project.ideaExtension.apply {
            module {
                generatedSourceDirs.add(generatedKotlinDefinitionsDirectory)
            }
        }

@piiertho any reason we do the preprocessing after the sync? I think this could be done before the kotlin compile tasks no? This would also enable us to remove the gradle-idea-ext dependency.

chippmann commented 8 months ago

Ok the issue is related to #549 I'll submit corresponding PR's to this project and the preprocessor project once #549 is merged

piiertho commented 8 months ago

The problem seems to lay here:

        project.rootProject.ideaExtension.project.settings {
            taskTriggers {
                afterSync(generationTask)
            }
        }

        project.ideaExtension.apply {
            module {
                generatedSourceDirs.add(generatedKotlinDefinitionsDirectory)
            }
        }

@piiertho any reason we do the preprocessing after the sync? I think this could be done before the kotlin compile tasks no? This would also enable us to remove the gradle-idea-ext dependency.

This is because we want intellij to regen pre processor generated kotlin files. Hence why we use gradle-idea-ext and after sync.

chippmann commented 6 months ago

was also fixed by #549