diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e79bea2c43..0000000000 --- a/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2021 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -buildscript { - ext.kotlin_version = '1.6.10' - ext.dokka_version = '1.5.30' - - repositories { - google() - jcenter() - mavenLocal() - mavenCentral() - maven { url 'https://jitpack.io' } - maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - } - dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - } -} - -apply plugin: 'org.jetbrains.dokka' - -allprojects { - repositories { - google() - jcenter() - mavenLocal() - mavenCentral() - maven { url 'https://jitpack.io' } - maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - } -} - -subprojects { project -> - if (project.name == 'test-app' || project.name == 'readium') return - apply plugin: 'org.jetbrains.dokka' - tasks.named("dokkaGfmPartial") { - dokkaSourceSets { - configureEach { - reportUndocumented.set(false) - skipEmptyPackages.set(false) - skipDeprecated.set(true) - } - } - } - - task javadocsJar(type: Jar) { - archiveClassifier.set("javadoc") - } - - task sourcesJar(type: Jar) { - archiveClassifier.set("sources") - from "src/main/java", "src/main/resources" - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -task cleanDocs(type: Delete) { - delete "${project.rootDir}/docs/readium", "${project.rootDir}/docs/index.md" -} - -tasks.dokkaGfmMultiModule.configure { - outputDirectory = new File("${project.rootDir}/docs") -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..02eec38335 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,72 @@ +/* + * Copyright 2021 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +buildscript { + val kotlinVersion by extra("1.6.10") + val dokkaVersion by extra("1.5.30") + + repositories { + google() + jcenter() + mavenLocal() + mavenCentral() + maven(url = "https://jitpack.io") + maven(url = "https://s3.amazonaws.com/repo.commonsware.com") + } + dependencies { + classpath("com.android.tools.build:gradle:7.0.4") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion") + } +} + +apply(plugin = "org.jetbrains.dokka") + +allprojects { + repositories { + google() + jcenter() + mavenLocal() + mavenCentral() + maven(url = "https://jitpack.io") + maven(url = "https://s3.amazonaws.com/repo.commonsware.com") + } +} + +subprojects { + tasks.register("javadocsJar") { + archiveClassifier.set("javadoc") + } + + tasks.register("sourcesJar") { + archiveClassifier.set("sources") + from("src/main/java", "src/main/resources") + } +} + +tasks.register("clean", Delete::class).configure { + delete(rootProject.buildDir) +} + +tasks.register("cleanDocs", Delete::class).configure { + delete("${project.rootDir}/docs/readium", "${project.rootDir}/docs/index.md") +} + +tasks.withType().configureEach { + dokkaSourceSets { + configureEach { + reportUndocumented.set(false) + skipEmptyPackages.set(false) + skipDeprecated.set(true) + } + } +} + +tasks.named("dokkaGfmMultiModule").configure { + outputDirectory.set(file("${projectDir.path}/docs")) +} diff --git a/gradle/libs.versions.toml2 b/gradle/libs.versions.toml2 new file mode 100644 index 0000000000..33eb55280e --- /dev/null +++ b/gradle/libs.versions.toml2 @@ -0,0 +1,18 @@ +# Eventually want to use this for dependencies, but Android Studio is not ready + +[versions] +kotlin = "1.6.10" +dokka = "1.5.30" +room = "2.4.0" + +[libraries] +kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +dokka-gradle = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" } +room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } +room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" } +room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } + +[bundles] +room = ["room-runtime", "room-compiler"] + +[plugins] \ No newline at end of file diff --git a/readium/lcp/build.gradle b/readium/lcp/build.gradle deleted file mode 100644 index a3efadd69e..0000000000 --- a/readium/lcp/build.gradle +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2018 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-parcelize' - id 'kotlin-kapt' - id 'maven-publish' -} - -android { - - compileSdkVersion 31 - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" - allWarningsAsErrors = true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.github.readium' - artifactId = 'readium-lcp' - - artifact sourcesJar - artifact javadocsJar - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - - api project(':readium:shared') - - implementation 'androidx.constraintlayout:constraintlayout:2.1.2' - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'com.google.android.material:material:1.4.0' - implementation 'com.jakewharton.timber:timber:5.0.1' - implementation("com.mcxiaoke.koi:async:0.5.5") { - exclude module: 'support-v4' - } - implementation("com.mcxiaoke.koi:core:0.5.5") { - exclude module: 'support-v4' - } - implementation 'joda-time:joda-time:2.10.13' - implementation "org.zeroturnaround:zt-zip:1.14" - implementation 'androidx.browser:browser:1.4.0' - - final room_version = '2.4.0' - implementation "androidx.room:room-runtime:$room_version" - implementation "androidx.room:room-ktx:$room_version" - kapt "androidx.room:room-compiler:$room_version" - - // Tests - testImplementation "junit:junit:4.13.2" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/readium/lcp/build.gradle.kts b/readium/lcp/build.gradle.kts new file mode 100644 index 0000000000..e0183d2115 --- /dev/null +++ b/readium/lcp/build.gradle.kts @@ -0,0 +1,86 @@ +/* + * Copyright 2018 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("kotlin-parcelize") + id("kotlin-kapt") + id("maven-publish") + id("org.jetbrains.dokka") +} + +android { + + compileSdk = 31 + defaultConfig { + minSdk = 21 + targetSdk = 31 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + allWarningsAsErrors = true + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } +} + +afterEvaluate { + publishing { + publications { + create("release") { + from(components.getByName("release")) + groupId = "com.github.readium" + artifactId = "readium-lcp" + artifact(tasks.findByName("sourcesJar")) + artifact(tasks.findByName("javadocsJar")) + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + + api(project(":readium:shared")) + + implementation("androidx.constraintlayout:constraintlayout:2.1.2") + implementation("androidx.core:core-ktx:1.7.0") + implementation("com.google.android.material:material:1.4.0") + implementation("com.jakewharton.timber:timber:5.0.1") + implementation("com.mcxiaoke.koi:async:0.5.5") { + exclude(module = "support-v4") + } + implementation("com.mcxiaoke.koi:core:0.5.5") { + exclude(module = "support-v4") + } + implementation("joda-time:joda-time:2.10.13") + implementation("org.zeroturnaround:zt-zip:1.14") + implementation("androidx.browser:browser:1.4.0") + + // Room database + val roomVersion = "2.4.0" + implementation("androidx.room:room-runtime:$roomVersion") + implementation("androidx.room:room-ktx:$roomVersion") + kapt("androidx.room:room-compiler:$roomVersion") + + // Tests + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +} diff --git a/readium/navigator/build.gradle b/readium/navigator/build.gradle deleted file mode 100644 index 9c7bc0ae49..0000000000 --- a/readium/navigator/build.gradle +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2018 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-parcelize' - id 'maven-publish' -} - -android { - // FIXME: This doesn't pass the lint because some resources don't start with r2_ yet. We need to rename all resources for the next major version. -// resourcePrefix "r2_" - - compileSdkVersion 31 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } - buildFeatures { - viewBinding true - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.github.readium' - artifactId = 'readium-navigator' - - artifact sourcesJar - artifact javadocsJar - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - - api project(':readium:shared') - - implementation 'androidx.activity:activity-ktx:1.4.0' - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation "androidx.browser:browser:1.4.0" - implementation 'androidx.constraintlayout:constraintlayout:2.1.2' - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.fragment:fragment-ktx:1.4.0' - implementation "androidx.legacy:legacy-support-core-ui:1.0.0" - implementation "androidx.legacy:legacy-support-v4:1.0.0" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0" - implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0" - implementation "androidx.recyclerview:recyclerview:1.2.1" - implementation "androidx.media:media:1.4.3" - implementation "androidx.viewpager2:viewpager2:1.0.0" - implementation "androidx.webkit:webkit:1.4.0" - // Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476 - implementation 'androidx.work:work-runtime-ktx:2.7.1' - implementation "com.duolingo.open:rtl-viewpager:1.0.3" - api "com.github.barteksc:android-pdf-viewer:2.8.2" - // ChrisBane/PhotoView ( for the Zoom handling ) - implementation "com.github.chrisbanes:PhotoView:2.3.0" - // ExoPlayer is used by the Audio Navigator. - api 'com.google.android.exoplayer:exoplayer-core:2.16.1' - api 'com.google.android.exoplayer:exoplayer-ui:2.16.1' - api 'com.google.android.exoplayer:extension-mediasession:2.16.1' - api 'com.google.android.exoplayer:extension-workmanager:2.16.1' - implementation 'com.google.android.material:material:1.4.0' - implementation 'com.jakewharton.timber:timber:5.0.1' - implementation "com.shopgun.android:utils:1.0.9" - implementation 'joda-time:joda-time:2.10.13' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - // AM NOTE: needs to stay this version for now (June 24,2020) - //noinspection GradleDependency - implementation 'org.jsoup:jsoup:1.14.3' - - // Tests - testImplementation "junit:junit:4.13.2" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts new file mode 100644 index 0000000000..ac14eebf51 --- /dev/null +++ b/readium/navigator/build.gradle.kts @@ -0,0 +1,105 @@ +/* + * Copyright 2018 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("kotlin-parcelize") + id("maven-publish") + id("org.jetbrains.dokka") +} + +android { + // FIXME: This doesn't pass the lint because some resources don"t start with r2_ yet. We need to rename all resources for the next major version. +// resourcePrefix "r2_" + + compileSdk = 31 + + defaultConfig { + minSdk = 21 + targetSdk = 31 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } + buildFeatures { + viewBinding = true + } +} + +afterEvaluate { + publishing { + publications { + create("release") { + from(components.getByName("release")) + groupId = "com.github.readium" + artifactId = "readium-navigator" + artifact(tasks.findByName("sourcesJar")) + artifact(tasks.findByName("javadocsJar")) + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + api(project(":readium:shared")) + + implementation("androidx.activity:activity-ktx:1.4.0") + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("androidx.browser:browser:1.4.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.2") + implementation("androidx.core:core-ktx:1.7.0") + implementation("androidx.fragment:fragment-ktx:1.4.0") + implementation("androidx.legacy:legacy-support-core-ui:1.0.0") + implementation("androidx.legacy:legacy-support-v4:1.0.0") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0") + implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation("androidx.media:media:1.4.3") + implementation("androidx.viewpager2:viewpager2:1.0.0") + implementation("androidx.webkit:webkit:1.4.0") + // Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476 + implementation("androidx.work:work-runtime-ktx:2.7.1") + implementation("com.duolingo.open:rtl-viewpager:1.0.3") + api("com.github.barteksc:android-pdf-viewer:2.8.2") + // ChrisBane/PhotoView ( for the Zoom handling ) + implementation("com.github.chrisbanes:PhotoView:2.3.0") + // ExoPlayer is used by the Audio Navigator. + api("com.google.android.exoplayer:exoplayer-core:2.16.1") + api("com.google.android.exoplayer:exoplayer-ui:2.16.1") + api("com.google.android.exoplayer:extension-mediasession:2.16.1") + api("com.google.android.exoplayer:extension-workmanager:2.16.1") + implementation("com.google.android.material:material:1.4.0") + implementation("com.jakewharton.timber:timber:5.0.1") + implementation("com.shopgun.android:utils:1.0.9") + implementation("joda-time:joda-time:2.10.13") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + // AM NOTE: needs to stay this version for now (June 24,2020) + //noinspection GradleDependency + implementation("org.jsoup:jsoup:1.14.3") + + // Tests + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +} diff --git a/readium/opds/build.gradle b/readium/opds/build.gradle deleted file mode 100644 index 068efaacc2..0000000000 --- a/readium/opds/build.gradle +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2018 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-parcelize' - id 'maven-publish' -} - -android { - compileSdkVersion 31 - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } - testOptions { - unitTests.includeAndroidResources = true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - groupId = 'com.github.readium' - artifactId = 'readium-opds' - - artifact sourcesJar - artifact javadocsJar - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - - api project(':readium:shared') - - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation 'com.jakewharton.timber:timber:5.0.1' - implementation "joda-time:joda-time:2.10.13" - implementation "nl.komponents.kovenant:kovenant:3.3.0" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - - // Tests - testImplementation 'junit:junit:4.13.2' - testImplementation 'org.robolectric:robolectric:4.7.3' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts new file mode 100644 index 0000000000..3e2a368271 --- /dev/null +++ b/readium/opds/build.gradle.kts @@ -0,0 +1,67 @@ +/* + * Copyright 2018 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("kotlin-parcelize") + id("maven-publish") + id("org.jetbrains.dokka") +} + +android { + compileSdk = 31 + defaultConfig { + minSdk = 21 + targetSdk = 31 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + testOptions { + unitTests.isIncludeAndroidResources = true + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } +} + +afterEvaluate { + publishing { + publications { + create("release") { + from(components.getByName("release")) + groupId = "com.github.readium" + artifactId = "readium-opds" + artifact(tasks.findByName("sourcesJar")) + artifact(tasks.findByName("javadocsJar")) + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + api(project(":readium:shared")) + + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("com.jakewharton.timber:timber:5.0.1") + implementation("joda-time:joda-time:2.10.13") + implementation("nl.komponents.kovenant:kovenant:3.3.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + + // Tests + testImplementation("junit:junit:4.13.2") + testImplementation("org.robolectric:robolectric:4.7.3") + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +} diff --git a/readium/shared/build.gradle b/readium/shared/build.gradle deleted file mode 100644 index ce1820b694..0000000000 --- a/readium/shared/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2018 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-parcelize' - id 'maven-publish' -} - -android { - compileSdkVersion 31 - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } - kotlinOptions { - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" - allWarningsAsErrors = true - } - testOptions { - unitTests.includeAndroidResources = true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.github.readium' - artifactId = 'readium-shared' - - artifact sourcesJar - artifact javadocsJar - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation 'androidx.browser:browser:1.4.0' - implementation 'com.github.kittinunf.fuel:fuel-android:2.3.1' - implementation 'com.github.kittinunf.fuel:fuel:2.3.1' - implementation 'com.jakewharton.timber:timber:5.0.1' - implementation "joda-time:joda-time:2.10.13" - implementation "nl.komponents.kovenant:kovenant-android:3.3.0" - implementation "nl.komponents.kovenant:kovenant-combine:3.3.0" - implementation "nl.komponents.kovenant:kovenant-core:3.3.0" - implementation "nl.komponents.kovenant:kovenant-functional:3.3.0" - implementation "nl.komponents.kovenant:kovenant-jvm:3.3.0" - implementation "nl.komponents.kovenant:kovenant:3.3.0" - implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.10' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - implementation "org.jsoup:jsoup:1.14.3" - - // Tests - testImplementation "junit:junit:4.13.2" - testImplementation 'org.assertj:assertj-core:3.21.0' - testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2" - testImplementation 'org.robolectric:robolectric:4.7.3' - - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts new file mode 100644 index 0000000000..215097bd9c --- /dev/null +++ b/readium/shared/build.gradle.kts @@ -0,0 +1,83 @@ +/* + * Copyright 2018 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("kotlin-parcelize") + id("maven-publish") + id("org.jetbrains.dokka") +} + +android { + compileSdk = 31 + defaultConfig { + minSdk = 21 + targetSdk = 31 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + allWarningsAsErrors = true + } + testOptions { + unitTests.isIncludeAndroidResources = true + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } +} + +afterEvaluate { + publishing { + publications { + create("release") { + from(components.getByName("release")) + groupId = "com.github.readium" + artifactId = "readium-shared" + artifact(tasks.findByName("sourcesJar")) + artifact(tasks.findByName("javadocsJar")) + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("androidx.browser:browser:1.4.0") + implementation("com.github.kittinunf.fuel:fuel-android:2.3.1") + implementation("com.github.kittinunf.fuel:fuel:2.3.1") + implementation("com.jakewharton.timber:timber:5.0.1") + implementation("joda-time:joda-time:2.10.13") + implementation("nl.komponents.kovenant:kovenant-android:3.3.0") + implementation("nl.komponents.kovenant:kovenant-combine:3.3.0") + implementation("nl.komponents.kovenant:kovenant-core:3.3.0") + implementation("nl.komponents.kovenant:kovenant-functional:3.3.0") + implementation("nl.komponents.kovenant:kovenant-jvm:3.3.0") + implementation("nl.komponents.kovenant:kovenant:3.3.0") + implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + implementation("org.jsoup:jsoup:1.14.3") + + // Tests + testImplementation("junit:junit:4.13.2") + testImplementation("org.assertj:assertj-core:3.21.0") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.6.10") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2") + testImplementation("org.robolectric:robolectric:4.7.3") + + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +} diff --git a/readium/streamer/build.gradle b/readium/streamer/build.gradle deleted file mode 100644 index e3feae1df4..0000000000 --- a/readium/streamer/build.gradle +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2018 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-parcelize' - id 'maven-publish' -} - -android { - compileSdkVersion 31 - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } - testOptions { - unitTests.includeAndroidResources = true - } - kotlinOptions { - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" - allWarningsAsErrors = true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } -} - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - from components.release - - groupId = 'com.github.readium' - artifactId = 'readium-streamer' - - artifact sourcesJar - artifact javadocsJar - } - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - - api project(':readium:shared') - - implementation 'androidx.appcompat:appcompat:1.4.0' - // PdfiumAndroid 1.9.0 conflicts with liblcp, see https://github.com/readium/kotlin-toolkit/issues/29 - //noinspection GradleDependency - implementation "com.github.barteksc:pdfium-android:1.8.2" - implementation 'com.jakewharton.timber:timber:5.0.1' - //noinspection GradleDependency - implementation ("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { - exclude group: 'org.parboiled' - } - //noinspection GradleDependency - implementation ("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { - exclude group: 'org.parboiled' - } - //AM NOTE: conflicting support libraries, excluding these - implementation("com.mcxiaoke.koi:core:0.5.5") { - exclude module: 'support-v4' - } - // useful extensions (only ~100k) - implementation("com.mcxiaoke.koi:async:0.5.5") { - exclude module: 'support-v4' - } - implementation "joda-time:joda-time:2.10.13" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - - // Tests - testImplementation 'junit:junit:4.13.2' - testImplementation 'org.assertj:assertj-core:3.21.0' - testImplementation 'org.robolectric:robolectric:4.7.3' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts new file mode 100644 index 0000000000..8af74a4f8c --- /dev/null +++ b/readium/streamer/build.gradle.kts @@ -0,0 +1,89 @@ +import android.annotation.SuppressLint + +/* + * Copyright 2018 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.library") + id("kotlin-android") + id("kotlin-parcelize") + id("maven-publish") + id("org.jetbrains.dokka") +} + +android { + compileSdk = 31 + defaultConfig { + minSdk = 21 + targetSdk = 31 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + testOptions { + unitTests.isIncludeAndroidResources = true + } + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + allWarningsAsErrors = true + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } +} + +afterEvaluate { + publishing { + publications { + create("release") { + from(components.getByName("release")) + groupId = "com.github.readium" + artifactId = "readium-streamer" + artifact(tasks.findByName("sourcesJar")) + artifact(tasks.findByName("javadocsJar")) + } + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + api(project(":readium:shared")) + + implementation("androidx.appcompat:appcompat:1.4.0") + @Suppress("GradleDependency") + implementation("com.github.barteksc:pdfium-android:1.8.2") + implementation("com.jakewharton.timber:timber:5.0.1") + implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { + exclude(group = "org.parboiled") + } + implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { + exclude(group = "org.parboiled") + } + //AM NOTE: conflicting support libraries, excluding these + implementation("com.mcxiaoke.koi:core:0.5.5") { + exclude(module = "support-v4") + } + // useful extensions (only ~100k) + implementation("com.mcxiaoke.koi:async:0.5.5") { + exclude(module = "support-v4") + } + implementation("joda-time:joda-time:2.10.13") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + + // Tests + testImplementation("junit:junit:4.13.2") + testImplementation("org.assertj:assertj-core:3.21.0") + testImplementation("org.robolectric:robolectric:4.7.3") + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 3fca9262a6..0000000000 --- a/settings.gradle +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2021 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -rootProject.name = "Readium" - -include ':readium:shared' -include ':readium:streamer' -include ':readium:navigator' -include ':readium:opds' -include ':readium:lcp' - -if (!System.env.JITPACK) { - include 'test-app' -} diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..a8f80312f1 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,26 @@ +/* + * Copyright 2021 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +// FIXME: Android Studio doesn't support the gradle/libs.versions.toml2 well yet. +//enableFeaturePreview("VERSION_CATALOGS") + +pluginManagement { + repositories { + gradlePluginPortal() + } +} + +rootProject.name = "Readium" + +include(":readium:shared") +include(":readium:streamer") +include(":readium:navigator") +include(":readium:opds") +include(":readium:lcp") + +if (System.getenv("JITPACK") == null) { + include("test-app") +} diff --git a/test-app/build.gradle b/test-app/build.gradle deleted file mode 100644 index 12cbe12b4d..0000000000 --- a/test-app/build.gradle +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2021 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-parcelize' - -int major = 2 -int minor = 2 -int patch = 1 -int build = 29 -String type = "" - -def version = "$major.$minor.$patch" -boolean appendBuild = build != 0 -if (appendBuild || !type.empty) { - version += "-$type" - if (appendBuild) { - version += build - } -} - -project.ext.versionName = version -project.ext.versionCode = 1_000_000 * major + 10_000 * minor + 100 * patch + build - - -android { - - compileSdkVersion 31 - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - - applicationId "org.readium.r2reader" - - versionCode project.ext.versionCode - versionName project.ext.versionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" - } - buildFeatures { - viewBinding true - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt') - } - } - packagingOptions { - exclude 'META-INF/*' - } - - sourceSets { - main { - java.srcDirs = ['src/main/java'] - res.srcDirs = ['src/main/res'] - assets.srcDirs = ['src/main/assets'] - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - - implementation project(':readium:shared') - implementation project(':readium:streamer') - implementation project(':readium:navigator') - implementation project(':readium:opds') - implementation project(':readium:lcp') - - implementation 'androidx.core:core-ktx:1.7.0' - implementation "androidx.activity:activity-ktx:1.4.0" - implementation "androidx.appcompat:appcompat:1.4.0" - implementation "androidx.browser:browser:1.4.0" - implementation "androidx.cardview:cardview:1.0.0" - implementation "androidx.constraintlayout:constraintlayout:2.1.2" - implementation "androidx.fragment:fragment-ktx:1.4.0" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0" - implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' - implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' - implementation "androidx.paging:paging-runtime-ktx:3.1.0" - implementation "androidx.recyclerview:recyclerview:1.2.1" - implementation "androidx.viewpager2:viewpager2:1.0.0" - implementation "androidx.webkit:webkit:1.4.0" - //noinspection GradleDependency - implementation ("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { - exclude group: 'org.parboiled' - } - //noinspection GradleDependency - implementation ("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { - exclude group: 'org.parboiled' - } - implementation "com.google.android.material:material:1.4.0" - implementation 'com.jakewharton.timber:timber:5.0.1' - // AM NOTE: needs to stay this version for now (June 24,2020) - //noinspection GradleDependency - implementation 'com.squareup.picasso:picasso:2.71828' - implementation "joda-time:joda-time:2.10.13" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - // AM NOTE: needs to stay this version for now (June 24,2020) - //noinspection GradleDependency - implementation 'org.jsoup:jsoup:1.14.3' - - // Room database - final room_version = '2.4.0' - implementation "androidx.room:room-runtime:$room_version" - implementation "androidx.room:room-ktx:$room_version" - kapt "androidx.room:room-compiler:$room_version" - - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - //noinspection LifecycleAnnotationProcessorWithJava8 - kapt "androidx.lifecycle:lifecycle-compiler:2.4.0" - - // Tests - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts new file mode 100644 index 0000000000..5f96988db4 --- /dev/null +++ b/test-app/build.gradle.kts @@ -0,0 +1,116 @@ +/* + * Copyright 2021 Readium Foundation. All rights reserved. + * Use of this source code is governed by the BSD-style license + * available in the top-level LICENSE file of the project. + */ + +plugins { + id("com.android.application") + id("kotlin-android") + id("kotlin-kapt") + id("kotlin-parcelize") +} + +android { + + compileSdk = 31 + defaultConfig { + minSdk = 21 + targetSdk = 31 + + applicationId = "org.readium.r2reader" + + versionName = "2.1.1" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + ndk.abiFilters.add("armeabi-v7a") + ndk.abiFilters.add("arm64-v8a") + ndk.abiFilters.add("x86") + ndk.abiFilters.add("x86_64") + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + } + buildFeatures { + viewBinding = true + } + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt")) + } + } + packagingOptions { + resources.excludes.add("META-INF/*") + } + + sourceSets { + getByName("main") { + java.srcDirs("src/main/java") + res.srcDirs("src/main/res") + assets.srcDirs("src/main/assets") + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10") + implementation("androidx.legacy:legacy-support-v4:1.0.0") + + implementation(project(":readium:shared")) + implementation(project(":readium:streamer")) + implementation(project(":readium:navigator")) + implementation(project(":readium:opds")) + implementation(project(":readium:lcp")) + + implementation("androidx.core:core-ktx:1.7.0") + implementation("androidx.activity:activity-ktx:1.4.0") + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("androidx.browser:browser:1.4.0") + implementation("androidx.cardview:cardview:1.0.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.2") + implementation("androidx.fragment:fragment-ktx:1.4.0") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") + implementation("androidx.navigation:navigation-fragment-ktx:2.3.5") + implementation("androidx.navigation:navigation-ui-ktx:2.3.5") + implementation("androidx.paging:paging-runtime-ktx:3.1.0") + implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation("androidx.viewpager2:viewpager2:1.0.0") + implementation("androidx.webkit:webkit:1.4.0") + implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { + exclude(group = "org.parboiled") + } + implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { + exclude(group = "org.parboiled") + } + implementation("com.google.android.material:material:1.4.0") + implementation("com.jakewharton.timber:timber:5.0.1") + // AM NOTE: needs to stay this version for now (June 24,2020) + implementation("com.squareup.picasso:picasso:2.71828") + implementation("joda-time:joda-time:2.10.13") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + // AM NOTE: needs to stay this version for now (June 24,2020) + implementation("org.jsoup:jsoup:1.14.3") + + // Room database + val roomVersion = "2.4.0" + implementation("androidx.room:room-runtime:$roomVersion") + implementation("androidx.room:room-ktx:$roomVersion") + kapt("androidx.room:room-compiler:$roomVersion") + + implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") + kapt ("androidx.lifecycle:lifecycle-compiler:2.4.0") + + // Tests + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.3") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") +}