This message was deleted.
# plugin-development
s
This message was deleted.
m
Is any configuration requesting "artifactType=unzipped"?
j
No. Basically I’d not want to introduce any custom configurations but rely on what end-user does. Like:
Copy code
dependencies {
    implementation(intellijIdeaCommunity("2023.1"))
}
and this
intellijIdeaCommunity
helper creates for them:
Copy code
create(
    group = "com.jetbrains.intellij.idea",
    name = "ideaIC",
    version = "2023.1",
    ext = "zip"
)
Can I request here an immediate transformation?
w
You added the dependency you showed to the
implementation
configuration. That configuration is never resolved. You’d need to add the requested
artifactType: unzipped
attribute to all/one of the configurations that is being resolved and used. Where do you expect the unzipped file to show up?
j
This unzipped dependency should appear on the
implementation
or
testImplementation
list at the very specific position. I’m hesitant from pushing that to a separated configuration because user won’t be able to control the dependencies order. And this is important because
unzipped
IntelliJ SDK contains multiple bundled dependencies that one may want to replace with never version; or use bundled IntelliJ SDK dependency instead of some transitive dependency of their direct dependency. If I push unzipped IntelliJ SDK to a separated custom configuration, its dependencies can’t be mixed with `implementation`’s dependencies.
w
There are already a few separate configurations that extend from the
implementation
configuration and that are resolvable. The
implementation
configuration is not resolvable. All the resolvable configurations would need to request the new attribute.
j
So I won’t run away from custom configurations then. Can I still control where some dependencies appear on the list? Like:
w
You don’t need to create a custom configuration. There are already configurations that extend from the
implementation
configuration. For example the
compileClasspath
configuration.
j
Sure but dependencies added to such a configuration eventually go to the bottom of the list, right?
c
what’s the importance of the order in the list?
w
You can’t add things to
compileClasspath
. You add the dependency to
implementation
and the requested attributes to the actually resolved configuration, like
compileClasspath
.
a
if you want to streamline the process, and hide as many configuration options as possible from users, what might work is 1. create a custom configuration. (You could even hide it by giving it a name that contains characters unsuitable for a DSL accessor, e.g.
_ijPluginDependencies
) 2. in your plugin’s DSL add an additional option, like
intellijIdeaCommunityVersion
, that users can configure
Copy code
intelliJGradlePluginOptions {
  intellijIdeaCommunityVersion.set("1.2.3")
}
3. Under the hood, map
intellijIdeaCommunityVersion
into a dependency
Copy code
val ijPluginDependencies = project.configurations.register("_ijPluginDependencies") {
  isCanBeResolved = true
  isCanBeResolved = false
  withDependencies {
    addLater(
      intellijIdeaCommunityVersion.map { v ->
        project.dependencies.create(
          group = "com.jetbrains.intellij.idea",
          name = "ideaIC",
          version = v,
          ext = "zip"
        )
      }
    )
  }
}
4. resolve the dependencies added to
ijPluginDependencies
, and unzip them by either 4A) figuring out artifact transformation (which I don’t recommend because I’ve always found it too confusing!). And then make the ‘implementation’ configuration extend from your custom ijPluginDependencies configuration 4B) create a custom task that will unpackage the zip into a local directory (much easier to get this working). And then add the unpackaged files to the ‘implementation’ configuration.
💯 1
j
Thank you for all clarifications, folks! So currently I’m adding the IntelliJ SDK ZIP artifact to the project using `intellijPlatformConfiguration`:
Copy code
intellijPlatformConfiguration("com.jetbrains.intellij.idea:ideaIC:2023.1")
This configuration has this attribute specified:
Copy code
attribute(ARTIFACT_TYPE_ATTRIBUTE, "intellijPlatform")
And my transformer is registered for
from: zip; to: intellijPlatform
So now when
intellijPlatformConfiguration
is resolved, transformer gets invoked and the archive gets extracted to:
/Users/hsz/.gradle/caches/transforms-3/81738d59e34e305f6963a23f194cfb2f/transformed/ideaIC-2023.1
(path is created using
TransformOutputs
). However, despite the
implementation
configuration extendsFrom this custom configuration, this transformed artifact doesn’t appear in the module’s dependencies list — just the
zip
artifact type, which still points to the ZIP archive. Any ideas how to replace ZIP with extracted content? 🙂
m
I don't really trust IntelliJ dialogs for this kind of things. Is there other issues that the dialog showing a zip? Could be an IDE problem only?