Skip to content

Commit

Permalink
feat: upgrade mosaic0.13.0 (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgammon authored Jun 1, 2024
1 parent 3621be8 commit 8ffe4f0
Show file tree
Hide file tree
Showing 12 changed files with 305 additions and 102 deletions.
1 change: 1 addition & 0 deletions buildscript-gradle.lockfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions gradle/elide.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ micronaut-xml = "3.1.0"
mockito-bom = "5.10.0"
mockito-junit = "5.10.0"
mordant = "2.4.0"
mosaic = "0.11.0"
mosaic = "0.13.0"
mrjar = "0.1.1"
msgpack = "0.9.4"
netty = "4.1.110.Final"
Expand Down Expand Up @@ -674,6 +674,7 @@ logback-core = { group = "ch.qos.logback", name = "logback-core", version.ref =
lz4 = { group = "net.jpountz.lz4", name = "lz4", version.ref = "lz4" }
magicProgress = { group = "com.github.lukfor", name = "magic-progress", version.ref = "magicProgress" }
mordant = { group = "com.github.ajalt.mordant", name = "mordant", version.ref = "mordant" }
mosaic = { group = "com.jakewharton.mosaic", name = "mosaic-runtime", version.ref = "mosaic" }
msgpack = { group = "org.msgpack", name = "msgpack-core", version.ref = "msgpack" }
netty-bom = { group = "io.netty", name = "netty-bom", version.ref = "netty" }
netty-codec-http = { group = "io.netty", name = "netty-codec-http" }
Expand Down Expand Up @@ -794,6 +795,7 @@ plugin-kapshot = { group = "io.koalaql", name = "kapshot-plugin-gradle", version
plugin-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-sdk" }
plugin-kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin-sdk" }
plugin-kotlin-atomicfu = { group = "org.jetbrains.kotlin", name = "atomicfu", version.ref = "kotlin-sdk" }
plugin-kotlin-compose = { group = "org.jetbrains.kotlin", name = "compose-compiler-gradle-plugin", version.ref = "kotlin-sdk" }
plugin-kotlin-jsObjects = { group = "org.jetbrains.kotlin", name = "js-plain-objects", version.ref = "kotlin-sdk" }
plugin-kotlin-noarg = { group = "org.jetbrains.kotlin", name = "kotlin-noarg", version.ref = "kotlin-sdk" }
plugin-kotlin-powerAssert = { group = "org.jetbrains.kotlin", name = "kotlin-power-assert", version.ref = "kotlin-sdk" }
Expand All @@ -804,7 +806,6 @@ plugin-kotlinx-serialization = { group = "org.jetbrains.kotlin", name = "kotlin-
plugin-kover = { group = "org.jetbrains.kotlinx", name = "kover-gradle-plugin", version.ref = "kover-plugin" }
plugin-ksp = { group = "com.google.devtools.ksp", name = "symbol-processing-gradle-plugin", version.ref = "ksp" }
plugin-micronaut = { group = "io.micronaut.gradle", name = "micronaut-gradle-plugin", version.ref = "micronaut-plugin" }
plugin-mosaic = { group = "com.jakewharton.mosaic", name = "mosaic-gradle-plugin", version.ref = "mosaic" }
plugin-nexusPublishing = { group = "io.github.gradle-nexus", name = "publish-plugin", version.ref = "nexusPublishing" }
plugin-openrewrite = { group = "org.openrewrite", name = "plugin", version.ref = "openrewrite-plugin" }
plugin-proguard = { group = "com.guardsquare", name = "proguard-gradle", version.ref = "proguard" }
Expand Down
11 changes: 3 additions & 8 deletions packages/cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"UnstableApiUsage",
)

import com.jakewharton.mosaic.gradle.MosaicExtension
import io.micronaut.gradle.MicronautRuntime
import io.micronaut.gradle.docker.DockerBuildStrategy
import org.apache.tools.ant.taskdefs.condition.Os
Expand All @@ -43,6 +42,7 @@ plugins {

kotlin("jvm")
kotlin("kapt")
kotlin("plugin.compose")
kotlin("plugin.serialization")
id("io.micronaut.docker")
alias(libs.plugins.kover)
Expand Down Expand Up @@ -118,7 +118,6 @@ val enableRuby = true
val enableJit = true
val enablePreinitializeAll = true
val enableTools = true
val enableMosaic = true
val enableProguard = false
val enableLlvm = true
val enableEspresso = false
Expand Down Expand Up @@ -160,12 +159,9 @@ buildscript {
}
dependencies {
classpath(libs.plugin.proguard)
classpath(libs.plugin.mosaic)
}
}

if (enableMosaic) apply(plugin = "com.jakewharton.mosaic")

val nativesRootTemplate: (String) -> String = { version ->
"/tmp/elide-runtime/v$version/native"
}
Expand Down Expand Up @@ -255,8 +251,6 @@ sourceSets {

// use consistent compose plugin version
val kotlinVersion = libs.versions.kotlin.sdk.get()
if (enableMosaic) the<MosaicExtension>().kotlinCompilerPlugin =
"org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion"

val stamp = (project.properties["elide.stamp"] as? String ?: "false").toBooleanStrictOrNull() ?: false
val cliVersion = if (stamp) {
Expand All @@ -265,6 +259,7 @@ val cliVersion = if (stamp) {
"1.0-dev-${System.currentTimeMillis() / 1000 / 60 / 60 / 24}"
}

version = cliVersion
val nativesPath = nativesRootTemplate(cliVersion)
val gvmResourcesPath: String = layout.buildDirectory.dir("native/nativeCompile/resources")
.get()
Expand Down Expand Up @@ -313,10 +308,10 @@ dependencies {
implementation(libs.logback)
implementation(libs.tink)
implementation(libs.bouncycastle)
implementation(libs.mosaic)
implementation(libs.github.api) {
exclude(group = "org.bouncycastle")
}
implementation("com.jakewharton.mosaic:mosaic-runtime:${libs.versions.mosaic.get()}")

// GraalVM: Engines
implementation(projects.packages.graalvm)
Expand Down
30 changes: 15 additions & 15 deletions packages/cli/gradle.lockfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 16 additions & 17 deletions packages/cli/src/main/kotlin/elide/tool/cli/output/Mosaic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import androidx.compose.runtime.snapshots.SnapshotStateList
import com.jakewharton.mosaic.layout.background
import com.jakewharton.mosaic.layout.padding
import com.jakewharton.mosaic.modifier.Modifier
import com.jakewharton.mosaic.runMosaic
import com.jakewharton.mosaic.runMosaicBlocking
import com.jakewharton.mosaic.ui.Color.Companion.Black
import com.jakewharton.mosaic.ui.Color.Companion.BrightBlack
import com.jakewharton.mosaic.ui.Color.Companion.Green
import com.jakewharton.mosaic.ui.Color.Companion.Red
import com.jakewharton.mosaic.ui.Color.Companion.Yellow
Expand All @@ -44,7 +44,7 @@ suspend fun testRenderer(
totalTests: Int,
allTests: Flow<Pair<TestInfo, suspend () -> Deferred<TestResult>>>,
workers: Int = 1,
) = runMosaicBlocking {
) = runMosaic {
val start = System.currentTimeMillis()
val candidates = ArrayDeque(allTests.toList(ArrayList()))
val complete = mutableStateListOf<Test>()
Expand Down Expand Up @@ -126,12 +126,12 @@ fun TestRow(test: Test) {
val dir = test.path.substringBeforeLast('/')
val name = test.path.substringAfterLast('/')
Text(" $dir/")
Text(name, style = Bold)
Text(name, textStyle = Bold)
} else {
val pkg = test.path.substringBeforeLast('.')
val name = test.path.substringAfterLast('.')
Text(" $pkg/")
Text(name, style = Bold)
Text(name, textStyle = Bold)
}
}
}
Expand Down Expand Up @@ -182,15 +182,14 @@ private fun Summary(start: Long, totalTests: Int, tests: List<Test>) {
val failed = counts[Fail] ?: 0
val passed = counts[Pass] ?: 0
val running = counts[Running] ?: 0

// var elapsed by remember { mutableStateOf(0) }
var elapsed by remember { mutableStateOf(0) }

LaunchedEffect(Unit) {
while (true) {
delay(1_000)
// Snapshot.withMutableSnapshot {
// elapsed++
// }
Snapshot.withMutableSnapshot {
elapsed++
}
}
}

Expand All @@ -216,7 +215,7 @@ private fun Summary(start: Long, totalTests: Int, tests: List<Test>) {
}

val fmtMs = "%dms".format(System.currentTimeMillis() - start)
// Text("Time: ${elapsed}s ($fmtMs)")
Text("Time: ${elapsed}s ($fmtMs)")

if (running > 0) {
TestProgress(totalTests, passed, failed, running)
Expand All @@ -225,28 +224,28 @@ private fun Summary(start: Long, totalTests: Int, tests: List<Test>) {

@Composable
fun TestProgress(totalTests: Int, passed: Int, failed: Int, running: Int) {
// var showRunning by remember { mutableStateOf(true) }
var showRunning by remember { mutableStateOf(true) }

LaunchedEffect(Unit) {
while (true) {
delay(500L)

// Snapshot.withMutableSnapshot {
// showRunning = !showRunning
// }
Snapshot.withMutableSnapshot {
showRunning = !showRunning
}
}
}

val totalWidth = 40
val failedWidth = (failed.toDouble() * totalWidth / totalTests).toInt()
val passedWidth = (passed.toDouble() * totalWidth / totalTests).toInt()
// val runningWidth = if (showRunning) (running.toDouble() * totalWidth / totalTests).toInt() else 0
val runningWidth = if (showRunning) (running.toDouble() * totalWidth / totalTests).toInt() else 0

Row {
Text(" ".repeat(failedWidth), background = Red)
Text(" ".repeat(passedWidth), background = Green)
// Text(" ".repeat(runningWidth), background = Yellow)
// Text(" ".repeat(totalWidth - failedWidth - passedWidth - runningWidth), background = BrightBlack)
Text(" ".repeat(runningWidth), background = Yellow)
Text(" ".repeat(totalWidth - failedWidth - passedWidth - runningWidth), background = Black)
}
}

Expand Down
Loading

0 comments on commit 8ffe4f0

Please sign in to comment.