commonMain.co.touchlab.skie.plugin.analytics.environment.GradleEnvironmentAnalytics.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin-impl-jvm Show documentation
Show all versions of gradle-plugin-impl-jvm Show documentation
Internal implementation for SKIE Gradle plugin.
package co.touchlab.skie.plugin.analytics.environment
import co.touchlab.skie.configuration.SkieConfigurationFlag
import co.touchlab.skie.plugin.analytics.AnalyticsProducer
import co.touchlab.skie.plugin.util.toPrettyJson
import co.touchlab.skie.gradle_plugin_impl.BuildConfig
import co.touchlab.skie.util.SystemProperty
import io.cloudflight.ci.info.CI
import org.gradle.api.provider.Provider
data class GradleEnvironmentAnalytics(
val jvmVersion: String,
val skieVersion: String,
val gradleVersion: String,
val kotlinVersion: String,
val macOSVersion: String,
val ci: String?,
val timestampInMs: Long,
) {
class Producer(
private val gradleVersion: Provider,
private val kotlinPluginVersion: Provider,
) : AnalyticsProducer {
override val name: String = "gradle-environment"
override val configurationFlag: SkieConfigurationFlag = SkieConfigurationFlag.Analytics_GradleEnvironment
override fun produce(): String =
GradleEnvironmentAnalytics(
jvmVersion = Runtime.version().toString(),
skieVersion = BuildConfig.SKIE_VERSION,
gradleVersion = gradleVersion.get(),
kotlinVersion = kotlinPluginVersion.get(),
macOSVersion = SystemProperty.find("os.version") ?: "",
ci = CI.server?.serverName,
timestampInMs = System.currentTimeMillis(),
).toPrettyJson()
}
}