SpineEventEngine / validation

Apache License 2.0
3 stars 0 forks source link

Update dependencies, enforce `generatedFilesBaseDir` #79

Closed alexander-yevsyukov closed 1 year ago

alexander-yevsyukov commented 1 year ago

This PR:

More on generatedFilesBaseDir fix

The problem is that generated-proto/test directory, if not deleted, is taken as a compilation input, while generated/test directory (produced by ProtoData) is available too. Removing the generated-proto/test directory in the build script resulted in the following error:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':java-tests:vanilla:compileTestKotlin'.
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
...
Caused by: java.lang.IllegalStateException: Changes are not tracked, unable determine incremental changes.
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.lambda$determineInputChanges$0(ResolveInputChangesStep.java:116)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.determineInputChanges(ResolveInputChangesStep.java:116)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:47)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
    at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:181)
    at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$1(BuildCacheStep.java:71)
...

This error was caused by the build.gradle.kts code which did this:

/**
 * Workaround related to https://github.com/SpineEventEngine/validation/issues/69 to ease
 * the issue with IDEA not being able to locate Kotlin DSL.
 */
val launchTestProtoData: Task by tasks.getting {
    doLast {
        delete("$buildDir/generated-proto/test")
    }

This did not result in build failure under macOS M1 Pro. It occurs only during the GitHub builds.

If generated-proto/test was not deleted, vanilla-Protobuf code was coming first, and our custom generated code was not visible in the test, which resulted in the compile time error. Hence the reference to the issue #69 in the comments of the removal arrangement.

So, manually setting generatedFilesBaseDir to $projectDir/generated avoids the “duplication” of sources, and also does not require the removal. Thus avoiding the racing error on CI builds.

In order to resolve the issue for good, we need to migrate to Protobuf Gradle Plugin v0.9.2 and use task inputs and outputs gracefully.

codecov[bot] commented 1 year ago

Codecov Report

Merging #79 (68f918c) into master (8532211) will decrease coverage by 0.03%. The diff coverage is 30.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #79 +/- ## ============================================ - Coverage 43.53% 43.51% -0.03% Complexity 442 442 ============================================ Files 122 122 Lines 2653 2652 -1 Branches 213 213 ============================================ - Hits 1155 1154 -1 Misses 1449 1449 Partials 49 49 ```