Skip to content

Commit

Permalink
Gradle: Use Java 11, Android Gradle Plugin 8.0.2 & update all depende…
Browse files Browse the repository at this point in the history
…ncies. (#577)
  • Loading branch information
vanniktech authored Jul 2, 2023
1 parent 6bcf718 commit d382c97
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 42 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
java_version: [11]
java_version: [17]

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
buildscript {
repositories {
mavenCentral()
google()
gradlePluginPortal()
}
dependencies {
classpath(libs.plugin.android.cache.fix)
classpath(libs.plugin.androidgradleplugin)
Expand Down
13 changes: 12 additions & 1 deletion cropper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -25,6 +31,11 @@ android {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

testOptions {
unitTests {
isIncludeAndroidResources = true
Expand Down
8 changes: 6 additions & 2 deletions cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
36 changes: 18 additions & 18 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
24 changes: 16 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%

Expand Down
11 changes: 11 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ plugins {
id("org.jetbrains.kotlin.plugin.parcelize")
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

android {
namespace = "com.example.croppersample"

Expand All @@ -22,6 +28,11 @@ android {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

buildTypes {
release {
isMinifyEnabled = false
Expand Down
8 changes: 8 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
pluginManagement {
repositories {
mavenCentral()
google()
gradlePluginPortal()
}
}

include(":cropper")
include(":sample")

0 comments on commit d382c97

Please sign in to comment.