Skip to content

Commit 580738f

Browse files
committed
bugfix: publish room-common for processor runtime
1 parent 7d8f42b commit 580738f

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

processor/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies {
1313
compileOnly(libs.google.devtools.ksp)
1414

1515
api(libs.squareup.kotlinpoet)
16-
compileOnly(libs.androidx.room.common)
16+
implementation(libs.androidx.room.common)
1717

1818
testImplementation(project(":annotations"))
1919
testImplementation(libs.androidx.room.common)
@@ -26,5 +26,6 @@ dependencies {
2626
}
2727

2828
tasks.test {
29+
dependsOn(tasks.named("generateMetadataFileForMavenPublication"))
2930
useJUnitPlatform()
3031
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package co.anitrend.support.query.builder.processor
2+
3+
import org.junit.jupiter.api.Assertions.assertEquals
4+
import org.junit.jupiter.api.Assertions.assertTrue
5+
import org.junit.jupiter.api.Test
6+
import java.io.File
7+
8+
class PublicationMetadataTest {
9+
10+
@Test
11+
fun `processor runtime metadata should include room common`() {
12+
val repoRoot =
13+
generateSequence(File(System.getProperty("user.dir")).absoluteFile) { it.parentFile }
14+
.firstOrNull { candidate ->
15+
File(candidate, "settings.gradle.kts").isFile && File(candidate, "gradlew").isFile
16+
}
17+
?: error("Unable to locate repository root from `${System.getProperty("user.dir")}`")
18+
19+
val moduleFile = File(repoRoot, "processor/build/publications/maven/module.json")
20+
assertTrue(moduleFile.isFile, "Expected `${moduleFile.absolutePath}` to exist")
21+
22+
val moduleText = moduleFile.readText()
23+
assertEquals(true, moduleText.contains("\"runtimeElements\""))
24+
assertTrue(
25+
moduleText.contains("\"group\": \"androidx.room\"") && moduleText.contains("\"module\": \"room-common\""),
26+
"Expected processor runtime metadata to publish androidx.room room-common. See `${moduleFile.absolutePath}`",
27+
)
28+
}
29+
}

0 commit comments

Comments
 (0)