Gradle task not found
See original GitHub issueComponent: sqldelight-gradle-plugin Version: both 1.1.0-SNAPSHOT and 1.2.0-SNAPSHOT
Configuration: build.gradle.kts (common)
plugins {
kotlin("multiplatform")
id("com.squareup.sqldelight")
}
apply(from = File("sqldelight.gradle"))
// ...
sqldelight.gradle (common)
sqldelight {
TodoSqlDelightDatabase {
packageName = "com.sample.todo.data.sqldelight"
sourceFolders = ["sqldelight"]
schemaOutputDirectory = file("src/main/sqldelight/migrations")
}
}
Step to reproduce:
gradlew common:tasks
// ...
Sqldelight tasks
----------------
generateAndroidMainTodoSqlDelightDatabaseInterface - Generate androidMain Kotlin interface for TodoSqlDelightDatabase
generateAndroidMainTodoSqlDelightDatabaseSchema - Generate a .db file containing the current TodoSqlDelightDatabase schema for androidMain.
generateMetadataMainTodoSqlDelightDatabaseInterface - Generate metadataMain Kotlin interface for TodoSqlDelightDatabase
generateMetadataMainTodoSqlDelightDatabaseSchema - Generate a .db file containing the current TodoSqlDelightDatabase schema for metadataMain.
verifyAndroidMainTodoSqlDelightDatabaseMigration - Verify androidMain TodoSqlDelightDatabase migrations and CREATE statements match.
verifyMetadataMainTodoSqlDelightDatabaseMigration - Verify metadataMain TodoSqlDelightDatabase migrations and CREATE statements match.
// ...
gradlew common:generateMetadataMainTodoSqlDelightDatabaseInterface
Configuration on demand is an incubating feature.
> Configure project :common
Kotlin Multiplatform Projects are an experimental feature.
Configuring compileKotlinAndroid in project common...
Configuring compileTestKotlinAndroid in project common...
FAILURE: Build failed with an exception.
* What went wrong:
Task 'generateMetadataMainTodoSqlDelightDatabaseInterface' not found in project ':common'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to g
et full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Issue Analytics
- State:
- Created 5 years ago
- Comments:30 (2 by maintainers)
Top Results From Across the Web
Trying Gradle build - "Task 'build' not found in root project"
The first one will use the gradlew command found in the .. directory ( mdeinum... ), and look for the build file to...
Read more >Build failed with an exception - Task not found in root project
Gradle FAILURE: Build failed with an exception - Task not found in root project · Make sure that the task that you are...
Read more >Task 'install' not found in root project - Gradle Forums
i can run gradle build command successfully but when i run 'gradle build install' or 'gradle install' i get error - Task 'install'...
Read more >task 'classes' not found · Issue #5 · n0mer/gradle-git-properties
gradle -git-properties'] > Task with name 'classes' not found in root project 'my-project'. It looks like it assumes that I will have a...
Read more >Task 'assemble' not found in root project when configuration ...
Gradle sync seems to work correctly but when I try to build the project (CTRL+F9) the following error is raised: Task 'assemble' not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
turns out this is actually preventing us from upgrading the sample to 1.1.3 because we use configure on demand for CI, so this is pretty high priority
I’m going to need to rethink the sqldelight gradle lifecycle more. It’s too late to rework things right now but here’s what I think needs to be done:
Right now we rely on
projectsEvaluated
to add the sqldelight tasks and dependencies to the task graph, this doesnt work for configuration on demand. It’s not super clear why, I’m assuming the time which that callback gets invoked is different with COD and its too late to set task dependencies.That’s pretty hacky regardless, so probably what we need to do is use task creation callbacks instead of project evaluation callbacks. The original problem was that kotlin multiplatform adds the android compilation tasks late in gradles lifecycle, and
projectsEvaluated
always invoked after that. Instead we should probably usetasks.whenTaskAdded
to add sqldelight task dependencies when the kotlin compilation tasks are added.There’s also some implications for multi-module here, since module properties are initialized during
afterEvaluate
blocks, we were assuming they’re set up when creating tasks inprojectsEvaluated
, but if we switch to task creation that probably won’t hold, so we’ll also need to make sure the downstream sqldelight module is configured, which probably requires more understanding of how gradle implements configure on demand.I believe this is due to enabling configure on demand in Gradle which somehow breaks the SQLDelight plugin.