Use build config for compiler plugin coordinates

This commit is contained in:
Brian Norman
2020-09-05 22:50:50 -05:00
parent 0de9c80ba6
commit 22a1e16324
4 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# kotlin-power-assert
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.bnorm.power/kotlin-power-assert/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.bnorm.power/kotlin-power-assert)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.bnorm.power/kotlin-power-assert-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.bnorm.power/kotlin-power-assert-plugin)
Kotlin Compiler Plugin which high-jacks Kotlin assert function calls and
transforms them similar to [Groovy's Power Assert feature][groovy-power-assert].
+1
View File
@@ -2,6 +2,7 @@ plugins {
kotlin("jvm") version "1.4.0" apply false
id("org.jetbrains.dokka") version "0.10.0" apply false
id("com.gradle.plugin-publish") version "0.11.0" apply false
id("com.github.gmazzo.buildconfig") version "2.0.2" apply false
}
allprojects {
+9 -1
View File
@@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("java-gradle-plugin")
kotlin("jvm")
id("com.gradle.plugin-publish")
id("com.github.gmazzo.buildconfig")
}
dependencies {
@@ -12,6 +12,14 @@ dependencies {
implementation(kotlin("gradle-plugin-api"))
}
buildConfig {
val project = project(":kotlin-power-assert-plugin")
packageName(project.group.toString())
buildConfigField("String", "PLUGIN_GROUP_ID", "\"${project.group}\"")
buildConfigField("String", "PLUGIN_ARTIFACT_ID", "\"${project.name}\"")
buildConfigField("String", "PLUGIN_VERSION", "\"${project.version}\"")
}
pluginBundle {
website = "https://github.com/bnorm/kotlin-power-assert"
vcsUrl = "https://github.com/bnorm/kotlin-power-assert.git"
@@ -33,15 +33,15 @@ class PowerAssertGradlePlugin : KotlinCompilerPluginSupportPlugin {
override fun getCompilerPluginId(): String = "com.bnorm.kotlin-power-assert"
override fun getPluginArtifact(): SubpluginArtifact = SubpluginArtifact(
groupId = "com.bnorm.power",
artifactId = "kotlin-power-assert-plugin",
version = "0.6.0-SNAPSHOT"
groupId = BuildConfig.PLUGIN_GROUP_ID,
artifactId = BuildConfig.PLUGIN_ARTIFACT_ID,
version = BuildConfig.PLUGIN_VERSION
)
override fun getPluginArtifactForNative(): SubpluginArtifact = SubpluginArtifact(
groupId = "com.bnorm.power",
artifactId = "kotlin-power-assert-plugin-native",
version = "0.6.0-SNAPSHOT"
groupId = BuildConfig.PLUGIN_GROUP_ID,
artifactId = BuildConfig.PLUGIN_ARTIFACT_ID + "-native",
version = BuildConfig.PLUGIN_VERSION
)
override fun applyToCompilation(