Skip to content

Commit 7772ebc

Browse files
Apply spotless
1 parent 888e383 commit 7772ebc

23 files changed

+340
-265
lines changed

build.gradle.kts

Lines changed: 107 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import io.gitlab.arturbosch.detekt.Detekt
2-
import java.util.Properties
32
import java.io.FileInputStream
43
import java.io.IOException
4+
import java.util.Properties
55
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
66

77
plugins {
@@ -18,10 +18,12 @@ val keystorePropertiesFile = rootProject.file("keystore.properties")
1818
val keystoreProperties = Properties()
1919

2020
try {
21-
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
21+
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
2222
} catch (ignored: IOException) {
23-
if (project.hasProperty("centralUsername")) keystoreProperties["centralUsername"] = property("centralUsername")
24-
if (project.hasProperty("centralPassword")) keystoreProperties["centralPassword"] = property("centralPassword")
23+
if (project.hasProperty("centralUsername"))
24+
keystoreProperties["centralUsername"] = property("centralUsername")
25+
if (project.hasProperty("centralPassword"))
26+
keystoreProperties["centralPassword"] = property("centralPassword")
2527
}
2628

2729
android {
@@ -34,8 +36,8 @@ android {
3436

3537
// The version must be of the form "X.Y.Z[-b][-SNAPSHOT]"
3638
version =
37-
if (project.hasProperty("VERSION")) project.property("VERSION").toString()
38-
else "1.0.1-SNAPSHOT"
39+
if (project.hasProperty("VERSION")) project.property("VERSION").toString()
40+
else "1.0.1-SNAPSHOT"
3941

4042
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
4143
}
@@ -49,42 +51,34 @@ android {
4951
sourceCompatibility = JavaVersion.VERSION_17
5052
targetCompatibility = JavaVersion.VERSION_17
5153
}
52-
54+
5355
testOptions { unitTests { isIncludeAndroidResources = true } }
5456

55-
publishing {
56-
singleVariant("release") {}
57-
}
57+
publishing { singleVariant("release") {} }
5858
}
5959

60-
kotlin {
61-
compilerOptions {
62-
jvmTarget.set(JvmTarget.JVM_17)
63-
}
64-
}
60+
kotlin { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } }
6561

6662
spotless {
67-
kotlin {
68-
target("**/*.kts", "**/*.kt")
69-
// Versions can be monitored: https://github.com/facebook/ktfmt/releases
70-
ktfmt("0.58")
71-
}
72-
json {
73-
target("**/*.json")
74-
gson().indentWithSpaces(4)
75-
}
63+
kotlin {
64+
target("**/*.kts", "**/*.kt")
65+
// Versions can be monitored: https://github.com/facebook/ktfmt/releases
66+
ktfmt("0.58")
67+
}
68+
json {
69+
target("**/*.json")
70+
gson().indentWithSpaces(4)
71+
}
7672
}
7773

78-
detekt {
79-
config.setFrom("$projectDir/config/detekt.yml")
80-
}
74+
detekt { config.setFrom("$projectDir/config/detekt.yml") }
8175

8276
tasks.withType<Detekt>().configureEach {
83-
reports {
84-
html.required.set(true)
85-
sarif.required.set(true)
86-
md.required.set(true)
87-
}
77+
reports {
78+
html.required.set(true)
79+
sarif.required.set(true)
80+
md.required.set(true)
81+
}
8882
}
8983

9084
tasks.withType<Test> {
@@ -112,98 +106,94 @@ dependencies {
112106
androidTestImplementation(libs.androidx.espresso.core)
113107
}
114108

115-
if (keystoreProperties.containsKey("centralUsername") && keystoreProperties.containsKey("centralPassword")) {
116-
afterEvaluate {
117-
publishing {
118-
publications {
119-
create<MavenPublication>("release") {
120-
from(components["release"])
121-
122-
pom {
123-
name = "Khronicle"
124-
packaging = "aar"
125-
description = "An SLF4J backend for Android."
126-
url = "https://github.com/esri/khronicle"
127-
128-
scm {
129-
connection = "scm:git:https://github.com/esri/khronicle"
130-
developerConnection = "scm:git:https://github.com/esri/khronicle"
131-
url = "https://github.com/esri/khronicle"
132-
}
133-
134-
licenses {
135-
license {
136-
name = "Apache License 2.0"
137-
url = "https://spdx.org/licenses/Apache-2.0.html"
138-
}
139-
}
140-
141-
developers {
142-
developer {
143-
id = "award"
144-
name = "Adam Ward"
145-
146-
}
147-
developer {
148-
id = "jonasvautherin"
149-
name = "Jonas Vautherin"
150-
151-
}
152-
}
153-
}
154-
}
109+
if (
110+
keystoreProperties.containsKey("centralUsername") &&
111+
keystoreProperties.containsKey("centralPassword")
112+
) {
113+
afterEvaluate {
114+
publishing {
115+
publications {
116+
create<MavenPublication>("release") {
117+
from(components["release"])
118+
119+
pom {
120+
name = "Khronicle"
121+
packaging = "aar"
122+
description = "An SLF4J backend for Android."
123+
url = "https://github.com/esri/khronicle"
124+
125+
scm {
126+
connection = "scm:git:https://github.com/esri/khronicle"
127+
developerConnection = "scm:git:https://github.com/esri/khronicle"
128+
url = "https://github.com/esri/khronicle"
129+
}
130+
131+
licenses {
132+
license {
133+
name = "Apache License 2.0"
134+
url = "https://spdx.org/licenses/Apache-2.0.html"
135+
}
155136
}
156-
repositories {
157-
maven {
158-
url = uri(layout.buildDirectory.dir("target/staging-deploy"))
159-
}
137+
138+
developers {
139+
developer {
140+
id = "award"
141+
name = "Adam Ward"
142+
143+
}
144+
developer {
145+
id = "jonasvautherin"
146+
name = "Jonas Vautherin"
147+
148+
}
160149
}
150+
}
161151
}
152+
}
153+
repositories { maven { url = uri(layout.buildDirectory.dir("target/staging-deploy")) } }
162154
}
155+
}
163156

164-
jreleaser {
165-
signing {
166-
setActive("ALWAYS")
167-
armored.set(true)
168-
setMode("COMMAND")
157+
jreleaser {
158+
signing {
159+
setActive("ALWAYS")
160+
armored.set(true)
161+
setMode("COMMAND")
169162

170-
command {
171-
keyName.set("C8B1511EF991537875A649517D5F7A7C9542C299")
172-
}
163+
command { keyName.set("C8B1511EF991537875A649517D5F7A7C9542C299") }
164+
}
165+
deploy {
166+
release {
167+
github {
168+
skipRelease = true
169+
skipTag = true
173170
}
174-
deploy {
175-
release {
176-
github {
177-
skipRelease = true
178-
skipTag = true
179-
}
180-
}
181-
maven {
182-
mavenCentral {
183-
create("sonatype") {
184-
verifyPom = false
185-
setActive("RELEASE")
186-
username = keystoreProperties["centralUsername"] as String
187-
password = keystoreProperties["centralPassword"] as String
188-
url = "https://central.sonatype.com/api/v1/publisher"
189-
stagingRepository("build/target/staging-deploy")
190-
}
191-
}
192-
nexus2 {
193-
create("snapshot-deploy") {
194-
verifyPom = false
195-
setActive("SNAPSHOT")
196-
snapshotUrl.set("https://central.sonatype.com/repository/maven-snapshots")
197-
url = "https://central.sonatype.com/repository/maven-snapshots"
198-
applyMavenCentralRules = true
199-
snapshotSupported = true
200-
username = keystoreProperties["centralUsername"] as String
201-
password = keystoreProperties["centralPassword"] as String
202-
stagingRepository("build/target/staging-deploy")
203-
}
204-
}
205-
}
171+
}
172+
maven {
173+
mavenCentral {
174+
create("sonatype") {
175+
verifyPom = false
176+
setActive("RELEASE")
177+
username = keystoreProperties["centralUsername"] as String
178+
password = keystoreProperties["centralPassword"] as String
179+
url = "https://central.sonatype.com/api/v1/publisher"
180+
stagingRepository("build/target/staging-deploy")
181+
}
206182
}
183+
nexus2 {
184+
create("snapshot-deploy") {
185+
verifyPom = false
186+
setActive("SNAPSHOT")
187+
snapshotUrl.set("https://central.sonatype.com/repository/maven-snapshots")
188+
url = "https://central.sonatype.com/repository/maven-snapshots"
189+
applyMavenCentralRules = true
190+
snapshotSupported = true
191+
username = keystoreProperties["centralUsername"] as String
192+
password = keystoreProperties["centralPassword"] as String
193+
stagingRepository("build/target/staging-deploy")
194+
}
195+
}
196+
}
207197
}
198+
}
208199
}
209-

src/main/java/com/esri/logger/khronicle/ConfigurationParser.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2025 Esri
2-
//
2+
//
33
// Licensed under the Apache License Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -102,9 +102,10 @@ class ConfigurationParser {
102102
when (parser.name) {
103103
TAG_ENCODER -> handleEncoder(appender)
104104
else -> {
105-
val property = kClass.memberProperties
106-
.filterIsInstance<KMutableProperty1<Any, Any?>>()
107-
.find { it.name == parser.name }
105+
val property =
106+
kClass.memberProperties.filterIsInstance<KMutableProperty1<Any, Any?>>().find {
107+
it.name == parser.name
108+
}
108109

109110
if (property != null) {
110111
val contents = readText()
@@ -139,9 +140,7 @@ class ConfigurationParser {
139140

140141
private fun handleRoot() =
141142
handleTag(parser, TAG_ROOT) {
142-
val root = checkNotNull(loggers["root"]) {
143-
"Root config should be pre-initialized"
144-
}
143+
val root = checkNotNull(loggers["root"]) { "Root config should be pre-initialized" }
145144

146145
parser.getAttributeValue(null, ATTR_LEVEL)?.let { level -> root.setLevel(level) }
147146

@@ -164,9 +163,10 @@ class ConfigurationParser {
164163

165164
private fun handleLogger() =
166165
handleTag(parser, TAG_LOGGER) {
167-
val name = requireNotNull(parser.getAttributeValue(null, ATTR_NAME)) {
168-
"Logger configuration requires name attribute"
169-
}
166+
val name =
167+
requireNotNull(parser.getAttributeValue(null, ATTR_NAME)) {
168+
"Logger configuration requires name attribute"
169+
}
170170
val logger = LoggerConfig()
171171
loggers[name] = logger
172172

@@ -209,9 +209,7 @@ class ConfigurationParser {
209209
}
210210

211211
private fun skip() {
212-
check(parser.eventType == XmlPullParser.START_TAG) {
213-
"The element must start with a START_TAG"
214-
}
212+
check(parser.eventType == XmlPullParser.START_TAG) { "The element must start with a START_TAG" }
215213

216214
var depth = 1
217215
while (depth != 0) {

src/main/java/com/esri/logger/khronicle/FileExtensions.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2025 Esri
2-
//
2+
//
33
// Licensed under the Apache License Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,8 @@ internal fun File.incrementNumberedFileName(namePrefix: String, extension: Strin
3737
indexString.isDigitsOnly() -> indexString.toInt() + 1
3838
else ->
3939
throw IllegalArgumentException(
40-
"Input file did not follow required prefix#extension pattern")
40+
"Input file did not follow required prefix#extension pattern"
41+
)
4142
}
4243

4344
val newFile = File(path.removeSuffix(name), "$namePrefix$newIndex$extension")

src/main/java/com/esri/logger/khronicle/LoggerBuilder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2025 Esri
2-
//
2+
//
33
// Licensed under the Apache License Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

src/main/java/com/esri/logger/khronicle/LoggerFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2025 Esri
2-
//
2+
//
33
// Licensed under the Apache License Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

0 commit comments

Comments
 (0)