Loading codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt +13 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import software.amazon.smithy.rust.codegen.core.util.runCommand import java.io.File import java.nio.file.Files.createTempDirectory import java.nio.file.Path import kotlin.io.path.absolutePathString /** * Waiting for Kotlin to stabilize their temp directory functionality Loading @@ -55,8 +56,18 @@ private fun tempDir(directory: File? = null): File { * This workspace significantly improves test performance by sharing dependencies between different tests. */ object TestWorkspace { private val baseDir = private val baseDir by lazy { val homeDir = System.getProperty("APPDATA") ?: System.getenv("XDG_DATA_HOME") ?: System.getProperty("user.home") ?.let { Path.of(it, "Library/Application Support").absolutePathString() } ?.takeIf { File(it).exists() } if (homeDir != null) { File(Path.of(homeDir, "smithy-test-workspace").absolutePathString()) } else { System.getenv("SMITHY_TEST_WORKSPACE")?.let { File(it) } ?: tempDir() } } private val subprojects = mutableListOf<String>() init { Loading Loading
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt +13 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import software.amazon.smithy.rust.codegen.core.util.runCommand import java.io.File import java.nio.file.Files.createTempDirectory import java.nio.file.Path import kotlin.io.path.absolutePathString /** * Waiting for Kotlin to stabilize their temp directory functionality Loading @@ -55,8 +56,18 @@ private fun tempDir(directory: File? = null): File { * This workspace significantly improves test performance by sharing dependencies between different tests. */ object TestWorkspace { private val baseDir = private val baseDir by lazy { val homeDir = System.getProperty("APPDATA") ?: System.getenv("XDG_DATA_HOME") ?: System.getProperty("user.home") ?.let { Path.of(it, "Library/Application Support").absolutePathString() } ?.takeIf { File(it).exists() } if (homeDir != null) { File(Path.of(homeDir, "smithy-test-workspace").absolutePathString()) } else { System.getenv("SMITHY_TEST_WORKSPACE")?.let { File(it) } ?: tempDir() } } private val subprojects = mutableListOf<String>() init { Loading