From 22f22bf65c956194bfec725102034a0bdd72dd18 Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 1 Dec 2020 10:56:32 +0800 Subject: [PATCH] Include all configuration when generating metadata --- tools/gradle-plugin/src/publishing.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/gradle-plugin/src/publishing.kt b/tools/gradle-plugin/src/publishing.kt index 42a5357ba..66ce45d01 100644 --- a/tools/gradle-plugin/src/publishing.kt +++ b/tools/gradle-plugin/src/publishing.kt @@ -13,6 +13,7 @@ import com.google.gson.Gson import com.jfrog.bintray.gradle.tasks.BintrayUploadTask import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.artifacts.Configuration import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.TaskContainer import org.gradle.api.tasks.bundling.Jar @@ -98,10 +99,15 @@ private fun Project.registerPublishPluginTasks(target: KotlinTarget, isSingleTar val output = outputs.files.singleFile output.parentFile.mkdir() - val dependencies = configurations[target.compilations["main"].apiConfigurationName].allDependencies.map { - "${it.group}:${it.name}:${it.version}" + fun getConfigurationsToInclude(): List { + val compilation = target.compilations["main"] + return compilation.relatedConfigurationNames.map { configurations[it] } } + val dependencies = getConfigurationsToInclude().flatMap { it.allDependencies }.map { + "${it.group}:${it.name}:${it.version}" + }.distinct() + val json = Gson().toJson(PluginMetadata( groupId = mirai.publishing.groupId ?: project.group.toString(), artifactId = mirai.publishing.artifactId ?: project.name, @@ -114,6 +120,8 @@ private fun Project.registerPublishPluginTasks(target: KotlinTarget, isSingleTar output.writeText(json) } + + Unit } val bintrayUpload = tasks.getByName(BintrayUploadTask.getTASK_NAME()).dependsOn(