diff --git a/.editorconfig b/.editorconfig index 1d967e8f..6c984094 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,4 +4,8 @@ continuation_indent_size=2 insert_final_newline=true ij_kotlin_allow_trailing_comma=true ij_kotlin_allow_trailing_comma_on_call_site=true -ktlint_disabled_rules=annotation,argument-list-wrapping,spacing-between-declarations-with-annotations,filename +ktlint_standard_annotation=disabled +ktlint_standard_argument-list-wrapping=disabled +ktlint_standard_spacing-between-declarations-with-annotations=disabled +ktlint_standard_filename=disabled +ktlint_standard_property-naming=disabled diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30f6f6a8..d67428e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - java_version: [11] + java_version: [17] steps: - name: Checkout diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 4087439d..7d0110a2 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -15,11 +15,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install JDK 11 + - name: Install JDK 17 uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - name: Setup gradle uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index d412df11..5848d19f 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -15,11 +15,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install JDK 11 + - name: Install JDK 17 uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - name: Setup gradle uses: gradle/gradle-build-action@v2 diff --git a/build.gradle.kts b/build.gradle.kts index b42322b7..1015ef74 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,4 @@ buildscript { - repositories { - mavenCentral() - google() - gradlePluginPortal() - } dependencies { classpath(libs.plugin.android.cache.fix) classpath(libs.plugin.androidgradleplugin) diff --git a/cropper/build.gradle.kts b/cropper/build.gradle.kts index cd230691..47145ef0 100644 --- a/cropper/build.gradle.kts +++ b/cropper/build.gradle.kts @@ -5,13 +5,19 @@ plugins { id("org.jetbrains.kotlin.plugin.parcelize") id("com.vanniktech.maven.publish") id("app.cash.licensee") - id("dev.chrisbanes.paparazzi") + id("app.cash.paparazzi") } licensee { allow("Apache-2.0") } +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } +} + android { namespace = "com.canhub.cropper" @@ -25,6 +31,11 @@ android { viewBinding = true } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + testOptions { unitTests { isIncludeAndroidResources = true diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt index 9c697540..c30edd8e 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt @@ -1558,14 +1558,18 @@ class CropImageView @JvmOverloads constructor( * To set square/circle crop shape set aspect ratio to 1:1. */ enum class CropShape { - RECTANGLE, OVAL, RECTANGLE_VERTICAL_ONLY, RECTANGLE_HORIZONTAL_ONLY + RECTANGLE, + OVAL, + RECTANGLE_VERTICAL_ONLY, + RECTANGLE_HORIZONTAL_ONLY, } /** * Possible crop corner shape */ enum class CropCornerShape { - RECTANGLE, OVAL + RECTANGLE, + OVAL, } /** diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropWindowMoveHandler.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropWindowMoveHandler.kt index e93e1df5..ddf2ce23 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropWindowMoveHandler.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropWindowMoveHandler.kt @@ -19,7 +19,15 @@ internal class CropWindowMoveHandler( /** The type of crop window move that is handled. */ internal enum class Type { - TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT, TOP, RIGHT, BOTTOM, CENTER + TOP_LEFT, + TOP_RIGHT, + BOTTOM_LEFT, + BOTTOM_RIGHT, + LEFT, + TOP, + RIGHT, + BOTTOM, + CENTER, } internal companion object { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e886b2b4..4117c87d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,34 +3,34 @@ minSdk = "21" compileSdk = "33" targetSdk = "33" -androidgradleplugin = "7.3.1" -kotlin = "1.7.20" -kotlinxcoroutines = "1.6.4" -ktlint = "0.47.1" +androidgradleplugin = "8.0.2" +kotlin = "1.8.22" +kotlinxcoroutines = "1.7.2" +ktlint = "0.50.0" [libraries] -androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.6.0" } -androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.5.1" } +androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.7.2" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" } androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.9.0" } -androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version = "1.3.4" } -androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.5.3" } -androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.1.3" } +androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version = "1.3.6" } +androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.6.0" } +androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.1.5" } junit = { module = "junit:junit", version = "4.13.2" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxcoroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxcoroutines" } -leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.9.1" } -material = { module = "com.google.android.material:material", version = "1.6.1" } -mock = { module = "io.mockk:mockk", version = "1.13.2" } -plugin-android-cache-fix = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version = "2.6.0" } +leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.12" } +material = { module = "com.google.android.material:material", version = "1.9.0" } +mock = { module = "io.mockk:mockk", version = "1.13.5" } +plugin-android-cache-fix = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version = "2.7.2" } plugin-androidgradleplugin = { module = "com.android.tools.build:gradle", version.ref = "androidgradleplugin" } -plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.7.20" } +plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.8.20" } plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } -plugin-licensee = { module = "app.cash.licensee:licensee-gradle-plugin", version = "1.5.0" } -plugin-paparazzi = { module = "dev.chrisbanes.paparazzi:paparazzi-gradle-plugin", version = "1.1.0-sdk33-alpha02" } -plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.22.0" } +plugin-licensee = { module = "app.cash.licensee:licensee-gradle-plugin", version = "1.7.0" } +plugin-paparazzi = { module = "app.cash.paparazzi:paparazzi-gradle-plugin", version = "1.3.0" } +plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.3" } robolectric = { module = "org.robolectric:robolectric", version = "4.9" } timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" } [plugins] -codequalitytools = { id = "com.vanniktech.code.quality.tools", version = "0.22.0" } +codequalitytools = { id = "com.vanniktech.code.quality.tools", version = "0.23.0" } dependencygraphgenerator = { id = "com.vanniktech.dependency.graph.generator", version = "0.8.0" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..033e24c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8fad3f5a..bf01c4d1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6..fcb6fca1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/gradlew.bat b/gradlew.bat index 53a6b238..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 4b448b75..4a7bb8b5 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -4,6 +4,12 @@ plugins { id("org.jetbrains.kotlin.plugin.parcelize") } +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } +} + android { namespace = "com.example.croppersample" @@ -22,6 +28,11 @@ android { viewBinding = true } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + buildTypes { release { isMinifyEnabled = false diff --git a/settings.gradle.kts b/settings.gradle.kts index 5e08251c..f8326a4f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,10 @@ +pluginManagement { + repositories { + mavenCentral() + google() + gradlePluginPortal() + } +} + include(":cropper") include(":sample")