Components is empty when apply plugin to publish aar library at rootProject build.gradle.kts

53 Views Asked by At

composing build plugin

plugins {
    `maven-publish`
}

afterEvaluate {
    publishing {
        publications {
            println(components.size)
        }
    }
}

apply plugin at rootProject path


plugins {
    //other ...
    id("common-publish") apply false
}

val publishArtifact = listOf(
    "common-dialog",//something more
)

subprojects {
    if (publishArtifact.contains(name))
        plugins.apply("common-publish")
}

and output is

0

I have try

android {
  publishing {
    singleVariant("release") {
        withSourcesJar()
    }
  }
}

But no help.

If I apply plugin at common-dialog/build.gradle.kts,

plugins {
    id("common-publish")
}

The output is expected

2

0

There are 0 best solutions below