Skip to content

Commit 732968d

Browse files
committed
Address PR feedback.
1 parent 1b343ed commit 732968d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

agent_sdks/kotlin/build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ tasks.test {
5757
}
5858

5959
val copySpecs by tasks.registering(Copy::class) {
60-
val repoRoot = projectDir.parentFile.parentFile
60+
val repoRoot = findRepoRoot()
6161

6262
from(File(repoRoot, "specification/v0_8/json/server_to_client.json")) {
6363
into("com/google/a2ui/assets/0.8")
@@ -86,3 +86,14 @@ sourceSets {
8686
}
8787
}
8888
}
89+
90+
fun findRepoRoot(): File {
91+
var currentDir = project.projectDir
92+
while (currentDir != null) {
93+
if (File(currentDir, ".git").exists()) {
94+
return currentDir
95+
}
96+
currentDir = currentDir.parentFile
97+
}
98+
throw GradleException("Could not find repository root.")
99+
}

agent_sdks/kotlin/src/main/kotlin/com/google/a2ui/basic_catalog/BasicCatalogProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BundledCatalogProvider(private val version: A2uiVersion) : A2uiCatalogProv
3737
override fun load(): JsonObject {
3838
val specMap = BasicCatalog.BASIC_CATALOG_PATHS[version] ?: emptyMap()
3939
val relPath = specMap[A2uiConstants.CATALOG_SCHEMA_KEY] ?: ""
40-
val filename = java.io.File(relPath).name
40+
val filename = relPath.substringAfterLast('/')
4141

4242
val resource =
4343
SchemaResourceLoader.loadFromBundledResource(version.value, filename)?.toMutableMap()

0 commit comments

Comments
 (0)