Slackbot
07/20/2023, 2:34 PMMartin
07/20/2023, 2:39 PMJakub Chrzanowski
07/20/2023, 2:44 PMdependencies {
implementation(intellijIdeaCommunity("2023.1"))
}
and this intellijIdeaCommunity helper creates for them:
create(
group = "com.jetbrains.intellij.idea",
name = "ideaIC",
version = "2023.1",
ext = "zip"
)
Can I request here an immediate transformation?wolfs
07/20/2023, 2:53 PMimplementation 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?Jakub Chrzanowski
07/20/2023, 3:09 PMimplementation 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.wolfs
07/20/2023, 3:10 PMimplementation configuration and that are resolvable. The implementation configuration is not resolvable. All the resolvable configurations would need to request the new attribute.Jakub Chrzanowski
07/20/2023, 3:15 PMwolfs
07/20/2023, 3:16 PMimplementation configuration. For example the compileClasspath configuration.Jakub Chrzanowski
07/20/2023, 3:33 PMChris Lee
07/20/2023, 3:34 PMwolfs
07/20/2023, 3:34 PMcompileClasspath. You add the dependency to implementation and the requested attributes to the actually resolved configuration, like compileClasspath.Adam
07/20/2023, 4:08 PM_ijPluginDependencies)
2. in your plugin’s DSL add an additional option, like intellijIdeaCommunityVersion, that users can configure
intelliJGradlePluginOptions {
intellijIdeaCommunityVersion.set("1.2.3")
}
3. Under the hood, map intellijIdeaCommunityVersion into a dependency
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.Jakub Chrzanowski
07/26/2023, 11:37 AMintellijPlatformConfiguration("com.jetbrains.intellij.idea:ideaIC:2023.1")
This configuration has this attribute specified:
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? 🙂Martin
07/26/2023, 2:31 PM