mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 03:52:15 +02:00
Update downloaded robolectric versions (#14387)
* Update downloaded robolectric versions These are the versions on a clean install, found by the command `find ~/.m2 -type d -name '*-robolectric-*'`. * Remove old Android SDK versions for robolectric The minimum Android SDK version is now 23, which these versions are older than. * Add comment to describe how to update versions * Use android-all-instrumented artifacts These are the artifacts that are downloaded by default on my machine when running the latest version of Robolectric in online mode. * Update comment to clarify terminal location
This commit is contained in:
parent
65beca96a2
commit
90e2fac42b
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Downloads all android-all dependencies and copies them to the mavenLocal() repository
|
||||
* Downloads all android-all-instrumented dependencies and copies them to the mavenLocal() repository
|
||||
*
|
||||
* Once applied to your gradle project, can be executed with ./gradlew robolectricSdkDownload
|
||||
*/
|
||||
@ -12,21 +12,25 @@ import java.nio.file.Files
|
||||
|
||||
// List from: https://github.com/robolectric/robolectric/blob/master/robolectric/src/main/java/org/robolectric/plugins/DefaultSdkProvider.java
|
||||
// This list will need to be updated for new Android SDK versions that come out.
|
||||
|
||||
// Only the versions currently used in AnkiDroid Robolectric tests are active, the rest are commented out
|
||||
// To update these versions, open a terminal in the Anki-Android directory and perform the following steps:
|
||||
// 1. Run `rm -r ~/.m2` to delete the .m2 directory in your home directory.
|
||||
// 2. Run `./gradlew jacocoUnitTestReport` to run all unit tests.
|
||||
// 3. Run `find ~/.m2 -type d -name '*-robolectric-*'`.
|
||||
// 4. Update the lines below to match the output from `find`.
|
||||
def robolectricAndroidSdkVersions = [
|
||||
[androidVersion: "5.0.2_r3", frameworkSdkBuildVersion: "r0"],
|
||||
[androidVersion: "5.1.1_r9", frameworkSdkBuildVersion: "r2"],
|
||||
// [androidVersion: "6.0.1_r3", frameworkSdkBuildVersion: "r1"],
|
||||
// [androidVersion: "7.0.0_r1", frameworkSdkBuildVersion: "r1"],
|
||||
// [androidVersion: "7.1.0_r7", frameworkSdkBuildVersion: "r1"],
|
||||
// [androidVersion: "8.0.0_r4", frameworkSdkBuildVersion: "r1"],
|
||||
// [androidVersion: "8.1.0", frameworkSdkBuildVersion: "4611349"],
|
||||
// [androidVersion: "9", frameworkSdkBuildVersion: "4913185-2"],
|
||||
[androidVersion: "9", frameworkSdkBuildVersion: "4913185-2"],
|
||||
[androidVersion: "10", frameworkSdkBuildVersion: "5803371"],
|
||||
// [androidVersion: "11", frameworkSdkBuildVersion: "6757853"],
|
||||
[androidVersion: "11", frameworkSdkBuildVersion: "6757853"],
|
||||
// [androidVersion: "12", frameworkSdkBuildVersion: "7732740"],
|
||||
[androidVersion: "12.1", frameworkSdkBuildVersion: "8229987"],
|
||||
// [androidVersion: "13", frameworkSdkBuildVersion: "9030017"],
|
||||
[androidVersion: "13", frameworkSdkBuildVersion: "9030017"],
|
||||
]
|
||||
|
||||
// Base, public task - will be displayed in ./gradlew robolectricDownloader:tasks
|
||||
@ -37,15 +41,15 @@ task robolectricSdkDownload {
|
||||
|
||||
// Generate the configuration and actual copy tasks.
|
||||
robolectricAndroidSdkVersions.forEach { robolectricSdkVersion ->
|
||||
def version = "${robolectricSdkVersion['androidVersion']}-robolectric-${robolectricSdkVersion['frameworkSdkBuildVersion']}"
|
||||
def version = "${robolectricSdkVersion['androidVersion']}-robolectric-${robolectricSdkVersion['frameworkSdkBuildVersion']}-i4"
|
||||
|
||||
// Creating a configuration with a dependency allows Gradle to manage the actual resolution of
|
||||
// the jar file
|
||||
def sdkConfig = configurations.create(version)
|
||||
dependencies.add(version, "org.robolectric:android-all:${version}")
|
||||
dependencies.add(version, "org.robolectric:android-all-instrumented:${version}")
|
||||
|
||||
def mavenLocalFile = new File(this.repositories.mavenLocal().url)
|
||||
def mavenRobolectric = new File(mavenLocalFile, "org/robolectric/android-all/${version}")
|
||||
def mavenRobolectric = new File(mavenLocalFile, "org/robolectric/android-all-instrumented/${version}")
|
||||
// Copying all files downloaded for the created configuration into maven local.
|
||||
task "robolectricSdkDownload-${version}"(type: Copy) {
|
||||
from sdkConfig
|
||||
@ -53,7 +57,7 @@ robolectricAndroidSdkVersions.forEach { robolectricSdkVersion ->
|
||||
|
||||
doLast {
|
||||
ArtifactResolutionResult result = dependencies.createArtifactResolutionQuery()
|
||||
.forModule("org.robolectric", "android-all", version)
|
||||
.forModule("org.robolectric", "android-all-instrumented", version)
|
||||
.withArtifacts(MavenModule, MavenPomArtifact)
|
||||
.execute()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user