Skip to content

Commit 4b61ad5

Browse files
authored
Migrate to Kotlin DSL for Gradle (#74)
1 parent a60c252 commit 4b61ad5

File tree

17 files changed

+662
-657
lines changed

17 files changed

+662
-657
lines changed

build.gradle

Lines changed: 0 additions & 72 deletions
This file was deleted.

build.gradle.kts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2021 Readium Foundation. All rights reserved.
3+
* Use of this source code is governed by the BSD-style license
4+
* available in the top-level LICENSE file of the project.
5+
*/
6+
7+
import org.jetbrains.dokka.gradle.DokkaTaskPartial
8+
9+
buildscript {
10+
val kotlinVersion by extra("1.6.10")
11+
val dokkaVersion by extra("1.5.30")
12+
13+
repositories {
14+
google()
15+
jcenter()
16+
mavenLocal()
17+
mavenCentral()
18+
maven(url = "https://jitpack.io")
19+
maven(url = "https://s3.amazonaws.com/repo.commonsware.com")
20+
}
21+
dependencies {
22+
classpath("com.android.tools.build:gradle:7.0.4")
23+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
24+
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
25+
}
26+
}
27+
28+
apply(plugin = "org.jetbrains.dokka")
29+
30+
allprojects {
31+
repositories {
32+
google()
33+
jcenter()
34+
mavenLocal()
35+
mavenCentral()
36+
maven(url = "https://jitpack.io")
37+
maven(url = "https://s3.amazonaws.com/repo.commonsware.com")
38+
}
39+
}
40+
41+
subprojects {
42+
tasks.register<Jar>("javadocsJar") {
43+
archiveClassifier.set("javadoc")
44+
}
45+
46+
tasks.register<Jar>("sourcesJar") {
47+
archiveClassifier.set("sources")
48+
from("src/main/java", "src/main/resources")
49+
}
50+
}
51+
52+
tasks.register("clean", Delete::class).configure {
53+
delete(rootProject.buildDir)
54+
}
55+
56+
tasks.register("cleanDocs", Delete::class).configure {
57+
delete("${project.rootDir}/docs/readium", "${project.rootDir}/docs/index.md")
58+
}
59+
60+
tasks.withType<DokkaTaskPartial>().configureEach {
61+
dokkaSourceSets {
62+
configureEach {
63+
reportUndocumented.set(false)
64+
skipEmptyPackages.set(false)
65+
skipDeprecated.set(true)
66+
}
67+
}
68+
}
69+
70+
tasks.named<org.jetbrains.dokka.gradle.DokkaMultiModuleTask>("dokkaGfmMultiModule").configure {
71+
outputDirectory.set(file("${projectDir.path}/docs"))
72+
}

gradle/libs.versions.toml2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Eventually want to use this for dependencies, but Android Studio is not ready
2+
3+
[versions]
4+
kotlin = "1.6.10"
5+
dokka = "1.5.30"
6+
room = "2.4.0"
7+
8+
[libraries]
9+
kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
10+
dokka-gradle = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
11+
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
12+
room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
13+
room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
14+
15+
[bundles]
16+
room = ["room-runtime", "room-compiler"]
17+
18+
[plugins]

readium/lcp/build.gradle

Lines changed: 0 additions & 85 deletions
This file was deleted.

readium/lcp/build.gradle.kts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright 2018 Readium Foundation. All rights reserved.
3+
* Use of this source code is governed by the BSD-style license
4+
* available in the top-level LICENSE file of the project.
5+
*/
6+
7+
plugins {
8+
id("com.android.library")
9+
id("kotlin-android")
10+
id("kotlin-parcelize")
11+
id("kotlin-kapt")
12+
id("maven-publish")
13+
id("org.jetbrains.dokka")
14+
}
15+
16+
android {
17+
18+
compileSdk = 31
19+
defaultConfig {
20+
minSdk = 21
21+
targetSdk = 31
22+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
23+
}
24+
compileOptions {
25+
sourceCompatibility = JavaVersion.VERSION_1_8
26+
targetCompatibility = JavaVersion.VERSION_1_8
27+
}
28+
kotlinOptions {
29+
jvmTarget = "1.8"
30+
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
31+
allWarningsAsErrors = true
32+
}
33+
buildTypes {
34+
getByName("release") {
35+
isMinifyEnabled = false
36+
proguardFiles(getDefaultProguardFile("proguard-android.txt"))
37+
}
38+
}
39+
}
40+
41+
afterEvaluate {
42+
publishing {
43+
publications {
44+
create<MavenPublication>("release") {
45+
from(components.getByName("release"))
46+
groupId = "com.github.readium"
47+
artifactId = "readium-lcp"
48+
artifact(tasks.findByName("sourcesJar"))
49+
artifact(tasks.findByName("javadocsJar"))
50+
}
51+
}
52+
}
53+
}
54+
55+
dependencies {
56+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
57+
58+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
59+
60+
api(project(":readium:shared"))
61+
62+
implementation("androidx.constraintlayout:constraintlayout:2.1.2")
63+
implementation("androidx.core:core-ktx:1.7.0")
64+
implementation("com.google.android.material:material:1.4.0")
65+
implementation("com.jakewharton.timber:timber:5.0.1")
66+
implementation("com.mcxiaoke.koi:async:0.5.5") {
67+
exclude(module = "support-v4")
68+
}
69+
implementation("com.mcxiaoke.koi:core:0.5.5") {
70+
exclude(module = "support-v4")
71+
}
72+
implementation("joda-time:joda-time:2.10.13")
73+
implementation("org.zeroturnaround:zt-zip:1.14")
74+
implementation("androidx.browser:browser:1.4.0")
75+
76+
// Room database
77+
val roomVersion = "2.4.0"
78+
implementation("androidx.room:room-runtime:$roomVersion")
79+
implementation("androidx.room:room-ktx:$roomVersion")
80+
kapt("androidx.room:room-compiler:$roomVersion")
81+
82+
// Tests
83+
testImplementation("junit:junit:4.13.2")
84+
androidTestImplementation("androidx.test.ext:junit:1.1.3")
85+
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
86+
}

0 commit comments

Comments
 (0)