Kotlin module support by 0xera · Pull Request #7 · deepmedia/Grease

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
    }
}