Sqldelight: Gradle Configuration Failing when Applying Plugin to JVM only project

Created on 11 Jun 2019  路  16Comments  路  Source: cashapp/sqldelight

When applying the plugin to a kotlin jvm project configuration of the project fails with the following.

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.3.0.
     Searched in the following locations:
       - file:/Users/areitz/.gradle/caches/5.5-rc-2/embedded-kotlin-repo-1.3.31-3/repo/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
       - https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
       - https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
       - https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
     Required by:
         project : > com.squareup.sqldelight:gradle-plugin:1.1.3

I believe the issue is that the plugin depends on the android build tools to be present, even when not applicable for the project the plugin is being applied to.

Adding the google() repository for plugin management solves the issue, but I think maybe a better solution would be to have the android build tools be an optional dependency.

gradle-plugin enhancement

Most helpful comment

I am officially licking this cookie. Progress has been made and I just need to get all the tests updated.

All 16 comments

we would have to publish a separate plugin in order to remove the dependency on the android gradle plugin.

I agree its not fantastic that for non-android builds you need the google repo added, I'll think about it some more but I'm not sure what the best approach is

I know how to remove the dep. Will PR soon!

Seeing this same issue

Same here on version 1.2.2. Could the AGP be made a compileOnly dependency ?

Feel free to try. Most of the work has been done, but there's some left.

@JakeWharton do u still know how to do this. would be super nice to have now that we support server

I can give it an attempt again. What needs done is easy, figuring out why it wasn't working was the problem!

If you get stuck I can take a look

I am officially licking this cookie. Progress has been made and I just need to get all the tests updated.

hype hype hype hype

you can lick all the sqldelight bug cookies you want my man

I am officially licking this cookie

This is a very graphic image for me.

It's normally a negative term since it means the person also doesn't deliver: https://devblogs.microsoft.com/oldnewthing/20091201-00/?p=15843

...and maybe I won't, but I solved the actual problem and now it's just boring work to update all the tests. So I probably will.

I have sent a PR to make the AGP dependency optional, but in the time since we started using SparseArray from androidx.collection which requires the google() repository. That can be fixed separately. Feel free to send a PR since I'm burned out on the compileOnly change for a few days.

Resolved @JakeWharton's comment above (https://github.com/cashapp/sqldelight/issues/1362#issuecomment-665281603) in https://github.com/AlecStrong/sql-psi/pull/148.

Both fixes are in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mkruczkowski picture mkruczkowski  路  4Comments

kuhnroyal picture kuhnroyal  路  4Comments

LouisCAD picture LouisCAD  路  5Comments

Nimrodda picture Nimrodda  路  4Comments

treelzebub picture treelzebub  路  3Comments