Skip to content

Commit 867abd5

Browse files
committed
Start running shared tests
There is a problem with our source sets that has prevented these tests from running.
1 parent 138d6c1 commit 867abd5

File tree

22 files changed

+53
-12942
lines changed

22 files changed

+53
-12942
lines changed

gen-tests.gradle.kts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -673,34 +673,11 @@ val generateSharedJsonCompactJavaTests by tasks.creating(JavaExec::class) {
673673
)
674674
}
675675

676-
val generateSharedJsonKotlinTests by tasks.creating(JavaExec::class) {
677-
group = "Generate Shared JSON Tests"
678-
description = "Generates Kotlin classes for shared JSON tests"
679-
classpath = wire
680-
mainClass.set("com.squareup.wire.WireCompiler")
681-
args = listOf(
682-
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
683-
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
684-
"--kotlin_out=wire-tests/src/jvmJsonKotlinTest/proto-kotlin",
685-
"--java_interop",
686-
"all32.proto",
687-
"all64.proto",
688-
"all_types_proto2.proto",
689-
"all_types_proto3_test_proto3_optional.proto",
690-
"all_structs.proto",
691-
"all_wrappers.proto",
692-
"camel_case.proto",
693-
"map_types.proto",
694-
"pizza.proto"
695-
)
696-
}
697-
698676
val generateSharedJson by tasks.creating {
699677
group = "Generate Tests"
700678
description = "Generates Java and Kotlin classes for shared JSON tests"
701679
dependsOn(
702680
generateSharedJsonCompactJavaTests,
703-
generateSharedJsonKotlinTests
704681
)
705682
}
706683

@@ -757,6 +734,5 @@ val cleanGeneratedTests by tasks.creating(Delete::class) {
757734
"wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
758735
"wire-tests/src/jvmKotlinProtoReader32Test/proto-kotlin",
759736
"wire-tests/src/jvmJsonJavaTest/proto-java",
760-
"wire-tests/src/jvmJsonKotlinTest/proto-kotlin"
761737
)
762738
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
android = "4.1.1.4"
3-
androidGradlePlugin = "8.13.1"
3+
androidGradlePlugin = "8.12.0"
44
asm = "9.9"
55
checkerQual = "3.52.0"
66
coroutines = "1.10.2"

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ include(":wire-schema-tests")
6060
include(":wire-swift-generator")
6161
include(":wire-test-utils")
6262
include(":wire-tests")
63+
include(":wire-tests-2:jvm-json-kotlin")
6364
if (startParameter.projectProperties.get("swift") != "false") {
6465
include(":wire-runtime-swift")
6566
include(":wire-tests-swift")
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import org.gradle.kotlin.dsl.dependencies
2+
import org.gradle.kotlin.dsl.implementation
3+
import org.gradle.kotlin.dsl.kotlin
4+
5+
plugins {
6+
kotlin("jvm")
7+
id("com.squareup.wire")
8+
}
9+
10+
dependencies {
11+
implementation(libs.assertk)
12+
implementation(libs.jimfs)
13+
implementation(libs.kotlin.test.junit)
14+
implementation(libs.truth)
15+
implementation(projects.wireGsonSupport)
16+
implementation(projects.wireMoshiAdapter)
17+
implementation(projects.wireRuntime)
18+
implementation(projects.wireTestUtils)
19+
}
20+
21+
kotlin {
22+
sourceSets {
23+
val test by getting {
24+
kotlin.srcDir("../wire-json-shared-kotlin-tests")
25+
}
26+
}
27+
}
28+
29+
wire {
30+
sourcePath {
31+
srcDir("../../wire-tests/src/commonTest/shared/proto/proto2")
32+
srcDir("../../wire-tests/src/commonTest/shared/proto/proto3")
33+
include(
34+
"all32.proto",
35+
"all64.proto",
36+
"all_types_proto2.proto",
37+
"all_types_proto3_test_proto3_optional.proto",
38+
"all_structs.proto",
39+
"all_wrappers.proto",
40+
"camel_case.proto",
41+
"map_types.proto",
42+
"pizza.proto",
43+
)
44+
}
45+
kotlin {
46+
javaInterop = true
47+
}
48+
}

wire-tests/src/jvmJsonTest/kotlin/com/squareup/wire/WireJsonTest.kt renamed to wire-tests-2/wire-json-shared-kotlin-tests/com/squareup/wire/WireJsonTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ class WireJsonTest {
12451245
)
12461246

12471247
private fun loadJson(fileName: String): String {
1248-
return File("src/commonTest/shared/json", fileName).source().use { it.buffer().readUtf8() }
1248+
return File("../../wire-tests/src/commonTest/shared/json", fileName).source().use { it.buffer().readUtf8() }
12491249
}
12501250
}
12511251
}

wire-tests/src/jvmJsonTest/kotlin/com/squareup/wire/internal/DurationJsonFormatterTest.kt renamed to wire-tests-2/wire-json-shared-kotlin-tests/com/squareup/wire/internal/DurationJsonFormatterTest.kt

File renamed without changes.

wire-tests/src/jvmJsonTest/kotlin/com/squareup/wire/internal/InstantJsonFormatterTest.kt renamed to wire-tests-2/wire-json-shared-kotlin-tests/com/squareup/wire/internal/InstantJsonFormatterTest.kt

File renamed without changes.

wire-tests/build.gradle.kts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,6 @@ wireBuild {
163163
implementation(projects.wireRuntime)
164164
implementation(projects.wireTestUtils)
165165
}
166-
167-
createJavaTestTask("jvmJsonKotlinTest") {
168-
sourceSet.java.srcDir("src/jvmJsonTest/kotlin")
169-
sourceSet.java.srcDir("src/jvmJsonKotlinTest/proto-kotlin")
170-
implementation(libs.assertk)
171-
implementation(libs.jimfs)
172-
implementation(libs.kotlin.test.junit)
173-
implementation(libs.truth)
174-
implementation(projects.wireGsonSupport)
175-
implementation(projects.wireMoshiAdapter)
176-
implementation(projects.wireRuntime)
177-
implementation(projects.wireTestUtils)
178-
}
179166
}
180167

181168
configure<SpotlessExtension> {
@@ -193,7 +180,6 @@ configure<SpotlessExtension> {
193180
"src/jvmKotlinInteropTest/proto-kotlin/**/*.kt",
194181
"src/jvmKotlinProtoReader32Test/proto-kotlin/**/*.kt",
195182
"src/jvmJsonJavaTest/proto-java/**/*.kt",
196-
"src/jvmJsonKotlinTest/proto-kotlin/**/*.kt",
197183
)
198184
}
199185
java {

0 commit comments

Comments
 (0)