Hello! In my gradle plugin I have feature that ver...
# android
y
Hello! In my gradle plugin I have feature that verifies Manifest. I used new API’s (
@get:InputFile
and
mergedManifest.set(variant.artifacts.get(SingleArtifact.MERGED_MANIFEST))
). Task works, but it is not attached to default AGP build pipeline. I mean when I call it manually - it works, but when I just assemble project - task is not executed. My question is how to attach my task to default build pipeline? So if I want to check manifest I need to wait until “processManifest” task finishes. In my case, if I call my custom manifest verification task manually - my tasks successfully executes after AGP “processManifest” task, but, when I just build project in AS - my task is not executed after “processManifest”. Previously I used just
dependsOn
and stuff like that, but now as I understand it is not what expected? Maybe I need to use “wire” API’s but all these methods need some output, but I don’t have any. My task needs just input. Here is the code: Task creation
Copy code
fun createManifestCheckerTask(project: Project, variant: Variant) {
        val taskProvider = project.tasks.register(
            "networkSecurityConfigCheckerTask${variant.name.capitalize()}",
            NetworkSecurityConfigCheckerTask::class.java
        ) {
            it.group = GROUP_NAME
            it.mergedManifest.set(variant.artifacts.get(SingleArtifact.MERGED_MANIFEST))
        }
    }
Task
Copy code
abstract class NetworkSecurityConfigCheckerTask : DefaultTask() {

    @get:InputFile
    abstract val mergedManifest: RegularFileProperty

    @TaskAction
    fun checkNetworkSecurityConfig() {
        val mergedManifestFile = mergedManifest.get().asFile

        //...
    }
}
1
x
We do not have an API for this yet. You can star this issue: https://issuetracker.google.com/232323922
1