Skip to content

Commit

Permalink
fix: [ANDROAPP-6169] Update gradle and kotlin version (#3700)
Browse files Browse the repository at this point in the history
* fix: [ANDROAPP-6169] Update gradle and kotlin version

Signed-off-by: Pablo <[email protected]>

* fix test

Signed-off-by: Pablo <[email protected]>

* wait for compose to idle in test

Signed-off-by: Pablo <[email protected]>

---------

Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan authored Jul 1, 2024
1 parent d5326e7 commit 1f5681b
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/venv
/*.secrets.yml
/gradle.deps
.kotlin/
16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import java.io.ByteArrayOutputStream
import java.text.SimpleDateFormat
import java.util.Date
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
id("kotlinx-serialization")
id("dagger.hilt.android.plugin")
alias(libs.plugins.kotlin.compose.compiler)
}
apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")

Expand Down Expand Up @@ -74,7 +76,6 @@ android {
defaultConfig {
applicationId = "com.dhis2"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
versionCode = libs.versions.vCode.get().toInt()
versionName = libs.versions.vName.get()
testInstrumentationRunner = "org.dhis2.Dhis2Runner"
Expand Down Expand Up @@ -216,19 +217,18 @@ android {
}
}

kotlinOptions {
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
}
lint {
abortOnError = false
checkReleaseBuilds = false
}
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(project(":viewpagerdotsindicator"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,6 @@ class EventInitialTest {

val date: Date? = dateFormat.parse(dateString)

private val eventDetailsRepository: EventDetailsRepository = mock {
on { getProgramStage() } doReturn programStage
on { catCombo() } doReturn catCombo
on { getEvent() } doReturn null
on { getObjectStyle() } doReturn style
on { getOrganisationUnit(ORG_UNIT_UID) } doReturn orgUnit
on { getGeometryModel() } doReturn geometryModel
on { getCatOptionCombos(CAT_COMBO_UID) } doReturn listOf(categoryOptionCombo)
on { getEditableStatus() } doReturn EventEditableStatus.Editable()
on { getEnrollmentDate(ENROLLMENT_UID) } doReturn date
on { getStageLastDate(ENROLLMENT_UID) } doReturn DateUtils.uiDateFormat()
.parse("20/8/2023")!!

}

private val metadataIconProvider:MetadataIconProvider = mock{
on { invoke(any()) }doReturn MetadataIconData.defaultIcon()
}
Expand Down Expand Up @@ -118,6 +103,20 @@ class EventInitialTest {
on { provideDueDate() } doReturn "Due date"
}

private val eventDetailsRepository: EventDetailsRepository = mock {
on { getProgramStage() } doReturn programStage
on { catCombo() } doReturn catCombo
on { getEvent() } doReturn null
on { getObjectStyle() } doReturn style
on { getOrganisationUnit(ORG_UNIT_UID) } doReturn orgUnit
on { getGeometryModel() } doReturn geometryModel
on { getCatOptionCombos(CAT_COMBO_UID) } doReturn listOf(categoryOptionCombo)
on { getEditableStatus() } doReturn EventEditableStatus.Editable()
on { getEnrollmentDate(ENROLLMENT_UID) } doReturn date
on { getStageLastDate(ENROLLMENT_UID) } doReturn DateUtils.uiDateFormat()
.parse("20/8/2023")!!
}

private fun createConfigureEventTemp(eventCreationType: EventCreationType) = ConfigureEventTemp(
creationType = eventCreationType,
)
Expand Down
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Locale

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
Expand Down Expand Up @@ -43,7 +45,7 @@ sonarqube {

val isNonStable: (String) -> Boolean = { version ->
val stableKeyword =
listOf("RELEASE", "FINAL", "GA").any { it -> version.toUpperCase().contains(it) }
listOf("RELEASE", "FINAL", "GA").any { it -> version.uppercase().contains(it) }
val regex = """^[0-9,.v-]+(-r)?$""".toRegex()
!stableKeyword && !(version matches regex)
}
Expand Down Expand Up @@ -113,7 +115,7 @@ allprojects {
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}


Expand Down
19 changes: 10 additions & 9 deletions commons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
alias(libs.plugins.kotlin.compose.compiler)
}

apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")
Expand All @@ -17,7 +20,7 @@ android {

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
testOptions.targetSdk = libs.versions.sdk.get().toInt()
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -48,19 +51,17 @@ android {
dataBinding = true
}

kotlinOptions {
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
}

configurations.all {
resolutionStrategy.cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
}
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
api(project(":ui-components"))
Expand Down
15 changes: 8 additions & 7 deletions compose-table/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
id("kotlinx-serialization")
alias(libs.plugins.kotlin.compose.compiler)
}
apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")

Expand All @@ -11,7 +14,7 @@ android {

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
testOptions.targetSdk = libs.versions.sdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
Expand All @@ -38,13 +41,11 @@ android {
buildFeatures {
compose = true
}
}

kotlinOptions {
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class CellTableTest {
)
val firstId = fakeModel.first().id!!
clickOnCell(firstId, 1, 0)
composeTestRule.waitForIdle()
typeOnInputComponent("check")
composeTestRule.waitForIdle()
assertCellHasText(firstId, 1, 0, "check")
}
}
Expand Down
9 changes: 7 additions & 2 deletions dhis2-mobile-program-rules/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
Expand Down Expand Up @@ -30,8 +32,11 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
15 changes: 8 additions & 7 deletions dhis2_android_maps/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
alias(libs.plugins.kotlin.compose.compiler)
}
apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")

Expand All @@ -11,7 +14,7 @@ android {

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
testOptions.targetSdk = libs.versions.sdk.get().toInt()
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -40,13 +43,11 @@ android {
dataBinding = true
}
flavorDimensions += listOf("default")
}

kotlinOptions {
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
14 changes: 8 additions & 6 deletions dhis_android_analytics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
alias(libs.plugins.kotlin.compose.compiler)
}
apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")

Expand All @@ -16,7 +19,7 @@ android {

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
testOptions.targetSdk = libs.versions.sdk.get().toInt()
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -46,12 +49,11 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
19 changes: 10 additions & 9 deletions form/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
alias(libs.plugins.kotlin.compose.compiler)
}
apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts")

Expand All @@ -15,7 +18,7 @@ android {

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.sdk.get().toInt()
testOptions.targetSdk = libs.versions.sdk.get().toInt()
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -46,21 +49,19 @@ android {
dataBinding = true
}

kotlinOptions {
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get()
}

testOptions {
unitTests {
isReturnDefaultValues = true
}
}
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

Expand Down
8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ minSdk = "21"
vCode = "130"
vName = "3.0"
kotlinCompilerExtensionVersion = "1.5.6"
gradle = "8.2.2"
kotlin = '1.9.21'
gradle = "8.4.2"
kotlin = '2.0.0'
hilt = '2.47'
jacoco = '0.8.10'
designSystem = "0.3.0-SNAPSHOT"
Expand Down Expand Up @@ -84,7 +84,7 @@ androidx_test = "1.5.0"
dexmaker-mockito-inline = "2.28.1"
hamcrest = "2.2"
kotlinxserialization = "1.5.1"
desugar_jdk_libs = "2.0.3"
desugar_jdk_libs = "2.0.4"
google_truth = "1.1.2"
kotlinxcoroutines = "1.6.4"
rxrelay = "2.1.1"
Expand Down Expand Up @@ -213,6 +213,8 @@ dispatcher-dispatchCore = { group = "com.rickbusarow.dispatch", name = "dispatch
dispatcher-dispatchEspresso = { group = "com.rickbusarow.dispatch", name = "dispatch-android-espresso", version = "1.0.0-beta10" }
deprecated-autoValueParcel = { group = "com.ryanharter.auto.value", name = "auto-value-parcel", version.ref = "autovalueparcel" } #TODO: Remove alongside AutoValue
[plugins]
kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

[bundles]
uicomponents-implementation = ["androidx-coreKtx", "androidx-material3", "google-material", "lottie-compose", "dhis2-mobile-designsystem"]
uicomponents-api = ["dhis2-mobile-designsystem", "androidx-compose-constraintlayout", "androidx-compose-preview", "androidx-compose-ui", "google-material-themeadapter", "google-material3-themeadapter"]
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Aug 09 13:28:11 CEST 2023
#Wed Jun 26 12:02:53 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 1f5681b

Please sign in to comment.