forked from JetBrains/kotless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Managed by Terraform, updates managed through: https://github.com/Air…
- Loading branch information
1 parent
e50057c
commit 0c1ce4e
Showing
1 changed file
with
40 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |