How do I fix this gradle error? ```* What went wro...
# gradle
m
How do I fix this gradle error?
Copy code
* What went wrong:
A problem was found with the configuration of task ':site-frontend:webProductionExecutableCompileSync' (type 'DefaultIncrementalSyncTask').
  - Gradle detected a problem with the following location: '/home/mart/nintendo-posts/build/js/packages/nintendo-today-site-site-frontend-web/kotlin'.
    
    Reason: Task ':site-frontend:webBrowserDevelopmentWebpack' uses this output of task ':site-frontend:webProductionExecutableCompileSync' 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 ':site-frontend:webProductionExecutableCompileSync' as an input of ':site-frontend:webBrowserDevelopmentWebpack'.
      2. Declare an explicit dependency on ':site-frontend:webProductionExecutableCompileSync' from ':site-frontend:webBrowserDevelopmentWebpack' using Task#dependsOn.
      3. Declare an explicit dependency on ':site-frontend:webProductionExecutableCompileSync' from ':site-frontend:webBrowserDevelopmentWebpack' using Task#mustRunAfter.
    
    For more information, please refer to <https://docs.gradle.org/8.11/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
From what I can tell I touch neither of these tasks in my build.gradle.kts, nor do I touch those generated files.
m
Find or file a bug in the plugin that is responsible for these tasks and add the workaround to your build script until they fix it
Something like:
Copy code
tasks.named("webBrowserDevelopmentWebpack").configure {
  dependsOn("webProductionExecutableCompileSync")
}
(Maybe wrapped in any number of
afterEvaluate {}
if those tasks are created after your build scripts)
m
I think it's part of the built-in kotlin plugin that made these tasks?
v
Most probably the same as https://youtrack.jetbrains.com/issue/KT-56305/KJS-Gradle-Suboptimal-implementation-of-tasks, just with the webpack tasks instead of the run tasks.
As a work-around, you should probably not run development and production tasks in the same Gradle run as it then gets majorly confused by the borked setup of the KGP tasks.
m
I'm not suire why the development build runs, I've set it to only use the production build as artifact for this subproject, unless the
build
task somehow adds development as task?