Skip to content

Commit c05b934

Browse files
authored
Merge pull request #38 from saschpe/apple-and-tests
Add more Apple ARM64 platforms: macOS, tvOS, watchOS
2 parents ef52c53 + adcad18 commit c05b934

File tree

17 files changed

+94
-163
lines changed

17 files changed

+94
-163
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: ./gradlew build
3232
- name: Archive build artifacts
3333
if: github.ref == 'refs/heads/main'
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: log4k_build
3737
path: |
@@ -58,7 +58,7 @@ jobs:
5858
distribution: temurin
5959
java-version: 17
6060
- name: Download build artifacts
61-
uses: actions/download-artifact@v3
61+
uses: actions/download-artifact@v4
6262
with:
6363
name: log4k_build
6464
- name: Publish to Sonatype (Maven Central)

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Changed
99
- Allow empty log messages if you only want to create a log entry about a function being called.
10+
- Add more Apple ARM64 platforms: macOS, tvOS, watchOS
1011
- Dependency update:
1112
- [Kotlin 1.9.10](https://kotlinlang.org/docs/whatsnew19.html)
1213
- [Gradle-8.7](https://docs.gradle.org/8.7/release-notes.html)

log4k-slf4j/build.gradle.kts

+5-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ kotlin {
99
androidTarget { publishAllLibraryVariants() }
1010
iosArm64()
1111
iosSimulatorArm64()
12-
js {
13-
nodejs()
14-
compilations.all {
15-
kotlinOptions.sourceMap = true
16-
kotlinOptions.moduleKind = "umd"
17-
}
18-
}
19-
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
12+
js { nodejs() }
13+
jvm()
14+
macosArm64()
15+
tvosArm64()
16+
watchosArm64()
2017

2118
applyDefaultHierarchyTemplate()
2219

log4k/build.gradle.kts

+4-7
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ kotlin {
99
androidTarget { publishAllLibraryVariants() }
1010
iosArm64()
1111
iosSimulatorArm64()
12-
js {
13-
nodejs()
14-
compilations.all {
15-
kotlinOptions.sourceMap = true
16-
kotlinOptions.moduleKind = "umd"
17-
}
18-
}
12+
js { nodejs() }
1913
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
14+
macosArm64()
15+
tvosArm64()
16+
watchosArm64()
2017

2118
applyDefaultHierarchyTemplate()
2219

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package saschpe.log4k
2+
3+
internal actual val expectedListTag: String = "ArrayList"
4+
internal actual val expectedMapTag: String = "SingletonMap"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package saschpe.log4k
2+
3+
internal actual val expectedListTag: String = ""
4+
internal actual val expectedMapTag: String = "HashMap"

log4k/src/commonTest/kotlin/saschpe/log4k/LogTest.kt

+4-23
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package saschpe.log4k
22

33
import testing.*
4-
import kotlin.test.*
5-
6-
class LogTest {
7-
@BeforeTest // Arrange
8-
fun before() {
9-
Log.loggers.clear()
10-
Log.loggers += TestLogger()
11-
}
4+
import kotlin.test.Test
5+
import kotlin.test.assertFalse
6+
import kotlin.test.assertTrue
127

8+
class LogTest : TestLoggerTest() {
139
@Test
1410
fun verbose() {
1511
// Act
@@ -172,18 +168,6 @@ class LogTest {
172168
assertTestLogger(Log.Level.Assert)
173169
}
174170

175-
@Test
176-
fun logged_Pair() {
177-
// Arrange
178-
val pair = Pair("Hello", "World")
179-
180-
// Act
181-
pair.logged()
182-
183-
// Assert
184-
assertTestLogger(Log.Level.Debug, "(Hello, World)", "Pair", null)
185-
}
186-
187171
@Test
188172
fun isDebugEnabled() {
189173
assertTrue(Log.isDebugEnabled, "TestLogger defaults to ${Log.Level.Verbose}")
@@ -196,7 +180,4 @@ class LogTest {
196180
Log.loggers.clear()
197181
assertFalse(Log.isDebugEnabled)
198182
}
199-
200-
@AfterTest
201-
fun after() = Log.loggers.clear()
202183
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package saschpe.log4k
2+
3+
import testing.TestLoggerTest
4+
import testing.assertTestLogger
5+
import kotlin.test.Test
6+
7+
internal expect val expectedListTag: String
8+
internal expect val expectedMapTag: String
9+
10+
class LoggedTest : TestLoggerTest() {
11+
@Test
12+
fun logged_Pair() {
13+
// Arrange
14+
val pair = Pair("Hello", "World")
15+
16+
// Act
17+
pair.logged()
18+
19+
// Assert
20+
assertTestLogger(Log.Level.Debug, "(Hello, World)", "Pair", null)
21+
}
22+
23+
@Test
24+
fun logged_List() {
25+
// Arrange
26+
val list = listOf("Hello", "World")
27+
28+
// Act
29+
list.logged()
30+
31+
// Assert
32+
assertTestLogger(Log.Level.Debug, "[Hello, World]", expectedListTag, null)
33+
}
34+
35+
@Test
36+
fun logged_Map() {
37+
// Arrange
38+
val map = mapOf("Hello" to "World")
39+
40+
// Act
41+
map.logged()
42+
43+
// Assert
44+
assertTestLogger(Log.Level.Debug, "{Hello=World}", expectedMapTag, null)
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package testing
2+
3+
import saschpe.log4k.Log
4+
import kotlin.test.AfterTest
5+
import kotlin.test.BeforeTest
6+
7+
abstract class TestLoggerTest {
8+
@BeforeTest // Arrange
9+
fun before() {
10+
Log.loggers.clear()
11+
Log.loggers += TestLogger()
12+
}
13+
14+
@AfterTest
15+
fun after() = Log.loggers.clear()
16+
}

log4k/src/iosTest/kotlin/saschpe/log4k/LogTestIos.kt

-41
This file was deleted.

log4k/src/jsTest/kotlin/saschpe/log4k/LogTestJs.kt

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package saschpe.log4k
2+
3+
internal actual val expectedListTag: String = "ArrayList"
4+
internal actual val expectedMapTag: String = "HashMap"

log4k/src/jvmTest/kotlin/saschpe/log4k/LogTestJvm.kt

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package saschpe.log4k
2+
3+
internal actual val expectedListTag: String = "ArrayList"
4+
internal actual val expectedMapTag: String = "SingletonMap"

0 commit comments

Comments
 (0)