Skip to content

Commit

Permalink
Upgrade gradle to 8.1.2 and add support for kotlin and kapt (#627)
Browse files Browse the repository at this point in the history
## Proposed Changes

- Upgrade `gradle` to `8.1.2`
- Add support for `kotlin` and `kapt` to serve as base for writing
kotlin code moving forward
  • Loading branch information
aanorbel authored Nov 3, 2023
1 parent f656344 commit 7deb8bf
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
18 changes: 11 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'
}
apply from: 'jacoco.gradle'

Expand Down Expand Up @@ -85,8 +86,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding = true
Expand All @@ -111,7 +115,7 @@ dependencies {
implementation libs.google.gson

// Third-party
annotationProcessor libs.dbflow.processor
kapt libs.dbflow.processor
implementation libs.dbflow.core
implementation libs.dbflow.lib

Expand All @@ -136,7 +140,7 @@ dependencies {

// Dependency Injection
implementation libs.google.dagger
annotationProcessor libs.google.dagger.compiler
kapt libs.google.dagger.compiler

// Logger
implementation project(':applogger')
Expand All @@ -153,7 +157,7 @@ dependencies {
testImplementation libs.robolectric
testImplementation libs.faker
testImplementation libs.ooni.oonimkall
testAnnotationProcessor libs.google.dagger.compiler
kaptTest libs.google.dagger.compiler

// Instrumentation Testing
androidTestImplementation project(':shared-test')
Expand All @@ -166,7 +170,7 @@ dependencies {
androidTestImplementation libs.androidx.espresso.contrib
androidTestImplementation libs.androidx.espresso.core
androidTestImplementation libs.barista
androidTestAnnotationProcessor libs.google.dagger.compiler
kaptAndroidTest libs.google.dagger.compiler
}

static def versionCodeDate() {
Expand Down
20 changes: 13 additions & 7 deletions app/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ task jacocoAndroidTestReport(type: JacocoReport) {
executionData.from += fileTree(dir: codeCoverageDataLocation, includes: ['**/*.ec'])
}

reports {
html.enabled true
html.destination file("${buildDir}/reports/coverage")
xml.enabled true
xml.destination file("${buildDir}/reports/coverage.xml")
csv.enabled false
}
reports {
html {
enabled true
destination file("${buildDir}/reports/coverage")
}
xml {
enabled true
destination file("${buildDir}/reports/coverage.xml")
}
csv {
enabled false
}
}

doLast {
println "Wrote HTML coverage report to ${reports.html.destination}/index.html"
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[versions]
androidGradlePlugin = "7.4.1"
androidGradlePlugin = "8.1.2"
barista = "3.9.0"
countlySdk = "23.6.0"
faker = "1.2.8"
mockitoCore = "5.3.1"
mockitoInline = "4.6.1"
robolectric = "4.6.1"
robolectric = "4.10.3"
fastlaneScreengrab = "2.0.0"
sentryAndroid = "6.3.0"
xanscaleLocalhostToolkit = "19.05.01"
commonsIo = "2.6"
jacoco = "0.8.5"
jacoco = "0.8.7"
kotlin = "1.8.0"

# Android X
Expand All @@ -29,7 +29,7 @@ androidxEspressoCore = "3.5.1"
googleGson = "2.8.9"
googleGuava = "30.1.1-android"
googleMaterial = "1.6.1"
googleDagger = "2.36"
googleDagger = "2.45"
googleFirebaseBon = "26.3.0"
googlePlaycore = "1.10.3"

Expand Down
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.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
21 changes: 13 additions & 8 deletions shared-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}

android {
namespace 'org.openobservatory.ooniprobe.shared.test'
compileSdk 33
compileSdk libs.versions.compileSdk.get().toInteger()

defaultConfig {
minSdk 21
minSdk libs.versions.minSdk.get().toInteger()
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
flavorDimensions = ['testing', 'license']
productFlavors {
Expand Down Expand Up @@ -41,12 +45,12 @@ dependencies {

// Dependency Injection (https://dagger.dev/)
implementation libs.google.dagger
annotationProcessor libs.google.dagger.compiler
kapt libs.google.dagger.compiler

// Database Library (https://github.com/agrosner/DBFlow)
implementation libs.dbflow.core
implementation libs.dbflow.lib
annotationProcessor libs.dbflow.processor
kapt libs.dbflow.processor

// Gson Serialization Library (https://github.com/google/gson)
implementation libs.google.gson
Expand All @@ -60,6 +64,7 @@ dependencies {
implementation libs.retrofit.logging.interceptor

implementation libs.androidx.appcompat
implementation libs.xanscale.localhost.toolkit

testImplementation libs.junit4
androidTestImplementation libs.androidx.junit
Expand Down

0 comments on commit 7deb8bf

Please sign in to comment.