Skip to content

Commit 2aed1ec

Browse files
authored
Update Android Gradle Plugin, Kotlin and other dependencies (#23)
Also includes some minor code-style fixes
1 parent b880916 commit 2aed1ec

File tree

12 files changed

+44
-40
lines changed

12 files changed

+44
-40
lines changed

gradle/dependencies.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
ext {
22
projectVersion = [
33
minSdk : 19,
4-
targetSdk : 29,
5-
compileSdk: 29,
6-
kotlin : "1.3.61"
4+
targetSdk : 30,
5+
compileSdk: 30,
6+
kotlin : "1.4.31"
77
]
88
projectDependency = [
99

1010
// Gradle Plugins
1111
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${projectVersion.kotlin}",
12-
androidGradlePlugin: "com.android.tools.build:gradle:3.6.1",
12+
androidGradlePlugin: "com.android.tools.build:gradle:4.1.2",
1313

1414
// Dependencies
15-
kotlinStdlibJdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${projectVersion.kotlin}",
16-
appCompat : "androidx.appcompat:appcompat:1.1.0",
15+
kotlinStdlibJdk8 : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${projectVersion.kotlin}",
16+
appCompat : "androidx.appcompat:appcompat:1.2.0",
1717

1818
// Test dependencies
19-
junit : "junit:junit:4.13",
20-
truth : "com.google.truth:truth:1.0.1",
19+
junit : "junit:junit:4.13.2",
20+
truth : "com.google.truth:truth:1.1.2",
2121
supportTestRunner : "androidx.test:runner:1.2.0",
22-
espressoCore : "androidx.test.espresso:espresso-core:3.2.0",
23-
androidJUnit : "androidx.test.ext:junit:1.1.1",
22+
espressoCore : "androidx.test.espresso:espresso-core:3.3.0",
23+
androidJUnit : "androidx.test.ext:junit:1.1.2",
2424
commonsCsv : "org.apache.commons:commons-csv:1.8",
2525
kotlinTest : "org.jetbrains.kotlin:kotlin-test:${projectVersion.kotlin}"
2626
]

gradle/wrapper/gradle-wrapper.jar

508 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

72+
8773
@rem Execute Gradle
88-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8975

9076
:end
9177
@rem End local scope for the variables with windows NT shell

plugin/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ test {
8585
dependencies {
8686
compileOnly gradleApi()
8787
implementation projectDependency.androidGradlePlugin
88-
implementation projectDependency.kotlinStdlibJdk7
88+
implementation projectDependency.kotlinStdlibJdk8
8989

90-
testImplementation projectDependency.kotlinStdlibJdk7
90+
testImplementation projectDependency.kotlinStdlibJdk8
9191
testImplementation projectDependency.kotlinTest
9292
testImplementation gradleTestKit()
9393
testImplementation projectDependency.junit
9494
testImplementation projectDependency.truth
9595
testImplementation projectDependency.commonsCsv
9696
}
97-
98-
// apply from: rootProject.file('publish.gradle')

plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import org.gradle.testing.jacoco.tasks.JacocoReport
1515
@Suppress("unused")
1616
class RootCoveragePlugin : Plugin<Project> {
1717

18-
private lateinit var rootProjectExtension: RootCoveragePluginExtension;
18+
private lateinit var rootProjectExtension: RootCoveragePluginExtension
1919

2020
override fun apply(project: Project) {
2121
if (project.rootProject !== project) {
@@ -142,7 +142,7 @@ class RootCoveragePlugin : Plugin<Project> {
142142
val extension = subProject.extensions.findByName("android")
143143
if (extension == null) {
144144
// TODO support java modules?
145-
subProject.logger.warn("Note: Skipping code coverage for module '${subProject.name}', currently the RootCoveragePlugin does not yet support Java Library Modules.");
145+
subProject.logger.warn("Note: Skipping code coverage for module '${subProject.name}', currently the RootCoveragePlugin does not yet support Java Library Modules.")
146146
return
147147
} else if (extension is com.android.build.gradle.FeatureExtension) {
148148
// TODO support feature modules?

plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/CsvCoverageReport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CoverageReport private constructor(
2424
find(packageName, className).assertFullCoverageCoverage()
2525
}
2626

27-
fun find(packageName: String, className: String): CSVRecord? = records.find {
27+
private fun find(packageName: String, className: String): CSVRecord? = records.find {
2828
it[packageColumn] == packageName && it[classColumn] == className
2929
}
3030

plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class IntegrationTest(
6060

6161
val testFixtures = File("src/test/test-fixtures").listFiles()?.filter { it.isDirectory }
6262
?: error("Could not list test fixture directories")
63-
val gradleVersions = arrayOf("5.6.4", "6.1.1", "6.2.1")
63+
val gradleVersions = arrayOf("6.5.1", "6.6.1", "6.7.1", "6.8.3")
6464
return testFixtures.flatMap { file ->
6565
gradleVersions.map { gradleVersion ->
6666
arrayOf("${file.name}-$gradleVersion", file, gradleVersion)

plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/util/SystemOuputWriter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import java.io.Writer
88
* adding extra new lines to the generated output in the console. This is a small fix for that, it
99
* might not be the fastest, but it works.
1010
*/
11-
class SystemOutputWriter private constructor(private val output: OutputStream) : Writer() {
11+
class SystemOutputWriter private constructor(output: OutputStream) : Writer() {
1212

1313
private val bufferedWriter = output.bufferedWriter(Charsets.UTF_8)
1414

plugin/src/test/test-fixtures/multi-module/app/build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@ android {
3030
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3131
}
3232
}
33+
34+
compileOptions {
35+
sourceCompatibility JavaVersion.VERSION_1_8
36+
targetCompatibility JavaVersion.VERSION_1_8
37+
}
38+
39+
kotlinOptions {
40+
jvmTarget = "1.8"
41+
}
3342
}
3443

3544
dependencies {
3645
implementation project(":library_android")
3746

38-
implementation projectDependency.kotlinStdlibJdk7
47+
implementation projectDependency.kotlinStdlibJdk8
3948
implementation projectDependency.appCompat
4049

4150
testImplementation projectDependency.junit

plugin/src/test/test-fixtures/multi-module/library_android/build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,19 @@ android {
3535
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3636
}
3737
}
38+
39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_1_8
41+
targetCompatibility JavaVersion.VERSION_1_8
42+
}
43+
44+
kotlinOptions {
45+
jvmTarget = "1.8"
46+
}
3847
}
3948

4049
dependencies {
41-
implementation projectDependency.kotlinStdlibJdk7
50+
implementation projectDependency.kotlinStdlibJdk8
4251
implementation projectDependency.appCompat
4352

4453
testImplementation projectDependency.junit

0 commit comments

Comments
 (0)