Skip to content

Commit 11686f2

Browse files
committed
add required namespace setting for android,don't fail test on 500
1 parent cda7135 commit 11686f2

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

build.gradle.kts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ version = libraryVersion
4545

4646

4747
android {
48+
namespace = "com.adamratzman.spotify"
4849
compileSdk = 30
4950
compileOptions {
50-
sourceCompatibility = JavaVersion.VERSION_1_8
51-
targetCompatibility = JavaVersion.VERSION_1_8
51+
sourceCompatibility = JavaVersion.VERSION_11
52+
targetCompatibility = JavaVersion.VERSION_11
5253
}
53-
packagingOptions {
54+
packaging {
5455
resources.excludes.add("META-INF/*.md") // needed to prevent android compilation errors
5556
}
5657
defaultConfig {
@@ -82,9 +83,10 @@ val dokkaJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
8283

8384
kotlin {
8485
explicitApiWarning()
86+
jvmToolchain(17)
8587

8688
androidTarget {
87-
compilations.all { kotlinOptions.jvmTarget = "1.8" }
89+
compilations.all { kotlinOptions.jvmTarget = "17" }
8890

8991
mavenPublication { setupPom(artifactId) }
9092

gradle.properties

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ org.gradle.jvmargs=-Xmx8000m
66
# android target settings
77
android.useAndroidX=true
88
android.enableJetifier=true
9-
android.disableAutomaticComponentCreation=false
109

1110
# language dependencies
1211
kotlinVersion=1.9.10
@@ -18,9 +17,9 @@ ktorVersion=2.3.4
1817
korlibsVersion=3.4.0
1918
kotlinxCoroutinesVersion=1.7.3
2019

21-
androidBuildToolsVersion=7.2.0
22-
androidSpotifyAuthVersion=1.2.5
20+
androidBuildToolsVersion=8.1.0
21+
androidSpotifyAuthVersion=2.1.0
2322
androidCryptoVersion=1.0.0
24-
androidxCompatVersion=1.5.1
23+
androidxCompatVersion=1.6.1
2524

2625
sparkVersion=2.9.4

src/commonTest/kotlin/com.adamratzman/spotify/Common.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ suspend inline fun <reified T : Throwable> assertFailsWithSuspend(crossinline bl
4444

4545
fun <T> runTestOnDefaultDispatcher(block: suspend CoroutineScope.() -> T): TestResult = runTest(timeout = 60.seconds) {
4646
withContext(Dispatchers.Default) {
47-
block()
47+
try {
48+
block()
49+
} catch (e: SpotifyException.BadRequestException) {
50+
// we shouldn't fail just because we received a 5xx from spotify
51+
if (e.statusCode !in 500..599) {
52+
throw e;
53+
}
54+
55+
println("Received 5xx for block.")
56+
}
4857
}
4958
}
5059

0 commit comments

Comments
 (0)