Skip to content

Commit

Permalink
Managed by Terraform, updates managed through: https://github.com/Air…
Browse files Browse the repository at this point in the history
  • Loading branch information
airthings-atlantis committed Dec 2, 2024
1 parent e50057c commit 0c1ce4e
Showing 1 changed file with 40 additions and 54 deletions.
94 changes: 40 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,74 +1,60 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
import com.airthings.buildtools.util.Dependencies
import com.airthings.buildtools.util.Library
import com.airthings.buildtools.util.testImplementationAll

group = "io.kotless"
group = "com.airthings.cloud.kotless"

plugins {
id("io.gitlab.arturbosch.detekt") version ("1.15.0") apply true
kotlin("jvm") version "1.8.0" apply false
`java-library`
`maven-publish`
}

subprojects {
apply {
plugin("kotlin")
plugin("maven-publish")
plugin("io.gitlab.arturbosch.detekt")
}
kotlin {
explicitApi()
}

repositories {
mavenCentral()
gradlePluginPortal()
maven(url = uri("https://packages.jetbrains.team/maven/p/ktls/maven"))
}
repositories {
mavenCentral()
}

val sourceSets = this.extensions.getByName("sourceSets") as SourceSetContainer
dependencies {
testImplementationAll(*Dependencies.kotest)
testImplementationAll(*Dependencies.moshi)
testImplementation(Dependencies.kotlinsnapshot)
implementation(Dependencies.sensortype)
}

val latestTag = command("git describe --tags --abbrev=0") ?: "dummy.version" // dummy version for builds != deployment/publish

task<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"]!!.allSource)
}
subprojects {
version = latestTag
}

publishing {
repositories {
maven {
name = "AirthingsGitHubPackages"
url = uri("https://maven.pkg.github.com/airthings/lib-kotless")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register("libKotless", MavenPublication::class) {
from(components["java"])
publishing {
repositories {
maven {
name = "AirthingsGitHubPackages"
url = uri("https://maven.pkg.github.com/airthings/lib-kotless")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
tasks.withType<KotlinJvmCompile> {
kotlinOptions {
jvmTarget = "11"
}
}

detekt {
parallel = true

config = rootProject.files("detekt.yml")

reports {
xml {
enabled = false
}
html {
enabled = false
publications {
withType<MavenPublication> {
pom {
artifactId = "kotless"
}
}
}
}

afterEvaluate {
System.setProperty("gradle.publish.key", System.getenv("gradle_publish_key") ?: "")
System.setProperty("gradle.publish.secret", System.getenv("gradle_publish_secret") ?: "")
}
fun command(command: String): String? {
val cmd = command.split(" ").toTypedArray()
val process = ProcessBuilder(*cmd)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.start()
return process.inputStream.bufferedReader().readLine()?.trim()
}

0 comments on commit 0c1ce4e

Please sign in to comment.