Skip to content

Commit

Permalink
Kotlin 1.9.10, AGP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolay Kochetkov committed Sep 14, 2023
1 parent 9b4a50f commit 33ed337
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up JDK 1.11
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.11
java-version: 17
- name: Cache
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
with:
fetch-depth: 0
ref: refs/remotes/origin/master
- name: set up JDK 1.11
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.11
java-version: 17
- name: Cache
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

40 changes: 15 additions & 25 deletions appupdatewrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ kapt {
}

android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
compileSdk androidCompileSdkVersion
testOptions.unitTests.includeAndroidResources = true

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}

defaultConfig {
Expand All @@ -52,15 +51,22 @@ android {
}
}
namespace 'com.motorro.appupdatewrapper'

publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

api 'androidx.core:core-ktx:1.10.1'
api 'androidx.lifecycle:lifecycle-common:2.6.1'
api 'androidx.core:core-ktx:1.12.0'
api 'androidx.lifecycle:lifecycle-common:2.6.2'
api 'com.google.android.play:core:1.10.3'

implementation 'com.jakewharton.timber:timber:5.0.1'
Expand All @@ -71,8 +77,8 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
testImplementation 'org.robolectric:robolectric:4.8.1'
testImplementation 'androidx.lifecycle:lifecycle-runtime-testing:2.6.1'
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'androidx.lifecycle:lifecycle-runtime-testing:2.6.2'
}

dokkaJavadoc.configure {
Expand All @@ -84,20 +90,6 @@ dokkaJavadoc.configure {
}
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from "$buildDir/javadoc"
}

task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.source
}

artifacts {
archives sourcesJar, javadocJar
}

def libId = 'appupdatewrapper'
def libName = 'appupdatewrapper'
def libDesc = 'A wrapper for Android `AppUpdateManager` to encapsulate update workflow.'
Expand All @@ -108,8 +100,6 @@ afterEvaluate {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
artifact sourcesJar
artifact javadocJar
groupId = rootProject.group
artifactId = libId
version = rootProject.version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package com.motorro.appupdatewrapper

import android.app.Activity
import android.os.Looper.getMainLooper
import androidx.test.core.app.ActivityScenario.launch
import androidx.test.core.app.ActivityScenario.launchActivityForResult
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.android.play.core.appupdate.testing.FakeAppUpdateManager
import com.motorro.appupdatewrapper.AppUpdateWrapper.Companion.REQUEST_CODE_UPDATE
Expand Down Expand Up @@ -49,7 +49,7 @@ class FlexibleUpdateKtTest: TestAppTest() {
@LooperMode(LooperMode.Mode.PAUSED)
fun startsFlexibleUpdateIfAvailable() {
lateinit var updateManager: FakeAppUpdateManager
val scenario = launch(TestUpdateActivity::class.java)
val scenario = launchActivityForResult(TestUpdateActivity::class.java)
scenario.onActivity {
updateManager = FakeAppUpdateManager(it).apply {
setUpdateAvailable(100500)
Expand Down Expand Up @@ -77,7 +77,7 @@ class FlexibleUpdateKtTest: TestAppTest() {
@LooperMode(LooperMode.Mode.PAUSED)
fun cancelsUpdateOnUserReject() {
lateinit var updateManager: FakeAppUpdateManager
val scenario = launch(TestUpdateActivity::class.java)
val scenario = launchActivityForResult(TestUpdateActivity::class.java)
scenario.onActivity {
updateManager = FakeAppUpdateManager(it).apply {
setUpdateAvailable(100500)
Expand All @@ -102,7 +102,7 @@ class FlexibleUpdateKtTest: TestAppTest() {
fun willNotAskUpdateConsentIfAlreadyCancelled() {
whenever(flowBreaker.isEnoughTimePassedSinceLatestCancel()).thenReturn(false)
lateinit var updateManager: FakeAppUpdateManager
val scenario = launch(TestUpdateActivity::class.java)
val scenario = launchActivityForResult(TestUpdateActivity::class.java)
scenario.onActivity {
updateManager = FakeAppUpdateManager(it).apply {
setUpdateAvailable(100500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package com.motorro.appupdatewrapper

import android.app.Activity
import android.os.Looper.getMainLooper
import androidx.test.core.app.ActivityScenario.launch
import androidx.test.core.app.ActivityScenario.launchActivityForResult
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.android.play.core.appupdate.testing.FakeAppUpdateManager
import com.motorro.appupdatewrapper.AppUpdateWrapper.Companion.REQUEST_CODE_UPDATE
Expand All @@ -35,7 +35,7 @@ class ImmediateUpdateKtTest: TestAppTest() {
@LooperMode(LooperMode.Mode.PAUSED)
fun startsImmediateUpdateIfAvailable() {
lateinit var updateManager: FakeAppUpdateManager
val scenario = launch(TestUpdateActivity::class.java)
val scenario = launchActivityForResult(TestUpdateActivity::class.java)
scenario.onActivity {
updateManager = FakeAppUpdateManager(it).apply {
setUpdateAvailable(100500)
Expand All @@ -55,7 +55,7 @@ class ImmediateUpdateKtTest: TestAppTest() {
@LooperMode(LooperMode.Mode.PAUSED)
fun failsIfUpdateIsNotAvailable() {
lateinit var updateManager: FakeAppUpdateManager
val scenario = launch(TestUpdateActivity::class.java)
val scenario = launchActivityForResult(TestUpdateActivity::class.java)
scenario.onActivity {
updateManager = FakeAppUpdateManager(it).apply {
setUpdateNotAvailable()
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ apply from: 'gradle/maven-publish-config.gradle'
apply plugin: 'io.github.gradle-nexus.publish-plugin'

buildscript {
ext.kotlin_version = '1.8.21'
ext.dokka_version = '1.8.10'
ext.kotlin_version = '1.9.10'
ext.dokka_version = '1.9.0'
repositories {
google()
mavenCentral()
Expand All @@ -21,7 +21,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.ajoberstar.grgit:grgit-gradle:4.1.1'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
Expand All @@ -32,10 +32,10 @@ buildscript {

ext {
// Android
androidBuildToolsVersion = '33.0.0'
androidBuildToolsVersion = '34.0.0'
androidMinSdkVersion = 21
androidTargetSdkVersion = 33
androidCompileSdkVersion = 33
androidTargetSdkVersion = 34
androidCompileSdkVersion = 34
versionName = project.version
versionCode = buildVersionCode()

Expand All @@ -60,11 +60,11 @@ allprojects {
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

task displayVersion(type: Task, group: 'documentation') {
tasks.register('displayVersion', Task) {
description 'Display application version name'
doLast {
println("Project version: ${project.version}")
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
Expand All @@ -14,3 +14,6 @@ kotlin.code.style=official
# Kotlin annotation processing config
kapt.include.compile.classpath=false
kapt.incremental.apt=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
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-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

android {
compileSdkVersion androidCompileSdkVersion
compileSdk androidCompileSdkVersion

defaultConfig {
applicationId "com.motorro.appupdatewrapper.sample"
Expand All @@ -31,11 +31,11 @@ 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'
}
buildFeatures {
viewBinding true
Expand All @@ -46,7 +46,7 @@ android {
dependencies {
implementation project(":appupdatewrapper")
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
Expand Down
9 changes: 4 additions & 5 deletions testapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ repositories {
}

android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
compileSdk androidCompileSdkVersion
testOptions.unitTests.includeAndroidResources = true

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}

defaultConfig {
Expand Down

0 comments on commit 33ed337

Please sign in to comment.