Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ max_line_length = 150
indent_style = space
charset = utf-8

[*.kt]
indent_size = 2

[*.yml]
indent_size = 2
133 changes: 69 additions & 64 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
kotlin("multiplatform") version "1.9.22"
id("com.android.library") version "7.4.2"

id("org.jetbrains.dokka") version "1.9.10"
`maven-publish`

id("com.diffplug.spotless") version "6.23.3"

id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
`maven-publish`
signing
id("io.gitlab.arturbosch.detekt") version "1.18.0"
id("com.android.library") version "7.4.2"
id("com.diffplug.spotless") version "6.23.3"
}


apply("versions.gradle.kts")

group = "io.github.oshai"
Expand All @@ -27,18 +27,6 @@ repositories {
mavenCentral()
}

nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USERNAME_2")) // defaults to project.properties["myNexusUsername"]
password.set(System.getenv("SONATYPE_PASSWORD_2")) // defaults to project.properties["myNexusPassword"]
}
}
}

apply(plugin = "io.github.gradle-nexus.publish-plugin")

kotlin {
explicitApi()
Expand Down Expand Up @@ -194,26 +182,50 @@ kotlin {
}
}

android {
compileSdk = 31
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 31
}
testOptions {
unitTests.isReturnDefaultValues = true
}
namespace = "io.github.oshai"
}

tasks {
withType<Jar> {
metaInf.with(
copySpec {
from("${project.rootDir}/LICENSE")
}
)
}

val jvmJar by getting(Jar::class) {
manifest {
attributes("Automatic-Module-Name" to "io.github.oshai.kotlinlogging")
}
}
}


// Docs

tasks {
register<Jar>("dokkaJar") {
from(dokkaHtml)
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
}
}

// see https://docs.gradle.org/current/userguide/gradle_wrapper.html#customizing_wrapper
wrapper {
distributionType = Wrapper.DistributionType.ALL
}

withType<Jar> {
metaInf.with(
copySpec {
from("${project.rootDir}/LICENSE")
}
)
}
// Tests

tasks {
withType<Test> {
useJUnitPlatform()
testLogging {
Expand All @@ -222,14 +234,33 @@ tasks {
exceptionFormat = FULL
}
}
afterEvaluate {
check {
dependsOn(withType<Detekt>())
}
}


// Static code analysis tools

spotless {
kotlin {
target("src/**/*.kt")
ktfmt("0.24").googleStyle()
}
}


// Publishing

nexusPublishing {
repositories {
sonatype { // only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USERNAME_2")) // defaults to project.properties["myNexusUsername"]
password.set(System.getenv("SONATYPE_PASSWORD_2")) // defaults to project.properties["myNexusPassword"]
}
}
}

apply(plugin = "io.github.gradle-nexus.publish-plugin")

publishing {
publications.withType<MavenPublication> {
Expand Down Expand Up @@ -269,38 +300,12 @@ signing {
sign(publishing.publications)
}

detekt {
buildUponDefaultConfig = true
config = files(rootDir.resolve("detekt.yml"))
parallel = true

reports {
html.enabled = false
txt.enabled = false
}
}

val jvmJar by tasks.getting(Jar::class) {
manifest {
attributes("Automatic-Module-Name" to "io.github.oshai.kotlinlogging")
}
}
// Gradle wrapper

android {
compileSdk = 31
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 31
}
testOptions {
unitTests.isReturnDefaultValues = true
}
namespace = "io.github.oshai"
}
spotless {
kotlin {
target("src/**/*.kt")
ktfmt("0.24").googleStyle()
tasks {
// see https://docs.gradle.org/current/userguide/gradle_wrapper.html#customizing_wrapper
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
}
12 changes: 0 additions & 12 deletions detekt.yml

This file was deleted.