Skip to content

Commit

Permalink
roboelctric unit test fix (#1962)
Browse files Browse the repository at this point in the history
* check for unit test fix

* trigger ci

* remove older workaround

* Update mapbox-maps-android/build.gradle.kts

Co-authored-by: Alexander Kulikovskiy <[email protected]>

---------

Co-authored-by: Alexander Kulikovskiy <[email protected]>
  • Loading branch information
ank27 and Alexander Kulikovskiy authored Aug 23, 2023
1 parent 53958d4 commit 4609edf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 10 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ allprojects {
}
}

// hack to fix unit test, see https://github.com/robolectric/robolectric/issues/5131#issuecomment-509631890.
subprojects {
tasks.withType<Test>().configureEach {
maxParallelForks = 2
setForkEvery(80)
setMaxHeapSize("2048m")
setMinHeapSize("1024m")
}
}

plugins {
id("com.mapbox.gradle.root")
// the IDE mistakenly highlights `libs` as an error, see https://github.com/gradle/gradle/issues/22797
Expand All @@ -76,10 +86,6 @@ plugins {
alias(libs.plugins.taskTreeId)
}

tasks.withType<Test> {
maxParallelForks = (Runtime.getRuntime().availableProcessors()).takeIf { it > 0 } ?: 1
}

apiValidation {
/**
* Packages that are excluded from public API dumps even if they
Expand Down
5 changes: 0 additions & 5 deletions sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ android {
unitTests.apply {
isIncludeAndroidResources = true
}
// workaround for https://github.com/robolectric/robolectric/issues/5456 to fix OOM on CI
unitTests.all {
it.systemProperty("robolectric.dependency.repo.id'", "mavenCentral")
it.systemProperty("robolectric.dependency.repo.url", "https://repo1.maven.org/maven2")
}
animationsDisabled = true
if (!project.hasProperty("android.injected.invoked.from.ide")) {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
Expand Down

0 comments on commit 4609edf

Please sign in to comment.