Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Plugin source code not available in IntelliJ #3642

Closed
aSemy opened this issue Nov 5, 2022 · 7 comments
Closed

Gradle Plugin source code not available in IntelliJ #3642

aSemy opened this issue Nov 5, 2022 · 7 comments
Labels

Comments

@aSemy
Copy link
Contributor

aSemy commented Nov 5, 2022

Description

I have applied the SQLDelight Gradle Plugin to my Gradle project. Everything works, but I would like to see the source code to find out more about how to configure the plugin.

// buildSrc/build.gradle.kts

dependencies {
  implementation(""com.squareup.sqldelight:gradle-plugin:1.5.4)
}
// build.gradle.kts

plugins {
  kotlin("multiplatform") version "1.7.20
  com.squareup.sqldelight
}

...

sqldelight {
  linkSqlite
  database("Database") {
    packageName = "com.example"
  }
}

When I ctrl+click on linkSqlite in the sqldelight block, I'm taken to a decompiled .class file

image

I would like to be able to ctrl+click and go to the source code, so that I can see what options are available, and what they do.

Versions:

  • SQLDelight 1.5.4
  • Gradle 7.5.1
  • Kotlin Multiplatform 1.7.20
@hfhbd
Copy link
Collaborator

hfhbd commented Nov 18, 2022

Hm, the source jars are available:

https://repo.maven.apache.org/maven2/com/squareup/sqldelight/gradle-plugin/1.5.4/
https://repo.maven.apache.org/maven2/app/cash/sqldelight/gradle-plugin/2.0.0-alpha04/

and I can't reproduce this with a simple test project, using 2.0.0-alpha04 as well as 1.5.4

@hfhbd
Copy link
Collaborator

hfhbd commented Nov 18, 2022

Edit: Okay, I am able to reproduce it.

You need a buildSrc, add sqldelight plugin as an implementation dependency, but configure the plugin in the usual way in the build scripts. The sources are available in the buildSrc, but not in the build scripts.

But I have no idea, why resolving the sources jar is possible inside buildSrc, but not in the scripts.

@aSemy
Copy link
Contributor Author

aSemy commented Nov 25, 2022

Thanks for the update, it's good that someone else is able to reproduce it.

Perhaps the problem is caused by the SQLDelight plugin not being published on the Gradle Plugin Portal, so IntelliJ can't find the sources?

@hfhbd
Copy link
Collaborator

hfhbd commented Nov 25, 2022

Maybe, but IntelliJ is able to get the source when using it directly in the scripts. So the question is, do we need something to fix, or is this a bug in IntelliJ?
AFAIK square/cash doesn't publish to the Gradle portal, only to maven central, and this won't change. I don't work at cash, so correct me if I am wrong @JakeWharton

square/wire#1944 (comment)
#570

@aSemy
Copy link
Contributor Author

aSemy commented Nov 25, 2022

It might be an IntelliJ issue, but I'm not sure https://youtrack.jetbrains.com/issue/IDEA-306776

My guess is that the SQLDelight plugin isn't following the Gradle API in a traditional way (for example, #3643), and that's causing problems with IntelliJ.

@aSemy
Copy link
Contributor Author

aSemy commented Nov 25, 2022

I've opened up the SQDelight Gradle Plugin sources jar locally, and it looks like it's missing the sources that are shaded into the jar.

image

There's no com.squareup.sqldelight.core.lang.SqlDelightFileType, but this class is an import for SqlDelightDatabase. If I open up com.squareup.sqldelight.core.lang.SqlDelightFileType directly, then yes, I can see the sources - but only if I open up the class for the SQLDelight core jar.

It makes sense that the source files of shaded dependencies aren't included, but perhaps the missing source files causes IntelliJ to consider the source jar unsuitable, and so it discards it?

@hfhbd
Copy link
Collaborator

hfhbd commented May 3, 2023

Is this issue still reproducible after #4079 which removes the shadowing?
Please comment otherwise I will close this issue.

@hfhbd hfhbd closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants