-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from crow-misia/dokka_v2
build: dokka v2対応
- Loading branch information
Showing
4 changed files
with
99 additions
and
108 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
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 |
---|---|---|
|
@@ -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") | ||
|
@@ -100,8 +101,8 @@ android { | |
} | ||
|
||
compileOptions { | ||
sourceCompatibility(JavaVersion.VERSION_11) | ||
targetCompatibility(JavaVersion.VERSION_11) | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
packaging { | ||
|
@@ -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 | ||
} | ||
} | ||
|
||
|
@@ -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")) | ||
} |
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
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