Skip to content

Commit

Permalink
Gradle: Keep only global plugins in root build.gradle.kts
Browse files Browse the repository at this point in the history
Plugins that are used in multiple projects, but not globally are
configured in settings.gradle.kts and applied in sub-projects.
  • Loading branch information
saschpe committed Sep 14, 2023
1 parent 13bedd3 commit f7b0cd4
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,kts}]
ktlint_standard_no-wildcard-imports = disabled
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
plugins {
kotlin("jvm") version "1.9.10"
id("com.android.library") version "8.1.0-rc01" apply false
id("com.diffplug.spotless") version "6.21.0"
id("com.github.ben-manes.versions") version "0.48.0"
}
Expand All @@ -11,6 +9,7 @@ spotless {
propertiesFile("gradle.properties")
}
kotlin {
target("**/*.kt")
ktlint()
}
kotlinGradle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ actual object MDC {
actual fun remove(key: String) = org.slf4j.MDC.remove(key)

actual fun clear() = org.slf4j.MDC.clear()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ actual class SLF4JLogger : Logger() {
Log.Level.Assert -> error(message, throwable)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ expect object MDC {
fun get(key: String): String?
fun remove(key: String)
fun clear()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ import saschpe.log4k.Logger
*
* On JVM or Android, SLF4J is used for logging. On JS or Apple platforms, console logging is used internally.
*/
expect class SLF4JLogger : Logger
expect class SLF4JLogger : Logger
2 changes: 1 addition & 1 deletion log4k-slf4j/src/iosMain/kotlin/saschpe/log4k/slf4j/MDC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ actual object MDC {
}

actual fun clear() = context.clear()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ actual class SLF4JLogger : Logger() {

override fun print(level: Log.Level, tag: String, message: String?, throwable: Throwable?) =
logger.log(level, tag, message, throwable)
}
}
2 changes: 1 addition & 1 deletion log4k-slf4j/src/jsMain/kotlin/saschpe/log4k/slf4j/MDC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ actual object MDC {
}

actual fun clear() = context.clear()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ actual class SLF4JLogger : Logger() {

override fun print(level: Log.Level, tag: String, message: String?, throwable: Throwable?) =
logger.log(level, tag, message, throwable)
}
}
2 changes: 1 addition & 1 deletion log4k-slf4j/src/jvmMain/kotlin/saschpe/log4k/slf4j/MDC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ actual object MDC {
actual fun remove(key: String) = org.slf4j.MDC.remove(key)

actual fun clear() = org.slf4j.MDC.clear()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ actual class SLF4JLogger : Logger() {
Log.Level.Assert -> error(message, throwable)
}
}
}
}
2 changes: 1 addition & 1 deletion log4k/src/commonMain/kotlin/saschpe/log4k/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abstract class Logger {
Magenta("\u001B[35m"),
Red("\u001B[31m"),
White("\u001B[37m"),
Yellow("\u001B[33m")
Yellow("\u001B[33m"),
}

var minimumLogLevel = Log.Level.Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import saschpe.log4k.Log
import saschpe.log4k.Logger

class StubLoggerWithMinimum(
minimumLogLevel: Log.Level
minimumLogLevel: Log.Level,
) : Logger() {
init {
this.minimumLogLevel = minimumLogLevel
Expand Down
2 changes: 1 addition & 1 deletion log4k/src/iosMain/kotlin/saschpe/log4k/ConsoleLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ actual class ConsoleLogger : Logger() {
Log.Level.Info to "💚 Info",
Log.Level.Warning to "💛 Warn",
Log.Level.Error to "❤️ Error",
Log.Level.Assert to "💜 Assert"
Log.Level.Assert to "💜 Assert",
)
}
4 changes: 2 additions & 2 deletions log4k/src/jvmMain/kotlin/saschpe/log4k/ConsoleLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ actual class ConsoleLogger : Logger() {
ConsoleHandler().apply {
level = Level.ALL
formatter = SimpleFormatter()
}
},
)
useParentHandlers = false
}
Expand Down Expand Up @@ -56,7 +56,7 @@ actual class ConsoleLogger : Logger() {
Log.Level.Info to "${AnsiColor.Green.value}Info${AnsiColor.Reset.value}",
Log.Level.Warning to "${AnsiColor.Yellow.value}Warn${AnsiColor.Reset.value}",
Log.Level.Error to "${AnsiColor.Red.value}Error${AnsiColor.Reset.value}",
Log.Level.Assert to "${AnsiColor.Magenta.value}Assert${AnsiColor.Reset.value}"
Log.Level.Assert to "${AnsiColor.Magenta.value}Assert${AnsiColor.Reset.value}",
)

private fun getTraceTag(trace: StackTraceElement): String {
Expand Down
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ pluginManagement {
gradlePluginPortal()
google()
}

plugins {
kotlin("multiplatform") version "1.9.10"
id("com.android.library") version "8.1.0-rc01"
}
}

dependencyResolutionManagement {
Expand Down

0 comments on commit f7b0cd4

Please sign in to comment.