Conversation
| import org.apache.tools.zip.ZipEntry | ||
| import org.apache.tools.zip.ZipOutputStream |
There was a problem hiding this comment.
Can't we use Java's ZipOutputStream?
There was a problem hiding this comment.
This comes from shadow jar dependency, because it is using in transform interface functions
| target.plugins.withId("org.gradle.maven-publish") { | ||
| target.tasks.withType(PublishToMavenRepository::class.java) { | ||
| val publication = publication | ||
| if (publication is DefaultMavenPublication) { | ||
| if (creationConfig.name == publication.component.get().name) { | ||
| dependsOn(greaseShadowTask) | ||
| } | ||
| } |
There was a problem hiding this comment.
This looks wrong to me. Can you explain what's your goal here? There should be a more a robust solution.
There was a problem hiding this comment.
There was problem with publication, because publish task doesnt wait grease tasks, so grease task will be executed after publication and final aar will be incorrect. Therefore i made publish task to execute after grease task for common cases
There was a problem hiding this comment.
The main problem is that people should be able to rely on bundle AAR task in all scenarios, without tricks like this one which only solves the publication use-case. We can fix this later though, I'll open an issue with some ideas without using finalizedBy.
Another problem is that code above may crash at component.get(). You can do component.getOrNull() but then it may be added later and you don't catch that.
Maybe it'd be better to iterate over components?
project.components.matching { it.name == creationConfig.name }.all {
tasks.matching { it.name == "generate${creationConfig.name.capitalize()}PomFileForPublication" }.configureEach {
mustRunAfter(greaseShadowTask)
}
}
There was a problem hiding this comment.
Maybe, but there is so many publish tasks and we can skip one of them. Also we are configuring grease after evaluation so i think everything should be good
Fixes #6