Skip to content

Commit ffea0b4

Browse files
authored
Update dependencies and fix tests (#69)
1 parent 62d675f commit ffea0b4

File tree

58 files changed

+197
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+197
-239
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
buildscript {
8-
ext.kotlin_version = '1.5.31'
8+
ext.kotlin_version = '1.6.10'
99
ext.dokka_version = '1.5.30'
1010

1111
repositories {
@@ -17,7 +17,7 @@ buildscript {
1717
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
1818
}
1919
dependencies {
20-
classpath 'com.android.tools.build:gradle:7.0.3'
20+
classpath 'com.android.tools.build:gradle:7.0.4'
2121
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
2222
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
2323
}

readium/lcp/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ dependencies {
5959

6060
api project(':readium:shared')
6161

62-
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
63-
implementation 'androidx.core:core-ktx:1.6.0'
62+
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
63+
implementation 'androidx.core:core-ktx:1.7.0'
6464
implementation 'com.google.android.material:material:1.4.0'
65-
implementation "com.jakewharton.timber:timber:4.7.1"
65+
implementation 'com.jakewharton.timber:timber:5.0.1'
6666
implementation("com.mcxiaoke.koi:async:0.5.5") {
6767
exclude module: 'support-v4'
6868
}
@@ -71,16 +71,15 @@ dependencies {
7171
}
7272
implementation 'joda-time:joda-time:2.10.13'
7373
implementation "org.zeroturnaround:zt-zip:1.14"
74-
implementation 'androidx.browser:browser:1.3.0'
74+
implementation 'androidx.browser:browser:1.4.0'
7575

76-
final room_version = '2.4.0-beta01'
76+
final room_version = '2.4.0'
7777
implementation "androidx.room:room-runtime:$room_version"
7878
implementation "androidx.room:room-ktx:$room_version"
7979
kapt "androidx.room:room-compiler:$room_version"
8080

81+
// Tests
8182
testImplementation "junit:junit:4.13.2"
82-
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
83-
83+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
8484
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
85-
androidTestImplementation 'androidx.test:runner:1.4.0'
8685
}

readium/lcp/src/main/java/org/readium/r2/lcp/license/LicenseValidation.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import org.readium.r2.shared.util.getOrElse
2121
import org.readium.r2.shared.util.mediatype.MediaType
2222
import timber.log.Timber
2323
import java.util.*
24-
import kotlin.time.Duration
24+
import kotlin.time.Duration.Companion.seconds
2525
import kotlin.time.ExperimentalTime
26-
import kotlin.time.seconds
2726

2827
internal sealed class Either<A, B> {
2928
class Left<A, B>(val left: A) : Either<A, B>()
@@ -316,9 +315,7 @@ internal class LicenseValidation(
316315
private suspend fun fetchStatus(license: LicenseDocument) {
317316
val url = license.url(LicenseDocument.Rel.status, preferredType = MediaType.LCP_STATUS_DOCUMENT).toString()
318317
// Short timeout to avoid blocking the License, since the LSD is optional.
319-
// FIXME: To remove after bumping to Kotlin 1.6
320-
@Suppress("DEPRECATION")
321-
val data = network.fetch(url, timeout = Duration.seconds(5))
318+
val data = network.fetch(url, timeout = 5.seconds)
322319
.getOrElse { throw LcpException.Network(it) }
323320

324321
raise(Event.retrievedStatusData(data))
@@ -332,9 +329,7 @@ internal class LicenseValidation(
332329
private suspend fun fetchLicense(status: StatusDocument) {
333330
val url = status.url(StatusDocument.Rel.license, preferredType = MediaType.LCP_LICENSE_DOCUMENT).toString()
334331
// Short timeout to avoid blocking the License, since it can be updated next time.
335-
// FIXME: To remove after bumping to Kotlin 1.6
336-
@Suppress("DEPRECATION")
337-
val data = network.fetch(url, timeout = Duration.seconds(5))
332+
val data = network.fetch(url, timeout = 5.seconds)
338333
.getOrElse { throw LcpException.Network(it) }
339334

340335
raise(Event.retrievedLicenseData(data))

readium/navigator/build.gradle

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,35 +62,35 @@ dependencies {
6262

6363
api project(':readium:shared')
6464

65-
implementation 'androidx.activity:activity-ktx:1.3.1'
66-
implementation 'androidx.appcompat:appcompat:1.3.1'
67-
implementation "androidx.browser:browser:1.3.0"
68-
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
69-
implementation 'androidx.core:core-ktx:1.6.0'
70-
implementation 'androidx.fragment:fragment-ktx:1.3.6'
65+
implementation 'androidx.activity:activity-ktx:1.4.0'
66+
implementation 'androidx.appcompat:appcompat:1.4.0'
67+
implementation "androidx.browser:browser:1.4.0"
68+
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
69+
implementation 'androidx.core:core-ktx:1.7.0'
70+
implementation 'androidx.fragment:fragment-ktx:1.4.0'
7171
implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
7272
implementation "androidx.legacy:legacy-support-v4:1.0.0"
73-
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
74-
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
75-
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
76-
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1"
73+
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
74+
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
75+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
76+
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0"
7777
implementation "androidx.recyclerview:recyclerview:1.2.1"
7878
implementation "androidx.media:media:1.4.3"
7979
implementation "androidx.viewpager2:viewpager2:1.0.0"
8080
implementation "androidx.webkit:webkit:1.4.0"
8181
// Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476
82-
implementation 'androidx.work:work-runtime-ktx:2.7.0'
82+
implementation 'androidx.work:work-runtime-ktx:2.7.1'
8383
implementation "com.duolingo.open:rtl-viewpager:1.0.3"
8484
api "com.github.barteksc:android-pdf-viewer:2.8.2"
8585
// ChrisBane/PhotoView ( for the Zoom handling )
8686
implementation "com.github.chrisbanes:PhotoView:2.3.0"
8787
// ExoPlayer is used by the Audio Navigator.
88-
api 'com.google.android.exoplayer:exoplayer-core:2.15.1'
89-
api 'com.google.android.exoplayer:exoplayer-ui:2.15.1'
90-
api 'com.google.android.exoplayer:extension-mediasession:2.15.1'
91-
api 'com.google.android.exoplayer:extension-workmanager:2.15.1'
88+
api 'com.google.android.exoplayer:exoplayer-core:2.16.1'
89+
api 'com.google.android.exoplayer:exoplayer-ui:2.16.1'
90+
api 'com.google.android.exoplayer:extension-mediasession:2.16.1'
91+
api 'com.google.android.exoplayer:extension-workmanager:2.16.1'
9292
implementation 'com.google.android.material:material:1.4.0'
93-
implementation "com.jakewharton.timber:timber:4.7.1"
93+
implementation 'com.jakewharton.timber:timber:5.0.1'
9494
implementation "com.shopgun.android:utils:1.0.9"
9595
implementation 'joda-time:joda-time:2.10.13'
9696
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
@@ -99,9 +99,8 @@ dependencies {
9999
//noinspection GradleDependency
100100
implementation 'org.jsoup:jsoup:1.14.3'
101101

102+
// Tests
102103
testImplementation "junit:junit:4.13.2"
103-
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
104-
104+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
105105
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
106-
androidTestImplementation 'androidx.test:runner:1.4.0'
107106
}

readium/navigator/src/main/java/org/readium/r2/navigator/epub/fxl/R2FXLLayout.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class R2FXLLayout : FrameLayout {
322322
// only fling if no scale is needed - scale will happen on ACTION_UP
323323
flingRunnable = FlingRunnable(context)
324324
flingRunnable!!.fling(velocityX.toInt(), velocityY.toInt())
325-
ViewCompat.postOnAnimation(this@R2FXLLayout, flingRunnable)
325+
ViewCompat.postOnAnimation(this@R2FXLLayout, flingRunnable!!)
326326
return true
327327
}
328328
return false
@@ -429,7 +429,7 @@ class R2FXLLayout : FrameLayout {
429429
if (animate) {
430430
animatedZoomRunnable = AnimatedZoomRunnable()
431431
animatedZoomRunnable!!.scale(scale, newScale, this.focusX, this.focusY, true)
432-
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable)
432+
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable!!)
433433
} else {
434434
zoomDispatcher.onZoomBegin(newScale)
435435
internalScale(newScale, this.focusX, this.focusY)
@@ -531,7 +531,7 @@ class R2FXLLayout : FrameLayout {
531531
val newScale = NumberUtils.clamp(minScale, scale, maxScale)
532532
scale(scale, newScale, focusX, focusY, true)
533533
if (animatedZoomRunnable!!.doScale() || animatedZoomRunnable!!.doTranslate()) {
534-
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable)
534+
ViewCompat.postOnAnimation(this@R2FXLLayout, animatedZoomRunnable!!)
535535
return true
536536
}
537537
return false

readium/navigator/src/main/java/org/readium/r2/navigator/media/ExoMediaPlayer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class ExoMediaPlayer(
192192

193193
private inner class PlaybackPreparer : MediaSessionConnector.PlaybackPreparer {
194194

195-
override fun onCommand(player: Player, controlDispatcher: ControlDispatcher, command: String, extras: Bundle?, cb: ResultReceiver?): Boolean =
195+
override fun onCommand(player: Player, command: String, extras: Bundle?, cb: ResultReceiver?): Boolean =
196196
listener?.onCommand(command, extras, cb) ?: false
197197

198198
override fun getSupportedPrepareActions(): Long =

readium/navigator/src/main/java/org/readium/r2/navigator/util/ViewModelFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import androidx.lifecycle.ViewModelProvider
1616
internal inline fun <reified T : ViewModel> createViewModelFactory(crossinline factory: () -> T): ViewModelProvider.Factory =
1717

1818
object : ViewModelProvider.Factory {
19-
override fun <V : ViewModel?> create(modelClass: Class<V>): V {
19+
override fun <V : ViewModel> create(modelClass: Class<V>): V {
2020
if (!modelClass.isAssignableFrom(T::class.java)) {
2121
throw IllegalAccessException("Unknown ViewModel class")
2222
}

readium/opds/build.gradle

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,15 @@ dependencies {
5353

5454
api project(':readium:shared')
5555

56-
implementation 'androidx.appcompat:appcompat:1.3.1'
57-
implementation "com.jakewharton.timber:timber:4.7.1"
56+
implementation 'androidx.appcompat:appcompat:1.4.0'
57+
implementation 'com.jakewharton.timber:timber:5.0.1'
5858
implementation "joda-time:joda-time:2.10.13"
5959
implementation "nl.komponents.kovenant:kovenant:3.3.0"
6060
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
6161

62-
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
63-
testImplementation 'androidx.test:core-ktx:1.4.0'
64-
testImplementation "junit:junit:4.13.2"
65-
testImplementation "net.sf.kxml:kxml2:2.3.0"
66-
testImplementation 'org.assertj:assertj-core:3.19.0'
67-
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
68-
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
69-
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0"
70-
testImplementation "org.json:json:20200518"
71-
testImplementation "org.mockito:mockito-core:3.3.3"
72-
testImplementation 'org.robolectric:robolectric:4.5.1'
73-
testImplementation "xmlpull:xmlpull:1.1.3.1"
74-
62+
// Tests
63+
testImplementation 'junit:junit:4.13.2'
64+
testImplementation 'org.robolectric:robolectric:4.7.3'
65+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
7566
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
76-
androidTestImplementation 'androidx.test:runner:1.4.0'
7767
}

readium/shared/build.gradle

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,37 +56,29 @@ afterEvaluate {
5656
dependencies {
5757
implementation fileTree(include: ['*.jar'], dir: 'libs')
5858

59-
implementation 'androidx.appcompat:appcompat:1.3.1'
60-
implementation 'androidx.browser:browser:1.3.0'
61-
implementation "com.github.kittinunf.fuel:fuel-android:2.2.2"
62-
implementation "com.github.kittinunf.fuel:fuel:2.2.2"
63-
implementation "com.jakewharton.timber:timber:4.7.1"
59+
implementation 'androidx.appcompat:appcompat:1.4.0'
60+
implementation 'androidx.browser:browser:1.4.0'
61+
implementation 'com.github.kittinunf.fuel:fuel-android:2.3.1'
62+
implementation 'com.github.kittinunf.fuel:fuel:2.3.1'
63+
implementation 'com.jakewharton.timber:timber:5.0.1'
6464
implementation "joda-time:joda-time:2.10.13"
6565
implementation "nl.komponents.kovenant:kovenant-android:3.3.0"
6666
implementation "nl.komponents.kovenant:kovenant-combine:3.3.0"
6767
implementation "nl.komponents.kovenant:kovenant-core:3.3.0"
6868
implementation "nl.komponents.kovenant:kovenant-functional:3.3.0"
6969
implementation "nl.komponents.kovenant:kovenant-jvm:3.3.0"
7070
implementation "nl.komponents.kovenant:kovenant:3.3.0"
71-
implementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
71+
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.10'
7272
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
7373
implementation "org.jsoup:jsoup:1.14.3"
7474

75-
testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
76-
testImplementation 'androidx.test:core-ktx:1.4.0'
75+
// Tests
7776
testImplementation "junit:junit:4.13.2"
78-
testImplementation "net.sf.kxml:kxml2:2.3.0"
79-
testImplementation 'org.assertj:assertj-core:3.19.0'
80-
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
77+
testImplementation 'org.assertj:assertj-core:3.21.0'
8178
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
82-
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0"
83-
// Latest version of org.json is incompatible with the one bundled in Android, breaking the tests.
84-
//noinspection GradleDependency
85-
testImplementation "org.json:json:20200518"
86-
testImplementation "org.mockito:mockito-core:3.3.3"
87-
testImplementation 'org.robolectric:robolectric:4.5.1'
88-
testImplementation "xmlpull:xmlpull:1.1.3.1"
79+
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2"
80+
testImplementation 'org.robolectric:robolectric:4.7.3'
8981

82+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
9083
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
91-
androidTestImplementation 'androidx.test:runner:1.4.0'
9284
}

readium/shared/src/test/java/org/readium/r2/shared/extensions/JSONTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.junit.Test
88
import org.junit.runner.RunWith
99
import org.robolectric.RobolectricTestRunner
1010

11+
@RunWith(RobolectricTestRunner::class)
1112
class JSONTest {
1213

1314
@Test fun `unpack an empty JSONObject`() {

0 commit comments

Comments
 (0)