Last active
September 15, 2023 15:32
-
-
Save sembozdemir/6341312d9528c5b3d6a4b5907d5caa18 to your computer and use it in GitHub Desktop.
Fix for Robolectric and Bitrise issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ignore Robolectric jar dependencies | |
#Robolectric jars for unit tests | |
/robolectric/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this line into your root build.gradle | |
// and make sure to run `fetchRobolectricDependencies` gradle task before running your tests | |
// e.g. `./gradlew fetchRobolectricDependencies test` | |
apply from: "$rootDir/robolectric.gradle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this file into your root directory | |
configurations { | |
robo32Instrumented | |
robo33Instrumented | |
} | |
dependencies { | |
robo32Instrumented "org.robolectric:android-all-instrumented:12.1-robolectric-8229987-i4" | |
robo33Instrumented "org.robolectric:android-all-instrumented:13-robolectric-9030017-i4" | |
} | |
def robolectricDependencies = "$rootDir/robolectric" | |
tasks.register('fetchRobolectricDependencies', Copy) { | |
from configurations.robo32Instrumented | |
from configurations.robo33Instrumented | |
into robolectricDependencies | |
} | |
subprojects { | |
afterEvaluate { | |
if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) { | |
android { | |
testOptions.unitTests.all { | |
systemProperty 'robolectric.offline', 'true' | |
systemProperty 'robolectric.dependency.dir', robolectricDependencies | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment