Skip to content

Commit

Permalink
Merge pull request #112 from crow-misia/dokka_v2
Browse files Browse the repository at this point in the history
build: dokka v2対応
  • Loading branch information
crow-misia authored Dec 17, 2024
2 parents f55cdf8 + 2441797 commit e7f69a2
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 108 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.dokka.javadoc) apply false
}
149 changes: 67 additions & 82 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.dokka)
alias(libs.plugins.detekt)
alias(libs.plugins.dokka)
alias(libs.plugins.dokka.javadoc)
alias(libs.plugins.kotlin.android)
id("signing")
id("maven-publish")
Expand Down Expand Up @@ -100,8 +101,8 @@ android {
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

packaging {
Expand All @@ -128,11 +129,8 @@ android {

kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
javaParameters.set(true)
jvmTarget.set(JvmTarget.JVM_11)
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
javaParameters = true
jvmTarget = JvmTarget.JVM_11
}
}

Expand Down Expand Up @@ -162,99 +160,86 @@ dependencies {
androidTestImplementation(libs.truth)
}

val customDokkaTask by tasks.creating(DokkaTask::class) {
dokkaSourceSets.getByName("main") {
noAndroidSdkLink.set(false)
}
dependencies {
plugins(libs.dokka.javadoc.plugin)
}
inputs.dir("src/main/java")
outputDirectory.set(layout.buildDirectory.dir("javadoc"))
}

val javadocJar by tasks.creating(Jar::class) {
dependsOn(customDokkaTask)
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles JavaDoc JAR"
val dokkaJavadocJar by tasks.registering(Jar::class) {
description = "A Javadoc JAR containing Dokka Javadoc"
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
from(customDokkaTask.outputDirectory)
}

afterEvaluate {
publishing {
publications {
create<MavenPublication>("maven") {
from(components.getByName("release"))

groupId = Maven.groupId
artifactId = Maven.artifactId

println("""
|Creating maven publication
| Group: $groupId
| Artifact: $artifactId
| Version: $version
""".trimMargin())

artifact(javadocJar)

pom {
name.set(Maven.name)
description.set(Maven.desc)
url.set(Maven.siteUrl)

scm {
val scmUrl = "scm:git:${Maven.gitUrl}"
connection.set(scmUrl)
developerConnection.set(scmUrl)
url.set(Maven.gitUrl)
tag.set("HEAD")
}
publishing {
publications {
register<MavenPublication>("maven") {
afterEvaluate {
from(components.named("release").get())
}

groupId = Maven.groupId
artifactId = Maven.artifactId

println("""
|Creating maven publication
| Group: $groupId
| Artifact: $artifactId
| Version: $version
""".trimMargin())

artifact(dokkaJavadocJar)

pom {
name = Maven.name
description = Maven.desc
url = Maven.siteUrl

scm {
val scmUrl = "scm:git:${Maven.gitUrl}"
connection = scmUrl
developerConnection = scmUrl
url = Maven.gitUrl
tag = "HEAD"
}

developers {
developer {
id.set("crow-misia")
name.set("Zenichi Amano")
email.set("[email protected]")
roles.set(listOf("Project-Administrator", "Developer"))
timezone.set("+9")
}
developers {
developer {
id = "crow-misia"
name = "Zenichi Amano"
email = "[email protected]"
roles = listOf("Project-Administrator", "Developer")
timezone = "+9"
}
}

licenses {
license {
name.set(Maven.licenseName)
url.set(Maven.licenseUrl)
distribution.set(Maven.licenseDist)
}
licenses {
license {
name = Maven.licenseName
url = Maven.licenseUrl
distribution = Maven.licenseDist
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = if (Maven.version.endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.findProperty("sona.user") as String? ?: providers.environmentVariable("SONA_USER").orNull
password = project.findProperty("sona.password") as String? ?: providers.environmentVariable("SONA_PASSWORD").orNull
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = if (Maven.version.endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.findProperty("sona.user") as String? ?: providers.environmentVariable("SONA_USER").orNull
password = project.findProperty("sona.password") as String? ?: providers.environmentVariable("SONA_PASSWORD").orNull
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications.getByName("maven"))
}
signing {
useGpgCmd()
sign(publishing.publications)
}

detekt {
parallel = true
buildUponDefaultConfig = true
allRules = false
autoCorrect = true
config.setFrom(files("$rootDir/config/detekt.yml"))
config.from(rootDir.resolve("config/detekt.yml"))
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ android.useAndroidX=true
kotlin.code.style=official
kotlin.incremental.usePreciseJavaTracking=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
54 changes: 28 additions & 26 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,74 @@

android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }

kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.7" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }

dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }

dokka-javadoc = { id = "org.jetbrains.dokka-javadoc", version.ref = "dokka" }

kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

[versions]

android-gradle-plugin = "8.7.3"

kotlin = "2.1.0"

kotlinx-coroutines = "1.9.0"
androidx-test-espresso = "3.6.1"

androidx-test-ext-junit = "1.2.1"

androidx-test-ext-truth = "1.6.0"

androidx-test-espresso = "3.6.1"
androidx-test-rules = "1.6.1"

androidx-test-runner = "1.6.2"

androidx-test-rules = "1.6.1"
detekt = "1.23.7"

dokka = "2.0.0"

kotest = "5.9.1"

kotlin = "2.1.0"

kotlinx-coroutines = "1.9.0"

mockk = "1.13.13"

truth = "1.4.4"

dokka = "2.0.0"

[libraries]

kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" }
androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-test-espresso" }

kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib" }
androidx-test-ext-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidx-test-ext-junit" }

kotlinx-coroutines-bom = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" }
androidx-test-ext-truth = { group = "androidx.test.ext", name = "truth", version.ref = "androidx-test-ext-truth" }

kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android" }
androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidx-test-rules" }

kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test" }
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test-runner" }

libwebrtc-ktx = "io.github.crow-misia.libwebrtc:libwebrtc-ktx:1.10.0"
kotest-assertions-core = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" }

androidx-test-ext-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidx-test-ext-junit" }
kotest-property = { group = "io.kotest", name = "kotest-property", version.ref = "kotest" }

androidx-test-ext-truth = { group = "androidx.test.ext", name = "truth", version.ref = "androidx-test-ext-truth" }
kotest-runner-junit5 = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" }

androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-test-espresso" }
kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" }

androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test-runner" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib" }

androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidx-test-rules" }
kotlinx-coroutines-bom = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" }

kotest-runner-junit5 = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android" }

kotest-assertions-core = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test" }

kotest-property = { group = "io.kotest", name = "kotest-property", version.ref = "kotest" }
libwebrtc-ktx = "io.github.crow-misia.libwebrtc:libwebrtc-ktx:1.10.0"

mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }

mockk-android = { group = "io.mockk", name = "mockk-android", version.ref = "mockk" }

truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }

dokka-javadoc-plugin = { group = "org.jetbrains.dokka", name = "javadoc-plugin", version.ref = "dokka" }

0 comments on commit e7f69a2

Please sign in to comment.