Skip to content

Commit

Permalink
Merge pull request #863 from aSemy/feature/dependency-updates-v2
Browse files Browse the repository at this point in the history
Dependency updates, JDK17 v2
  • Loading branch information
Raibaz committed Jul 27, 2022
2 parents 02a6d45 + 38b0da2 commit c50d242
Show file tree
Hide file tree
Showing 31 changed files with 117 additions and 89 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/gradle.yml
Expand Up @@ -19,8 +19,7 @@ jobs:
java-version: [ 11, 17, 18 ] # test LTS versions, and the newest
kotlin-version: [ 1.5.31, 1.6.21, 1.7.10 ]
kotlin-ir-enabled: [ true, false ]
# in case one JDK fails, we still want to see results from others
fail-fast: false
fail-fast: false # in case one JDK fails, we still want to see results from others
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -52,7 +51,8 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
api-level: [ 28, 29 ]
api-level: [ 26, 28, 29 ]
fail-fast: false # in case one API-level fails, we still want to see results from others
timeout-minutes: 30
steps:
- uses: actions/setup-java@v2
Expand All @@ -73,6 +73,25 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: ${{ runner.os }}-avd-${{ matrix.api-level }}

- 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: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -5,10 +5,10 @@ android:
- tools
- platform-tools
- build-tools-27.0.3
- android-28
- android-30

jdk:
- oraclejdk8
- openjdk17

install:
- yes | sdkmanager "ndk;20.0.5594570"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -27,7 +27,7 @@ Check the series of articles "Mocking is not rocket science" at [Kt. Academy](ht

### Kotlin version support

From version 1.10.0 MockK does not support Kotlin 1.2.*
From version 1.13.0 MockK supports Kotlin 1.4 and higher

### Known issues

Expand Down
8 changes: 4 additions & 4 deletions agent/android/build.gradle
Expand Up @@ -40,7 +40,7 @@ task packageDispatcherJar(type: Jar) {
preBuild.dependsOn(packageDispatcherJar)

android {
compileSdkVersion 'android-31'
compileSdkVersion 'android-32'

lintOptions {
abortOnError false
Expand All @@ -59,8 +59,8 @@ android {
}

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
minSdkVersion 26
targetSdkVersion 32
versionName project['version']
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "notAnnotation", "io.mockk.test.SkipInstrumentedAndroidTest"
Expand All @@ -83,7 +83,7 @@ dependencies {
api project(':mockk-agent-common')
implementation "com.linkedin.dexmaker:dexmaker:$dexmaker_version"
implementation "org.objenesis:objenesis:$objenesis_android_version"
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'junit:junit:4.13.1'
Expand Down
6 changes: 3 additions & 3 deletions agent/android/dispatcher/build.gradle.kts
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
compileSdkVersion = "android-31"
compileSdkVersion = "android-32"

android {
lintOptions {
Expand All @@ -19,8 +19,8 @@ android {
}

defaultConfig {
minSdk = 21
targetSdk = 31
minSdk = 26
targetSdk = 32
applicationId = "com.android.dexmaker.mockito.inline.dispatcher"
}

Expand Down
17 changes: 9 additions & 8 deletions build.gradle
@@ -1,22 +1,23 @@
import java.time.Duration

buildscript {
ext.kotlin_gradle_version = findProperty('kotlin.version')?.toString() ?: '1.6.0'
ext.android_gradle_version = '7.0.0'
ext.byte_buddy_version = '1.12.6'
ext.coroutines_version = '1.3.3'
ext.kotlin_gradle_version = findProperty('kotlin.version')?.toString() ?: '1.7.10'
ext.android_gradle_version = '7.2.1'
ext.byte_buddy_version = '1.12.10'
ext.coroutines_version = '1.6.4'
ext.dexmaker_version = '2.28.1'
ext.objenesis_version = '3.2'
ext.objenesis_android_version = '3.2'
ext.junit_jupiter_version = '5.6.2'
ext.junit_vintage_version = '5.6.2'
ext.dokka_version = '1.6.0'
ext.junit_jupiter_version = '5.8.2'
ext.junit_vintage_version = '5.8.2'
ext.dokka_version = '1.7.10'
ext.gradles = project.projectDir.toString() + "/gradle"

repositories {
mavenCentral()
google()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_gradle_version"
classpath "com.android.tools.build:gradle:$android_gradle_version"
Expand All @@ -25,7 +26,7 @@ buildscript {
}

plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.9.0"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.0"
}

subprojects { subProject ->
Expand Down
10 changes: 5 additions & 5 deletions circle.yml
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-26-alpha
- image: circleci/android:api-30
resource_class: xlarge
environment:
JVM_OPTS: -Xmx4096m
Expand All @@ -21,18 +21,18 @@ jobs:
name: Download Dependencies
command: |
sdkmanager --install 'ndk-bundle'
sdkmanager --install 'platforms;android-25'
sdkmanager --install 'system-images;android-25;google_apis;armeabi-v7a'
sdkmanager --install 'platforms;android-30'
sdkmanager --install 'system-images;android-30;google_apis;armeabi-v7a'
- save_cache:
paths:
- ~/.gradle
- ~/.m2
- /opt/android/sdk/platforms/android-25
- /opt/android/sdk/platforms/android-30
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Starting Android emulator
command: |
echo no | avdmanager create avd --package "system-images;android-25;google_apis;armeabi-v7a" --name "test"
echo no | avdmanager create avd --package "system-images;android-30;google_apis;armeabi-v7a" --name "test"
emulator -avd test -no-skin -no-audio -no-window &
android-wait-for-emulator
adb shell input keyevent 82 &
Expand Down
26 changes: 7 additions & 19 deletions client-tests/jvm/build.gradle.kts
@@ -1,6 +1,6 @@
buildscript {
ext {
kotlin_version = "1.3.72"
kotlin_version = "1.7.10"
}
repositories {
mavenCentral()
Expand All @@ -12,7 +12,7 @@ buildscript {
}

plugins {
kotlin("jvm") version "1.3.72"
kotlin("jvm") version "1.7.10"
}

java {
Expand All @@ -32,29 +32,17 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib") {
version {
strictly("$kotlin_version")
}
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-common") {
version {
strictly("$kotlin_version")
}
}
implementation("org.jetbrains.kotlin:kotlin-reflect") {
version {
strictly("$kotlin_version")
}
}
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
implementation("org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
testImplementation(project(":mockk-jvm"))

testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") {
exclude(group = "junit", module = "junit")
}

testImplementation("org.slf4j:slf4j-api:1.7.32")
testImplementation("ch.qos.logback:logback-classic:1.2.9")
testImplementation("org.slf4j:slf4j-api:1.7.36")
testImplementation("ch.qos.logback:logback-classic:1.2.11")

compileOnly("org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version")
Expand Down
1 change: 0 additions & 1 deletion dsl/common/src/main/kotlin/io/mockk/InternalPlatformDsl.kt
Expand Up @@ -66,7 +66,6 @@ interface InternalRef<T> {
val value: T
}


interface InternalCounter {
val value: Long

Expand Down
2 changes: 0 additions & 2 deletions dsl/jvm/build.gradle.kts
Expand Up @@ -34,5 +34,3 @@ tasks {
add("archives", sourcesJar)
}
}


1 change: 1 addition & 0 deletions gradle.properties
Expand Up @@ -9,3 +9,4 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=768m
# localrepo=build/mockk-repo
localrepo=/Users/raibaz/.m2/repository
kotlin.version=1.7.10
android.useAndroidX=true
2 changes: 1 addition & 1 deletion gradle/jacoco.gradle
@@ -1,7 +1,7 @@
apply plugin: 'jacoco'

jacoco {
toolVersion = "0.8.7"
toolVersion = "0.8.8"
}

afterEvaluate {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
10 changes: 4 additions & 6 deletions mockk/android/build.gradle.kts
Expand Up @@ -27,9 +27,8 @@ android {
}

defaultConfig {
minSdk = 21
targetSdk = 31
versionName = "${project.version}"
minSdk = 26
targetSdk = 32
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments
testInstrumentationRunnerArguments["notAnnotation"] = "io.mockk.test.SkipInstrumentedAndroidTest"
Expand Down Expand Up @@ -57,18 +56,17 @@ dependencies {
implementation(project(":mockk-agent-api"))

testImplementation("junit:junit:4.13.1")
androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") {
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") {
exclude(group = "com.android.support", module = "support-annotations")
}
androidTestImplementation(Deps.Libs.kotlinReflect(kotlinVersion()))
androidTestImplementation(Deps.Libs.kotlinCoroutinesCore())
androidTestImplementation(Deps.Libs.kotlinTestJunit()) {
exclude(group = "junit", module = "junit")
}
androidTestImplementation("com.android.support.test:rules:1.0.2")
androidTestImplementation("androidx.test:rules:1.4.0")

androidTestImplementation(Deps.Libs.junitJupiterApi)
androidTestImplementation(Deps.Libs.junitJupiterEngine)
androidTestImplementation(Deps.Libs.junitVintageEngine)
}

@@ -1,7 +1,7 @@
package io.mockk.proxy.android

import android.support.test.rule.ActivityTestRule
import android.widget.FrameLayout
import androidx.test.rule.ActivityTestRule
import io.mockk.debug.TestActivity
import io.mockk.mockk
import org.junit.Rule
Expand Down
Expand Up @@ -138,7 +138,7 @@ class PermanentMocker(
args.isEmpty()
) {
return prefix +
methodName[3].lowercase() +
methodName[3].lowercaseChar() +
methodName.substring(4)
}

Expand Down

0 comments on commit c50d242

Please sign in to comment.