Skip to content

Commit a63827b

Browse files
ktlint 12.1.1 (#314)
1 parent ee43b25 commit a63827b

File tree

5 files changed

+43
-40
lines changed

5 files changed

+43
-40
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import java.time.format.DateTimeFormatter
44
plugins {
55
id 'org.jetbrains.kotlin.jvm' version '2.0.0'
66
id 'org.jetbrains.dokka' version '1.9.20' apply false
7-
id 'org.jlleitschuh.gradle.ktlint' version '11.6.1' apply false
7+
id 'org.jlleitschuh.gradle.ktlint' version '12.1.1' apply false
88
id 'com.vanniktech.maven.publish' version '0.25.3' apply false
99
id 'com.gradle.plugin-publish' version '0.21.0' apply false
1010
id 'com.github.ben-manes.versions' version '0.51.0'

gradle-spoon-plugin/src/main/kotlin/com/jaredsburrows/spoon/ProjectAndroid.kt

+16-13
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ private fun Project.configureVariant(
5555
) {
5656
// Configure tasks for all variants
5757
variants?.all { variant ->
58-
val name = variant.name.replaceFirstChar {
59-
if (it.isLowerCase()) {
60-
it.titlecase(Locale.getDefault())
61-
} else {
62-
it.toString()
58+
val name =
59+
variant.name.replaceFirstChar {
60+
if (it.isLowerCase()) {
61+
it.titlecase(Locale.getDefault())
62+
} else {
63+
it.toString()
64+
}
6365
}
64-
}
6566

6667
// Create tasks based on variant
6768
tasks.register("spoon$name", SpoonTask::class.java) {
@@ -70,8 +71,9 @@ private fun Project.configureVariant(
7071
}
7172

7273
it.spoonExtension = project.extensions.getByType(SpoonExtension::class.java)
73-
it.outputDir = project.extensions.getByType(ReportingExtension::class.java)
74-
.file(SpoonExtension.DEFAULT_OUTPUT_DIRECTORY)
74+
it.outputDir =
75+
project.extensions.getByType(ReportingExtension::class.java)
76+
.file(SpoonExtension.DEFAULT_OUTPUT_DIRECTORY)
7577
it.buildDir = project.buildDir
7678

7779
it.testing = project.isNotTest()
@@ -82,11 +84,12 @@ private fun Project.configureVariant(
8284
val testedOutput = variant.testedVariant.outputs.first()
8385
// This is a hack for library projects.
8486
// We supply the same apk as an application and instrumentation to the soon runner.
85-
it.applicationApk = if (testedOutput is ApkVariantOutput) {
86-
testedOutput.outputFile
87-
} else {
88-
instrumentationApk
89-
}
87+
it.applicationApk =
88+
if (testedOutput is ApkVariantOutput) {
89+
testedOutput.outputFile
90+
} else {
91+
instrumentationApk
92+
}
9093

9194
it.sdkDirectory = baseExtension.sdkDirectory
9295

gradle-spoon-plugin/src/main/kotlin/com/jaredsburrows/spoon/SpoonExtension.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.jaredsburrows.spoon
22

33
/**
4-
* Configuration options for the gradle spoon plugin.
4+
* Configuration options for the gradle spoon plugin. Supported directly by Spoon's SpoonRunner.
55
*
66
* Variables based on the following documentation:
77
* - https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
@@ -10,7 +10,6 @@ package com.jaredsburrows.spoon
1010
* - https://github.com/square/spoon#execution
1111
*/
1212
open class SpoonExtension { // extensions cannot be final
13-
/* Supported directly by Spoon's SpoonRunner */
1413

1514
/** Identifying title for this execution. ("Spoon Execution" by default) */
1615
var title: String = DEFAULT_TITLE
@@ -77,7 +76,7 @@ open class SpoonExtension { // extensions cannot be final
7776
/** Run 'pm clear' before each test to clear app data before each test. */
7877
var clearAppDataBeforeEachTest: Boolean = false
7978

80-
/* Passed in via -e, extra arguments */
79+
// Passed in via -e, extra arguments
8180

8281
/** The number of separate shards to create. */
8382
var numShards: Int = 0
@@ -94,7 +93,7 @@ open class SpoonExtension { // extensions cannot be final
9493
/** Do not fail build if a test fails, let all the tests run and finish. (false by default) */
9594
var ignoreFailures: Boolean = false
9695

97-
/* Deprecated/Renamed */
96+
// Deprecated/Renamed
9897

9998
@Deprecated("Use 'grantAll'", replaceWith = ReplaceWith("grantAll"))
10099
var grantAllPermissions: Boolean = false

gradle-spoon-plugin/src/main/kotlin/com/jaredsburrows/spoon/SpoonPlugin.kt

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import org.gradle.api.Project
55

66
/** A [Plugin] which wraps the Spoon test runner. */
77
class SpoonPlugin : Plugin<Project> {
8-
98
override fun apply(project: Project) {
109
project.extensions.create("spoon", SpoonExtension::class.java)
1110

gradle-spoon-plugin/src/main/kotlin/com/jaredsburrows/spoon/SpoonTask.kt

+23-21
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,23 @@ open class SpoonTask : DefaultTask() { // tasks can't be final
5656
}
5757
outputDir = File(outputBase, variantName)
5858

59-
val builder = SpoonRunner.Builder()
60-
.setTitle(spoonExtension.title)
61-
.setOutputDirectory(outputDir)
62-
.setDebug(spoonExtension.debug)
63-
.setNoAnimations(spoonExtension.noAnimations)
64-
.setAdbTimeout(Duration.ofSeconds(spoonExtension.adbTimeout.toLong()))
65-
.setClassName(spoonExtension.className)
66-
.setAllowNoDevices(spoonExtension.allowNoDevices)
67-
.setSequential(spoonExtension.sequential)
68-
.setGrantAll(spoonExtension.grantAll)
69-
.setMethodName(spoonExtension.methodName)
70-
.setCodeCoverage(spoonExtension.codeCoverage)
71-
.setShard(spoonExtension.shard)
72-
.setTerminateAdb(false)
73-
.setSingleInstrumentationCall(spoonExtension.singleInstrumentationCall)
74-
.setClearAppDataBeforeEachTest(spoonExtension.clearAppDataBeforeEachTest)
59+
val builder =
60+
SpoonRunner.Builder()
61+
.setTitle(spoonExtension.title)
62+
.setOutputDirectory(outputDir)
63+
.setDebug(spoonExtension.debug)
64+
.setNoAnimations(spoonExtension.noAnimations)
65+
.setAdbTimeout(Duration.ofSeconds(spoonExtension.adbTimeout.toLong()))
66+
.setClassName(spoonExtension.className)
67+
.setAllowNoDevices(spoonExtension.allowNoDevices)
68+
.setSequential(spoonExtension.sequential)
69+
.setGrantAll(spoonExtension.grantAll)
70+
.setMethodName(spoonExtension.methodName)
71+
.setCodeCoverage(spoonExtension.codeCoverage)
72+
.setShard(spoonExtension.shard)
73+
.setTerminateAdb(false)
74+
.setSingleInstrumentationCall(spoonExtension.singleInstrumentationCall)
75+
.setClearAppDataBeforeEachTest(spoonExtension.clearAppDataBeforeEachTest)
7576

7677
// APKs
7778
if (testing) {
@@ -100,11 +101,12 @@ open class SpoonTask : DefaultTask() { // tasks can't be final
100101
throw UnsupportedOperationException("Please use '=' or ':' to separate arguments.")
101102
}
102103

103-
val keyVal = if (instrumentation.contains(':')) {
104-
instrumentation.split(':')
105-
} else {
106-
instrumentation.split('=')
107-
}
104+
val keyVal =
105+
if (instrumentation.contains(':')) {
106+
instrumentation.split(':')
107+
} else {
108+
instrumentation.split('=')
109+
}
108110
instrumentationArgs[keyVal[0]] = keyVal[1]
109111
}
110112
builder.setInstrumentationArgs(instrumentationArgs)

0 commit comments

Comments
 (0)