Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshay0701 committed Apr 15, 2021
2 parents df4a752 + a1ebaa0 commit b67ace6
Show file tree
Hide file tree
Showing 566 changed files with 8,622 additions and 3,254 deletions.
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 0 additions & 163 deletions .travis.yml

This file was deleted.

22 changes: 15 additions & 7 deletions AnkiDroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ android {
//
// This ensures the correct ordering between the various types of releases (dev < alpha < beta < release) which is
// needed for upgrades to be offered correctly.
versionCode=21500136
versionName="2.15alpha36"
versionCode=21500142
versionName="2.15alpha42"
minSdkVersion 21
//noinspection OldTargetApi - also performed in api/build.fradle
targetSdkVersion 29 // change .travis.yml platform download at same time
Expand Down Expand Up @@ -84,13 +84,18 @@ android {
testCoverageEnabled true
}

// make the icon red if in debug mode
resValue 'color', 'anki_foreground_icon_color_0', "#FFFF0000"
resValue 'color', 'anki_foreground_icon_color_1', "#FFFF0000"
}
release {
minifyEnabled true
splits.abi.universalApk = universalApkEnabled // Build universal APK for release with `-Duniversal-apk=true`
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "String", "ACRA_URL", '"https://ankidroid.org/acra/report"'
resValue 'color', 'anki_foreground_icon_color_0', "#FF29B6F6"
resValue 'color', 'anki_foreground_icon_color_1', "#FF0288D1"
}
}

Expand Down Expand Up @@ -154,6 +159,7 @@ android {
preDexLibraries = preDexEnabled && !ciBuild
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Expand Down Expand Up @@ -216,9 +222,10 @@ dependencies {
}
}

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
compileOnly 'org.jetbrains:annotations:20.1.0'
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc7"
annotationProcessor "com.google.auto.service:auto-service:1.0-rc7"
compileOnly "com.google.auto.service:auto-service-annotations:1.0"
annotationProcessor "com.google.auto.service:auto-service:1.0"

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.activity:activity:1.2.2'
Expand All @@ -229,7 +236,7 @@ dependencies {
implementation 'androidx.fragment:fragment:1.3.2'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation "androidx.preference:preference:1.1.1"
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.sqlite:sqlite-framework:2.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
Expand All @@ -241,11 +248,11 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'

// == Rust conversion (from Anki-Android-Backend on GitHub) ==
String backendVersion = "0.1.2" // We want both testing and implementation on the same version
String backendVersion = "0.1.4" // We want both testing and implementation on the same version
// build with ./gradlew rsdroid:assembleRelease
// In my experience, using `files()` currently requires a reindex operation, which is slow.
// implementation files("C:\\GitHub\\Rust-Test\\rsdroid\\build\\outputs\\aar\\rsdroid-release.aar")
implementation 'com.google.protobuf:protobuf-java:3.15.6' // This is required when loading from a file
implementation 'com.google.protobuf:protobuf-java:3.15.7' // This is required when loading from a file
implementation "io.github.david-allison-1:anki-android-backend:$backendVersion"
// build with ./gradlew rsdroid-testing:assembleRelease
// RobolectricTest.java: replace RustBackendLoader.init(); with RustBackendLoader.loadRsdroid(path);
Expand All @@ -264,6 +271,7 @@ dependencies {
// io.github.java-diff-utils:java-diff-utils is the natural successor here, but requires API24, #7091
implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'
implementation 'org.apache.commons:commons-compress:1.12' // #6419 - handle >2GB apkg files
implementation 'org.apache.commons:commons-collections4:4.4' // SetUniqueList
implementation 'net.mikehardy:google-analytics-java7:2.0.13'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.arcao:slf4j-timber:3.1'
Expand Down
65 changes: 63 additions & 2 deletions AnkiDroid/jacoco.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import groovy.transform.*

apply plugin: 'jacoco'

jacoco {
Expand All @@ -11,16 +13,63 @@ android {
}
}

@Memoized
Properties getLocalProperties() {
final propertiesFile = project.rootProject.file("local.properties")

final properties = new Properties()

if (propertiesFile.exists()) {
properties.load(propertiesFile.newDataInputStream())
}

return properties
}

def openReport(htmlOutDir) {
final reportPath = "$htmlOutDir/index.html"

println "HTML Report: $reportPath"

if (!project.hasProperty("open-report")) {
println "to open the report automatically in your default browser add '-Popen-report' cli argument"
return
}

def os = org.gradle.internal.os.OperatingSystem.current()
if (os.isWindows()) {
exec { commandLine 'cmd', '/c', "start $reportPath" }
} else if (os.isMacOsX()) {
exec { commandLine 'open', "$reportPath" }
} else if (os.isLinux()) {
try {
exec { commandLine 'xdg-open', "$reportPath" }
} catch (Exception ignored) {
if (localProperties.containsKey("linux-html-cmd")) {
exec { commandLine properties.get("linux-html-cmd"), "$reportPath" }
} else {
println "'linux-html-cmd' property could not be found in 'local.properties'"
}
}
}
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}

// Our merge report task
task jacocoTestReport(type: JacocoReport, dependsOn: ['jacocoAndroidTestReport', 'jacocoUnitTestReport']) {
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'connectedDebugAndroidTest']) {
def htmlOutDir = layout.buildDirectory.dir("reports/jacoco/$name/html").get().asFile

doLast {
openReport htmlOutDir
}

reports {
xml.enabled = true
html.destination htmlOutDir
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
Expand All @@ -37,9 +86,15 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['jacocoAndroidTestReport',

// A unit-test only report task
task jacocoUnitTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
def htmlOutDir = layout.buildDirectory.dir("reports/jacoco/$name/html").get().asFile

doLast {
openReport htmlOutDir
}

reports {
xml.enabled = true
html.destination htmlOutDir
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
Expand All @@ -54,11 +109,17 @@ task jacocoUnitTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest'])
])
}

// Our merge report task
// A connected android tests only report task
task jacocoAndroidTestReport(type: JacocoReport, dependsOn: ['connectedDebugAndroidTest']) {
def htmlOutDir = layout.buildDirectory.dir("reports/jacoco/$name/html").get().asFile

doLast {
openReport htmlOutDir
}

reports {
xml.enabled = true
html.destination htmlOutDir
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void testNumpadAction() {
PeripheralKeymap peripheralKeymap = new PeripheralKeymap(MockReviewerUi.displayingAnswer(), processed::add);
peripheralKeymap.setup();

peripheralKeymap.onKeyDown(KeyEvent.KEYCODE_NUMPAD_1, getNumpadEvent(KeyEvent.KEYCODE_NUMPAD_1));
peripheralKeymap.onKeyUp(KeyEvent.KEYCODE_NUMPAD_1, getNumpadEvent(KeyEvent.KEYCODE_NUMPAD_1));


Expand Down
Loading

0 comments on commit b67ace6

Please sign in to comment.