Kotlin DSL for Gradle: Custom Task Not Executing in Specific Build Types
I'm reviewing some code and I'm maintaining legacy code that Quick question that's been bugging me - I'm trying to create a custom Gradle task in my Kotlin DSL build script that should run only for the 'release' build type..... However, when I attempt to execute the task, it seems like it doesn't trigger for the release build but works fine for debug. Hereโs the relevant part of my `build.gradle.kts`: ```kotlin android { // Other configurations buildTypes { getByName("release") { // Custom task definition tasks.register("myCustomTask") { doLast { println("Running custom task for release build") } } } } } ``` Iโve tried moving the task definition outside of the `buildTypes` block and simply checking the `project.gradle.startParameter.taskNames` for the task name, but it still doesnโt execute when I build the release version. I also checked the task dependencies, and nothing seems to be blocking it. When I run the release build using `./gradlew assembleRelease`, I expect to see the output from my custom task, but itโs not printed. Instead, I see the usual build output without any indication that my task was executed. The only output I see is from the standard build process. Any insights on what might be going wrong here or how to properly configure this task to ensure it runs during the release build? I'm working on a application that needs to handle this. What am I doing wrong? Am I missing something obvious? This issue appeared after updating to Kotlin 3.11. What are your experiences with this? For reference, this is a production mobile app. Any ideas how to fix this?