Skip to content

Commit c7edcc5

Browse files
asarkarAbhijit Sarkar
authored and
Abhijit Sarkar
committed
Closes #17: NoClassDefFoundError: kotlin.time.DurationKt
2 parents 70052f8 + ed35c82 commit c7edcc5

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tasks.withType<Test> {
5656

5757
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
5858
kotlinOptions {
59-
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xopt-in=kotlin.time.ExperimentalTime")
59+
freeCompilerArgs = listOf("-Xjsr305=strict")
6060
jvmTarget = "1.8"
6161
}
6262
}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pluginImplementationClass = org.asarkar.gradle.BuildTimeTrackerPlugin
88
pluginDeclarationName = buildTimeTrackerPlugin
99

1010
projectGroup = org.asarkar.gradle
11-
projectVersion = 2.0.2
11+
projectVersion = 2.0.3
1212

1313
jUnit5Version = 5.6.2
1414
assertJVersion = 3.16.1

src/main/kotlin/org/asarkar/gradle/ConsolePrinter.kt

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package org.asarkar.gradle
22

33
import java.io.PrintStream
4+
import java.time.Duration
45
import kotlin.math.round
5-
import kotlin.time.DurationUnit
6-
import kotlin.time.ExperimentalTime
7-
import kotlin.time.toDuration
86

97
class ConsolePrinter(private val out: PrintStream = System.out) : Printer {
10-
@ExperimentalTime
118
override fun print(input: PrinterInput) {
129
// find the maxes needed for formatting
1310
val (maxLabelLen, maxDuration, maxFormattedDurationLen) = input.taskDurations.fold(
@@ -47,10 +44,9 @@ class ConsolePrinter(private val out: PrintStream = System.out) : Printer {
4744
const val BLOCK_STR = "\u2588"
4845

4946
private fun Long.percentOf(buildDuration: Long): Int = round(this / buildDuration.toDouble() * 100).toInt()
50-
@ExperimentalTime
5147
internal fun Long.format(): String {
5248
val separators = setOf('P', 'D', 'T')
53-
return this.toDuration(DurationUnit.SECONDS).toIsoString()
49+
return Duration.ofSeconds(this).toString()
5450
.filterNot { it in separators }
5551
}
5652
private fun Int.format(): String = String.format("%d%%", this)

src/test/kotlin/org/asarkar/gradle/ConsolePrinterTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class ConsolePrinterTest {
254254
arguments(3900, "1H5M"),
255255
arguments(61, "1M1S"),
256256
arguments(172800, "48H"),
257-
arguments(172859, "48H0M59S")
257+
arguments(172859, "48H59S")
258258
)
259259
}
260260
}

0 commit comments

Comments
 (0)