File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
src/main/kotlin/com/google/a2ui/basic_catalog Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ tasks.test {
5757}
5858
5959val 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+ }
Original file line number Diff line number Diff 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()
You can’t perform that action at this time.
0 commit comments