Skip to content

Commit 963b703

Browse files
authored
Merge pull request #32 from saschpe/cleanup
Various improvements, ktor documentation
2 parents 3fdd258 + c394ad6 commit 963b703

File tree

26 files changed

+103
-96
lines changed

26 files changed

+103
-96
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{kt,kts}]
12+
ktlint_standard_no-wildcard-imports = disabled

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
- Allow empty log messages if you only want to create a log entry about a function being called.
1010
- Dependency update:
1111
- [Kotlin 1.9.10](https://kotlinlang.org/docs/whatsnew19.html)
12+
- [Gradle-8.7](https://docs.gradle.org/8.7/release-notes.html)
13+
- [Android Gradle Plugin 8.2.2](https://developer.android.com/build/releases/past-releases/agp-8-2-0-release-notes)
1214

1315
## [1.2.3] - 2022-10-12
1416
### Changed

build.gradle.kts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
plugins {
2-
kotlin("jvm") version "1.9.10"
3-
id("com.android.library") version "7.3.0" apply false
42
id("com.diffplug.spotless") version "6.21.0"
53
id("com.github.ben-manes.versions") version "0.48.0"
64
}
@@ -11,9 +9,17 @@ spotless {
119
propertiesFile("gradle.properties")
1210
}
1311
kotlin {
14-
ktlint()
12+
target("**/*.kt")
13+
ktlint().setEditorConfigPath(".editorconfig")
1514
}
1615
kotlinGradle {
17-
ktlint()
16+
ktlint().setEditorConfigPath(".editorconfig")
17+
}
18+
}
19+
20+
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
21+
rejectVersionIf {
22+
fun isStable(version: String) = Regex("^[0-9,.v-]+(-r)?$").matches(version)
23+
!isStable(candidate.version) && isStable(currentVersion)
1824
}
1925
}

gradle/wrapper/gradle-wrapper.jar

-16.9 KB
Binary file not shown.
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

+22-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
147+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+
# shellcheck disable=SC2039,SC3045
146149
MAX_FD=$( ulimit -H -n ) ||
147150
warn "Could not query maximum file descriptor limit"
148151
esac
149152
case $MAX_FD in #(
150153
'' | soft) :;; #(
151154
*)
155+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156+
# shellcheck disable=SC2039,SC3045
152157
ulimit -n "$MAX_FD" ||
153158
warn "Could not set maximum file descriptor limit to $MAX_FD"
154159
esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
193198
done
194199
fi
195200

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
201210

202211
set -- \
203212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

gradlew.bat

+11-10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
2828
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -42,11 +43,11 @@ set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
4344
if %ERRORLEVEL% equ 0 goto execute
4445

45-
echo.
46-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47-
echo.
48-
echo Please set the JAVA_HOME variable in your environment to match the
49-
echo location of your Java installation.
46+
echo. 1>&2
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48+
echo. 1>&2
49+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50+
echo location of your Java installation. 1>&2
5051

5152
goto fail
5253

@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5657

5758
if exist "%JAVA_EXE%" goto execute
5859

59-
echo.
60-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61-
echo.
62-
echo Please set the JAVA_HOME variable in your environment to match the
63-
echo location of your Java installation.
60+
echo. 1>&2
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62+
echo. 1>&2
63+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64+
echo location of your Java installation. 1>&2
6465

6566
goto fail
6667

log4k-slf4j/build.gradle.kts

+13-30
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
kotlin {
99
androidTarget { publishAllLibraryVariants() }
10-
ios()
10+
iosArm64()
1111
iosSimulatorArm64()
1212
js {
1313
nodejs()
@@ -18,51 +18,34 @@ kotlin {
1818
}
1919
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
2020

21-
sourceSets["androidMain"].dependencies {
22-
implementation("org.slf4j:slf4j-api:1.7.36")
23-
}
24-
sourceSets["commonMain"].dependencies {
25-
implementation(project(":log4k"))
26-
}
27-
sourceSets["commonTest"].dependencies {
28-
implementation(kotlin("test"))
29-
}
30-
sourceSets["iosSimulatorArm64Main"].dependsOn(sourceSets["iosMain"])
31-
sourceSets["iosSimulatorArm64Test"].dependsOn(sourceSets["iosTest"])
32-
sourceSets["jvmMain"].dependencies {
33-
implementation("org.slf4j:slf4j-api:1.7.36")
34-
}
21+
applyDefaultHierarchyTemplate()
3522

36-
targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests::class.java) {
37-
testRuns["test"].deviceId = "iPhone 14"
23+
sourceSets {
24+
commonMain.dependencies { implementation(project(":log4k")) }
25+
commonTest.dependencies { implementation(kotlin("test")) }
26+
androidMain.dependencies { implementation("org.slf4j:slf4j-api:1.7.36") }
27+
jvmMain.dependencies { implementation("org.slf4j:slf4j-api:1.7.36") }
3828
}
3929
}
4030

31+
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
32+
4133
android {
42-
buildToolsVersion = "33.0.0"
43-
compileSdk = 33
34+
namespace = "saschpe.log4k.slf4j"
4435

4536
defaultConfig {
37+
compileSdk = 33
4638
minSdk = 17
47-
targetSdk = 33
4839
}
4940

50-
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
51-
52-
testCoverage.jacocoVersion = "0.8.8"
41+
testCoverage.jacocoVersion = "0.8.10"
5342
}
5443

5544
group = "de.peilicke.sascha"
5645
version = "1.2.3"
5746

58-
val javadocJar by tasks.registering(Jar::class) {
59-
archiveClassifier.set("javadoc")
60-
}
61-
6247
publishing {
6348
publications.withType<MavenPublication> {
64-
artifact(javadocJar.get())
65-
6649
pom {
6750
name.set("Log4K-SLF4J")
6851
description.set("Lightweight logging library for Kotlin/Multiplatform - SLF4J integration. Supports Android, iOS, JavaScript and plain JVM environments.")
@@ -109,4 +92,4 @@ signing {
10992
else -> useInMemoryPgpKeys(sonatypeGpgKey, sonatypeGpgKeyPassword)
11093
}
11194
sign(publishing.publications)
112-
}
95+
}

log4k-slf4j/src/androidMain/AndroidManifest.xml

-1
This file was deleted.

log4k-slf4j/src/androidMain/kotlin/saschpe/log4k/slf4j/MDC.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ actual object MDC {
88
actual fun remove(key: String) = org.slf4j.MDC.remove(key)
99

1010
actual fun clear() = org.slf4j.MDC.clear()
11-
}
11+
}

log4k-slf4j/src/androidMain/kotlin/saschpe/log4k/slf4j/SLF4JLogger.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ actual class SLF4JLogger : Logger() {
2222
Log.Level.Assert -> error(message, throwable)
2323
}
2424
}
25-
}
25+
}

log4k-slf4j/src/commonMain/kotlin/saschpe/log4k/slf4j/MDC.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ expect object MDC {
88
fun get(key: String): String?
99
fun remove(key: String)
1010
fun clear()
11-
}
11+
}

log4k-slf4j/src/commonMain/kotlin/saschpe/log4k/slf4j/SLF4JLogger.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ import saschpe.log4k.Logger
1414
*
1515
* On JVM or Android, SLF4J is used for logging. On JS or Apple platforms, console logging is used internally.
1616
*/
17-
expect class SLF4JLogger : Logger
17+
expect class SLF4JLogger : Logger

log4k-slf4j/src/iosMain/kotlin/saschpe/log4k/slf4j/MDC.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ actual object MDC {
1414
}
1515

1616
actual fun clear() = context.clear()
17-
}
17+
}

log4k-slf4j/src/iosMain/kotlin/saschpe/log4k/slf4j/SLF4JLogger.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ actual class SLF4JLogger : Logger() {
99

1010
override fun print(level: Log.Level, tag: String, message: String?, throwable: Throwable?) =
1111
logger.log(level, tag, message, throwable)
12-
}
12+
}

log4k-slf4j/src/jsMain/kotlin/saschpe/log4k/slf4j/MDC.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ actual object MDC {
1414
}
1515

1616
actual fun clear() = context.clear()
17-
}
17+
}

log4k-slf4j/src/jsMain/kotlin/saschpe/log4k/slf4j/SLF4JLogger.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ actual class SLF4JLogger : Logger() {
99

1010
override fun print(level: Log.Level, tag: String, message: String?, throwable: Throwable?) =
1111
logger.log(level, tag, message, throwable)
12-
}
12+
}

log4k-slf4j/src/jvmMain/kotlin/saschpe/log4k/slf4j/MDC.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ actual object MDC {
88
actual fun remove(key: String) = org.slf4j.MDC.remove(key)
99

1010
actual fun clear() = org.slf4j.MDC.clear()
11-
}
11+
}

log4k-slf4j/src/jvmMain/kotlin/saschpe/log4k/slf4j/SLF4JLogger.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ actual class SLF4JLogger : Logger() {
1616
Log.Level.Assert -> error(message, throwable)
1717
}
1818
}
19-
}
19+
}

log4k/build.gradle.kts

+10-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
kotlin {
99
androidTarget { publishAllLibraryVariants() }
10-
ios()
10+
iosArm64()
1111
iosSimulatorArm64()
1212
js {
1313
nodejs()
@@ -18,42 +18,31 @@ kotlin {
1818
}
1919
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
2020

21-
sourceSets["commonTest"].dependencies {
22-
implementation(kotlin("test"))
23-
}
24-
sourceSets["iosSimulatorArm64Main"].dependsOn(sourceSets["iosMain"])
25-
sourceSets["iosSimulatorArm64Test"].dependsOn(sourceSets["iosTest"])
21+
applyDefaultHierarchyTemplate()
2622

27-
targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests::class.java) {
28-
testRuns["test"].deviceId = "iPhone 14"
23+
sourceSets {
24+
commonTest.dependencies { implementation(kotlin("test")) }
2925
}
3026
}
3127

28+
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
29+
3230
android {
33-
buildToolsVersion = "33.0.0"
34-
compileSdk = 33
31+
namespace = "saschpe.log4k"
3532

3633
defaultConfig {
34+
compileSdk = 33
3735
minSdk = 17
38-
targetSdk = 33
3936
}
4037

41-
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
42-
43-
testCoverage.jacocoVersion = "0.8.8"
38+
testCoverage.jacocoVersion = "0.8.10"
4439
}
4540

4641
group = "de.peilicke.sascha"
4742
version = "1.2.3"
4843

49-
val javadocJar by tasks.registering(Jar::class) {
50-
archiveClassifier.set("javadoc")
51-
}
52-
5344
publishing {
5445
publications.withType<MavenPublication> {
55-
artifact(javadocJar.get())
56-
5746
pom {
5847
name.set("Log4K")
5948
description.set("Lightweight logging library for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.")
@@ -100,4 +89,4 @@ signing {
10089
else -> useInMemoryPgpKeys(sonatypeGpgKey, sonatypeGpgKeyPassword)
10190
}
10291
sign(publishing.publications)
103-
}
92+
}

0 commit comments

Comments
 (0)