diff --git a/.gitignore b/.gitignore index cc3263427..ffe28dcd8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,6 @@ annotations/ !/.idea/codeStyleSettings.xml !/.idea/encodings.xml !/.idea/copyright/ -!/.idea/compiler.xml # Enforce plugins !/.idea/externalDependencies.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 9a8b7e5c4..000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d223dcb19..c0b6c6145 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,15 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + id "com.android.application" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion '28.0.3' defaultConfig { applicationId "org.wordpress.aztec" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true @@ -39,7 +40,7 @@ dependencies { implementation project(':wordpress-comments') implementation project(':wordpress-shortcodes') - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation 'androidx.appcompat:appcompat:1.0.0' implementation "org.wordpress:utils:$wordpressUtilsVersion" diff --git a/aztec/build.gradle b/aztec/build.gradle index b9f600bf5..2aa8111e4 100644 --- a/aztec/build.gradle +++ b/aztec/build.gradle @@ -1,13 +1,14 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id "com.android.library" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionName "1.0" vectorDrawables.useSupportLibrary = true } @@ -46,7 +47,7 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation "org.ccil.cowan.tagsoup:tagsoup:$tagSoupVersion" implementation "org.jsoup:jsoup:$jSoupVersion" diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/EnhancedMovementMethod.kt b/aztec/src/main/kotlin/org/wordpress/aztec/EnhancedMovementMethod.kt index 654a59ea0..877a8776d 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/EnhancedMovementMethod.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/EnhancedMovementMethod.kt @@ -46,8 +46,8 @@ object EnhancedMovementMethod : ArrowKeyMovementMethod() { layout.getLineBounds(line, lineRect) val clickedWithinLineHeight = y >= lineRect.top && y <= lineRect.bottom - val clickedOnSpanToTheLeftOfCursor = x in charPrevX..charX - val clickedOnSpanToTheRightOfCursor = x in charX..charNextX + val clickedOnSpanToTheLeftOfCursor = x.toFloat() in charPrevX..charX + val clickedOnSpanToTheRightOfCursor = x.toFloat() in charX..charNextX val clickedOnSpan = clickedWithinLineHeight && (clickedOnSpanToTheLeftOfCursor || clickedOnSpanToTheRightOfCursor) diff --git a/build.gradle b/build.gradle index d26122075..93b30f2af 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,17 @@ buildscript { ext { gradlePluginVersion = '3.3.1' - kotlinVersion = '1.3.11' kotlinCoroutinesVersion = '1.1.0' supportLibVersion = '27.1.1' tagSoupVersion = '1.2.1' glideVersion = '4.10.0' picassoVersion = '2.5.2' - robolectricVersion = '4.3.1' + robolectricVersion = '4.4' jUnitVersion = '4.12' jSoupVersion = '1.11.3' wordpressUtilsVersion = '1.21' espressoVersion = '3.0.1' - } - - repositories { - google() - jcenter() - } - - dependencies { - classpath "com.android.tools.build:gradle:$gradlePluginVersion" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" + commonTargetSdkVersion = 30 } } diff --git a/glide-loader/build.gradle b/glide-loader/build.gradle index 0f2ab93d9..dc557327a 100644 --- a/glide-loader/build.gradle +++ b/glide-loader/build.gradle @@ -1,13 +1,14 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id "com.android.library" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionCode 1 versionName "1.0" @@ -22,7 +23,7 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation project(':aztec') implementation "com.github.bumptech.glide:glide:$glideVersion" diff --git a/gradle.properties b/gradle.properties index 69d237245..cc0fa93b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,3 @@ android.useAndroidX=true # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects org.gradle.parallel=true - -android.enableUnitTestBinaryResources=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ed88a042a..94336fcae 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 69358d4b3..af7be50b1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Oct 23 14:31:33 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip diff --git a/gradlew.bat b/gradlew.bat index f9553162f..e95643d6a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/picasso-loader/build.gradle b/picasso-loader/build.gradle index c48262210..99e4de869 100644 --- a/picasso-loader/build.gradle +++ b/picasso-loader/build.gradle @@ -1,13 +1,14 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id "com.android.library" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionCode 1 versionName "1.0" } @@ -21,7 +22,7 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation project(':aztec') diff --git a/settings.gradle b/settings.gradle index 0d664cc53..4bac0d458 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + gradle.ext.kotlinVersion = '1.4.20' + gradle.ext.agpVersion = '4.2.2' + + plugins { + id "com.android.library" version gradle.ext.agpVersion + id "com.android.application" version gradle.ext.agpVersion + id "org.jetbrains.kotlin.android" version gradle.ext.kotlinVersion + } + repositories { + gradlePluginPortal() + google() + } +} include ':app', ':aztec', ':glide-loader', ':picasso-loader', ':wordpress-comments', ':wordpress-shortcodes' diff --git a/wordpress-comments/build.gradle b/wordpress-comments/build.gradle index d0f2cd68e..36986b776 100644 --- a/wordpress-comments/build.gradle +++ b/wordpress-comments/build.gradle @@ -1,13 +1,14 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id "com.android.library" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionName "1.0" vectorDrawables.useSupportLibrary = true } @@ -33,7 +34,7 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation project(':aztec') diff --git a/wordpress-shortcodes/build.gradle b/wordpress-shortcodes/build.gradle index 23fe46967..63311ff15 100644 --- a/wordpress-shortcodes/build.gradle +++ b/wordpress-shortcodes/build.gradle @@ -1,13 +1,14 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id "com.android.library" + id "org.jetbrains.kotlin.android" +} android { compileSdkVersion 28 - buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion commonTargetSdkVersion versionName "1.0" } @@ -32,7 +33,7 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$gradle.ext.kotlinVersion" implementation project(':aztec')