From eec6b6360fdf246614204f00ecfd1aa99bb5cc04 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sat, 17 Aug 2024 21:35:24 +1000 Subject: [PATCH 1/2] Bump target SDK and all other dependencies. --- .github/workflows/android.yml | 18 +++--- .idea/compiler.xml | 4 +- .idea/deploymentTargetDropDown.xml | 23 ++++++++ .idea/gradle.xml | 6 +- .idea/kotlinc.xml | 6 ++ .idea/migrations.xml | 10 ++++ .idea/misc.xml | 2 +- android/build.gradle | 55 +++++++++---------- build.gradle | 6 +- cli/build.gradle | 15 ++--- client/build.gradle | 2 +- .../metadata/android/en-US/changelogs/12.txt | 1 + gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 8 +-- settings.gradle | 2 +- web/build.gradle | 23 ++++---- 17 files changed, 114 insertions(+), 73 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/migrations.xml create mode 100644 fastlane/metadata/android/en-US/changelogs/12.txt diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index cbf56d0..2d32b97 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -12,14 +12,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: set up JDK 11 - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 + distribution: 'temurin' - name: Build Android app run: ./gradlew :android:build - - name: Build web app - run: ./gradlew :web:build - - name: Build cli app - run: ./gradlew :cli:build + # Disable for now until needed. Need to get android built to bump target SDK or else Google Play will be unhappy. Others can wait. + # - name: Build web app + # run: ./gradlew :web:build + # - name: Build cli app + # run: ./gradlew :cli:build diff --git a/.idea/compiler.xml b/.idea/compiler.xml index de85158..b589d56 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,8 +1,6 @@ - - - + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..b1b31a4 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 4d4b918..6a1a9da 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,10 +4,8 @@ diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..9a55c2d --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index f0718c2..73d7e2b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -39,7 +39,7 @@ - + diff --git a/android/build.gradle b/android/build.gradle index 4bd4105..0646f38 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,14 +5,15 @@ plugins { } android { - compileSdk 33 + compileSdk 34 + namespace "com.serwylo.babybook" defaultConfig { applicationId "com.serwylo.babybook" minSdk 21 - targetSdk 33 - versionCode 11 - versionName "0.9.1" + targetSdk 34 + versionCode 12 + versionName "0.9.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -48,37 +49,37 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } dependencies { implementation project(":library") - implementation 'com.github.babydots:immersivelock:1.0.1' + implementation 'com.github.babydots:immersivelock:1.0.2' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4' - implementation 'androidx.core:core-ktx:1.10.1' - implementation 'androidx.core:core-ktx:1.10.1' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.compose.material:material:1.4.3' - implementation 'com.google.android.material:material:1.9.0' + implementation 'androidx.core:core-ktx:1.13.1' + implementation 'androidx.core:core-ktx:1.13.1' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.compose.material:material:1.6.8' + implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.recyclerview:recyclerview:1.3.0' - implementation 'androidx.annotation:annotation:1.6.0' + implementation 'androidx.recyclerview:recyclerview:1.3.2' + implementation 'androidx.annotation:annotation:1.8.2' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' - def room_version = '2.5.2' + def room_version = '2.6.1' implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" kapt "androidx.room:room-compiler:$room_version" @@ -87,24 +88,22 @@ dependencies { implementation "com.google.dagger:dagger:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" - def lifecycle_version = '2.6.1' + def lifecycle_version = '2.8.4' implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" - def activity_version = "1.7.2" - implementation("androidx.activity:activity-ktx:1.7.2") + implementation("androidx.activity:activity-ktx:1.9.1") - def fragment_version = "1.4.0" - implementation("androidx.fragment:fragment-ktx:1.6.0") + implementation("androidx.fragment:fragment-ktx:1.8.2") - implementation("androidx.viewpager2:viewpager2:1.1.0-beta02") + implementation("androidx.viewpager2:viewpager2:1.1.0") implementation 'com.squareup.picasso:picasso:2.8' implementation 'com.tbuonomo:dotsindicator:4.2' - implementation 'androidx.preference:preference-ktx:1.2.0' + implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'io.github.tonnyl:whatsnew:0.1.7' diff --git a/build.gradle b/build.gradle index 4fb647d..4383c83 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.2.2' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22' // NOTE: Do not place your application dependencies here; they belong @@ -13,9 +13,9 @@ buildscript { } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } // For heroku deployments. -task stage(dependsOn: [':web:dist']) +tasks.register('stage') { dependsOn[':web:dist'] } diff --git a/cli/build.gradle b/cli/build.gradle index 3e67a20..0f0f78d 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -3,8 +3,8 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { @@ -12,24 +12,25 @@ dependencies { implementation project(":library") implementation "org.jetbrains.kotlinx:kotlinx-cli:0.3.4" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3" } project.ext.mainClassName = "com.serwylo.babybook.cli.ApplicationKt" -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName +tasks.register('run', JavaExec) { + dependsOn classes + mainClass = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in } -task dist(type: Jar) { +tasks.register('dist', Jar) { manifest { attributes 'Main-Class': project.mainClassName } duplicatesStrategy("exclude") - dependsOn [ + dependsOn[ configurations.runtimeClasspath, classes, ] diff --git a/client/build.gradle b/client/build.gradle index c49a7f7..a1a479f 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.siouan.frontend-jdk11' + id 'org.siouan.frontend-jdk17' version "8.1.0" } frontend { diff --git a/fastlane/metadata/android/en-US/changelogs/12.txt b/fastlane/metadata/android/en-US/changelogs/12.txt new file mode 100644 index 0000000..ece5126 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/12.txt @@ -0,0 +1 @@ +Bump target SDK to latest version. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 98bed16..5436bb1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,6 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 39d11c9..7fea1c5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Jan 14 21:19:08 AEDT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/library/build.gradle b/library/build.gradle index 00bb16b..0078ad3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -4,15 +4,15 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { - implementation 'com.google.code.gson:gson:2.8.9' + implementation 'com.google.code.gson:gson:2.10' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3" implementation "io.ktor:ktor-client-core:1.6.3" implementation "io.ktor:ktor-client-cio:1.6.3" diff --git a/settings.gradle b/settings.gradle index 2f85a50..5f2b4fa 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ pluginManagement { plugins { - id 'org.siouan.frontend-jdk11' version '6.0.0' + id 'org.siouan.frontend-jdk17' version '8.1.0' } repositories { gradlePluginPortal() diff --git a/web/build.gradle b/web/build.gradle index dca9683..8f10f7a 100644 --- a/web/build.gradle +++ b/web/build.gradle @@ -4,8 +4,8 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { @@ -17,21 +17,22 @@ dependencies { implementation "io.ktor:ktor-gson:1.6.3" implementation "ch.qos.logback:logback-classic:1.2.5" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3" } project.ext.mainClassName = "com.serwylo.babybook.web.ServerKt" -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName +tasks.register('run', JavaExec) { + dependsOn classes + mainClass = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in ignoreExitValue = true } // See: https://github.com/siouan/frontend-gradle-plugin/blob/master/examples/multi-projects-war-application/backend/build.gradle -task processFrontendResources(type: Copy) { +tasks.register('processFrontendResources', Copy) { group 'Frontend' description 'Process frontend resources' dependsOn project(':client').tasks.named('assembleFrontend') @@ -40,15 +41,15 @@ task processFrontendResources(type: Copy) { into file("${project.buildDir}/resources/main/public") } -task dist(type: Jar) { +tasks.register('dist', Jar) { manifest { attributes 'Main-Class': project.mainClassName } duplicatesStrategy("exclude") - dependsOn [ - processFrontendResources, - configurations.runtimeClasspath, - classes, + dependsOn[ + processFrontendResources, + configurations.runtimeClasspath, + classes, ] from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } From a9b377ee9a57098a60d6098b8bcedb9a6fd6ee8f Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sun, 18 Aug 2024 20:47:54 +1000 Subject: [PATCH 2/2] Appease linter. --- .../java/com/serwylo/babybook/booklist/BookListFragment.kt | 4 ++-- .../com/serwylo/babybook/onboarding/OnboardingFragment.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/serwylo/babybook/booklist/BookListFragment.kt b/android/src/main/java/com/serwylo/babybook/booklist/BookListFragment.kt index a0f75f8..ab99e48 100644 --- a/android/src/main/java/com/serwylo/babybook/booklist/BookListFragment.kt +++ b/android/src/main/java/com/serwylo/babybook/booklist/BookListFragment.kt @@ -31,7 +31,7 @@ class BookListFragment : Fragment() { ): View { val binding = FragmentBookListBinding.inflate(inflater, container, false) - viewModel.isInEditMode.observe(this) { isInEditMode -> + viewModel.isInEditMode.observe(viewLifecycleOwner) { isInEditMode -> binding.editMode.visibility = if (isInEditMode) View.VISIBLE else View.GONE binding.addBookButton.visibility = if (isInEditMode) View.VISIBLE else View.GONE } @@ -45,7 +45,7 @@ class BookListFragment : Fragment() { else -> GridLayoutManager(context, columnCount) } - binding.list.adapter = BookListAdapter(context!!).also { adapter -> + binding.list.adapter = BookListAdapter(requireContext()).also { adapter -> adapter.setBookSelectedListener { book -> diff --git a/android/src/main/java/com/serwylo/babybook/onboarding/OnboardingFragment.kt b/android/src/main/java/com/serwylo/babybook/onboarding/OnboardingFragment.kt index 029cbdf..bee868a 100644 --- a/android/src/main/java/com/serwylo/babybook/onboarding/OnboardingFragment.kt +++ b/android/src/main/java/com/serwylo/babybook/onboarding/OnboardingFragment.kt @@ -55,7 +55,7 @@ class OnboardingFragment( binding.title.text = title binding.description.text = description - binding.image.setImageDrawable(AppCompatResources.getDrawable(context!!, drawableRes)) + binding.image.setImageDrawable(AppCompatResources.getDrawable(requireContext(), drawableRes)) return binding.root }