Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency updates, JDK17 v2 #863

Merged
merged 43 commits into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9af968e
updated dependencies, jdk17
May 24, 2022
2e8352f
more updates
May 24, 2022
52696b2
added jitpack.yml
May 24, 2022
400fe13
android dependencies
May 24, 2022
1a69b5e
android build fix
May 27, 2022
ed1e726
fix for api error
May 27, 2022
799db8d
Merge remote-tracking branch 'origin/master' into feature/dependency-…
May 27, 2022
ce48fd3
jitpack fix
May 27, 2022
6bffaec
jitpack fix
May 27, 2022
6ff1181
jdk upgrades (attempt)
Jul 5, 2022
d932080
jdk upgrades
Jul 5, 2022
ae09780
use kotlin stable 1.7.0
Jul 5, 2022
f507113
Update gradle.properties
hduerkop Jul 11, 2022
9f32726
Merge branch 'master' into feature/dependency-updates
Jul 11, 2022
e0bf762
more kotlin updates
Jul 11, 2022
926ec0f
wip
Jul 12, 2022
d6bd984
(potential) sync fix
Jul 12, 2022
e4dbf00
wip
Jul 12, 2022
b7ca117
wip
Jul 12, 2022
c868942
REVIEW REQ: ignore failing tests
Jul 12, 2022
5026089
Merge remote-tracking branch 'mockk/master' into feature/dependency-u…
aSemy Jul 26, 2022
8474272
update readme version
aSemy Jul 26, 2022
0d6f0c5
revert source/target JDK to 1.8
aSemy Jul 26, 2022
9df93d5
changed Gradle version to 7.5
aSemy Jul 26, 2022
612b0c4
rm jitpack config
aSemy Jul 26, 2022
338c1d6
un-ignore tests
aSemy Jul 26, 2022
7b0f740
bump coroutines, junit, binary-compat-validator versions
aSemy Jul 26, 2022
435a8c0
experiment with re-enabling HashMap tests...
aSemy Jul 26, 2022
9eebc92
rm jdk17 in build plugins
aSemy Jul 26, 2022
737c54c
rm unused import
aSemy Jul 26, 2022
269a599
change min/max android SDK to 26 and 32, and update test matrix
aSemy Jul 26, 2022
5fb6137
rm errant 'version'
aSemy Jul 26, 2022
644215c
GHA: reverted Android API levels, add specific Android caching
aSemy Jul 26, 2022
d7d4b19
disable 'abstract map' mocking test
aSemy Jul 26, 2022
2a9e7c8
disable 'hashmap spy' test on JDK 17
aSemy Jul 26, 2022
b3613e8
disable hashmap spy test on JDK16+
aSemy Jul 26, 2022
02d2328
test more Android API levels (matches the config in Gradle)
aSemy Jul 26, 2022
7a85150
fix JRE disabled test range, add link to issue
aSemy Jul 26, 2022
8905765
disable fail-fast for Android tests
aSemy Jul 26, 2022
626987b
disable Android API 32, disable Android animations, copy emulator opt…
aSemy Jul 26, 2022
ddecd9a
re-enable animations (try to fix CI error)
aSemy Jul 26, 2022
8f6cdc8
revert android emulator options
aSemy Jul 26, 2022
38b0da2
add 'disabledReason' to conditional disabled
aSemy Jul 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 25 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 ]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the best combo here is... 🤷‍♀️

I added 26 because that's the minimum set in the Gradle files. Maybe 28 can be removed?

The max level set in Gradle is 32, but when I set it, it failed - something about the combo not being available? ReactiveCircus/android-emulator-runner#234

Apparently 30+ is slow ReactiveCircus/android-emulator-runner#222

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,8 +73,30 @@ 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: true
script: echo "Generated AVD snapshot for caching."

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew connectedCheck
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"
Comment on lines 5 to 14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Travis used? Or can this config file be removed?

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
Comment on lines 3 to 9
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Circle CI used? Or can this config file be removed?

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