question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle task not found

See original GitHub issue

Component: 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:closed
  • Created 5 years ago
  • Comments:30 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
AlecStrongcommented, May 9, 2019

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 use tasks.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 in projectsEvaluated, 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.

2reactions
ansmancommented, Jul 11, 2019

I believe this is due to enabling configure on demand in Gradle which somehow breaks the SQLDelight plugin.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found