Skip to content

Commit

Permalink
feat(#332): support Android 14 (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuester authored Mar 15, 2024
1 parent 5573039 commit 544d0d2
Show file tree
Hide file tree
Showing 53 changed files with 230 additions and 252 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
with:
submodules: true

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'

- name: Test Bash Keystores scripts
run: make test-bash-keystore
Expand Down Expand Up @@ -85,11 +85,11 @@ jobs:
with:
submodules: true

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'

- name: Enable KVM
run: |
Expand All @@ -112,13 +112,13 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-33-default
key: avd-34-default

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
api-level: 34
arch: x86_64
target: default
force-avd-creation: false
Expand All @@ -132,7 +132,7 @@ jobs:
- name: Run test-ui on unbranded
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
api-level: 34
arch: x86_64
target: default
force-avd-creation: false
Expand All @@ -142,7 +142,7 @@ jobs:
- name: Run test-ui on gamma
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
api-level: 34
arch: x86_64
target: default
force-avd-creation: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down
61 changes: 35 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort

buildscript {
repositories {
mavenCentral()
Expand All @@ -6,8 +9,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.5'
classpath 'com.android.tools.build:gradle:8.3.0'
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.8'
}
}

Expand All @@ -31,6 +34,7 @@ task checkstyle(type: Checkstyle) {
source 'src'
classpath = files()
ignoreFailures = false
exclude 'test/bash/bats/**'
}

task pmd(type: Pmd) {
Expand All @@ -40,19 +44,19 @@ task pmd(type: Pmd) {
source 'src'
exclude '**/**.png'
exclude '**/**.mp3'
exclude '**/**.bats'
exclude 'test/bash/bats/**'
dependencies {
pmd 'net.sourceforge.pmd:pmd-java:6.44.0'
pmd 'net.sourceforge.pmd:pmd-xml:6.44.0'
pmd 'net.sourceforge.pmd:pmd-java:6.55.0'
pmd 'net.sourceforge.pmd:pmd-xml:6.55.0'
}
}

spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = 'default'
reportLevel = 'default'
effort = Effort.valueOf('DEFAULT')
reportLevel = Confidence.valueOf('DEFAULT')
maxHeapSize = '1g'
omitVisitors = [
'FindReturnRef' // This app exchanges data with external applications, we assume is safe.
Expand Down Expand Up @@ -95,16 +99,16 @@ def getVersionName = {
}

android {
compileSdkVersion 33
buildToolsVersion '30.0.3'
compileSdk 34
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
resources {
excludes += ['META-INF/LICENSE', 'META-INF/NOTICE']
}
}

defaultConfig {
//noinspection OldTargetApi
targetSdkVersion 33
targetSdkVersion 34
minSdkVersion 21 // Android 5.0
versionCode getVersionCode()
versionName getVersionName()
Expand All @@ -125,8 +129,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
}
Expand Down Expand Up @@ -164,7 +168,11 @@ android {
}
}

lintOptions {
buildFeatures {
buildConfig true
}

lint {
lintConfig = new File('config/lint.xml')

disable 'UnusedResources' // linter can't handle static imports, so just skip this test
Expand All @@ -179,7 +187,6 @@ android {
abortOnError true
htmlReport false
textReport true
textOutput 'stdout'
}
}

Expand All @@ -191,6 +198,7 @@ android {

flavorDimensions 'brand'

namespace 'org.medicmobile.webapp.mobile'
productFlavors {
unbranded {
// we will not create project-specific src directories
Expand Down Expand Up @@ -425,18 +433,19 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.core:core:1.7.0'
implementation 'androidx.activity:activity:1.4.0'
implementation 'androidx.fragment:fragment:1.4.1'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.5.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.23')
implementation 'androidx.core:core:1.12.0'
implementation 'androidx.activity:activity:1.8.2'
implementation 'androidx.fragment:fragment:1.6.2'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:4.0.0'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'com.google.android:android-test:4.1.1.4'
testImplementation 'org.robolectric:robolectric:4.7'
testImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha05'
testImplementation 'androidx.test.espresso:espresso-intents:3.5.0-alpha05'
testImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
testImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
testImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:runner:1.5.2'
Expand Down
14 changes: 5 additions & 9 deletions coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ tasks.withType(Test) {

project.afterEvaluate {
def variantName = 'unbrandedDebug'
def testType = "${variantName.capitalize()}UnitTest"
def testTaskName = "test${testType}"
def testType = "${variantName}UnitTest"
def testTaskName = "test${testType.capitalize()}"

tasks.create(name: "make${testType}CoverageReport", type: JacocoReport, dependsOn: testTaskName) {
tasks.create(name: "make${testType.capitalize()}CoverageReport", type: JacocoReport, dependsOn: testTaskName) {
group = 'Reporting'
description = "Generate Jacoco coverage report for the ${variantName} build."

reports {
html.enabled(true)
}

def excludes = [
'**/R.class',
'**/R$*.class',
Expand All @@ -38,10 +34,10 @@ project.afterEvaluate {
]

classDirectories.from = files(fileTree(
dir: "${project.buildDir}/intermediates/javac/${variantName}/classes",
dir: layout.buildDirectory.dir("intermediates/javac/${variantName}/compile${variantName.capitalize()}JavaWithJavac/classes"),
excludes: excludes
))
sourceDirectories.from = file("${project.projectDir}/src/main/java")
executionData.from = file("${project.buildDir}/outputs/unit_test_code_coverage/${testType}/${testTaskName}.exec")
executionData.from = layout.buildDirectory.file("outputs/unit_test_code_coverage/${testType}/${testTaskName}.exec")
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 1 addition & 2 deletions src/bracuganda/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/cares_malawi_kch/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
3 changes: 1 addition & 2 deletions src/cares_malawi_mpc/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
3 changes: 1 addition & 2 deletions src/chis_ne/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/cht_rci/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/cht_rci_test/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/cmmb_kenya/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
</manifest>
3 changes: 1 addition & 2 deletions src/hope_through_health/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/icm_ph_chc/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

Expand Down
3 changes: 1 addition & 2 deletions src/itech_aurum/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
</manifest>
3 changes: 1 addition & 2 deletions src/itech_malawi/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.medicmobile.webapp.mobile">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
Loading

0 comments on commit 544d0d2

Please sign in to comment.