-
Notifications
You must be signed in to change notification settings - Fork 571
/
gen-tests.gradle.kts
759 lines (692 loc) · 24.3 KB
/
gen-tests.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
import okio.FileSystem
import okio.Path.Companion.toPath
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
buildscript {
dependencies {
classpath(libs.pluginz.kotlin)
classpath(platform(libs.okio.bom))
classpath(libs.okio.core)
}
repositories {
mavenCentral()
}
}
val fileSystem = FileSystem.SYSTEM
val protosDir = "${rootProject.rootDir}/wire-tests/src/commonTest/proto/java".toPath()
val PROTOS = fileSystem.listRecursively(protosDir)
.filter { fileSystem.metadata(it).isRegularFile }
.map { it.relativeTo(protosDir).toString() }
.filter { it.endsWith(".proto") }
.sorted()
.toList()
val wire by configurations.creating {
attributes {
val platformAttr = Attribute.of("org.jetbrains.kotlin.platform.type", KotlinPlatformType::class.java)
attribute(platformAttr, KotlinPlatformType.jvm)
}
}
dependencies {
wire(project("wire-compiler"))
}
// JAVA
val generateJavaTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Java classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaTest/proto-java",
"--excludes=squareup.options.*"
) + PROTOS
}
val generateKotlinClassAmongJavaTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the Java test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmJavaTest/proto-kotlin",
"custom_options2.proto"
)
}
// NO OPTIONS
val generateNoOptionsTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Java classes with no options from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaNoOptionsTest/proto-java",
"--excludes=google.protobuf.*",
"--excludes=squareup.options.*",
"--excludes=com.squareup.wire.ModelEvaluation"
) + PROTOS
}
// COMPACT
val generateCompactTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates compact Java classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaCompactTest/proto-java",
"--compact",
"all_types.proto"
)
}
// GSON
val generateGsonAdapterCompactJavaTests by tasks.creating(JavaExec::class) {
group = "Generate GsonAdapter Compact Java Tests"
description = "Generates compat Java classes from the GsonAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--java_out=wire-gson-support/src/test/java",
"--compact",
"all_types_proto2.proto",
)
}
val generateGsonAdapterJavaTests by tasks.creating(JavaExec::class) {
group = "Generate GsonAdapter Java Tests"
description = "Generates Java classes from the GsonAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--java_out=wire-gson-support/src/test/java",
"collection_types.proto",
"dinosaur_java.proto",
"period_java.proto",
"keyword_java.proto"
)
}
val generateGsonAdapterInteropKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate GsonAdapter Java interop Kotlin Tests"
description = "Generates Java interop Kotlin classes from the GsonAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--kotlin_out=wire-gson-support/src/test/java",
"--java_interop",
"dinosaur_java_interop_kotlin.proto",
"period_java_interop_kotlin.proto",
"keyword_kotlin.proto"
)
}
val generateGsonAdapterKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate GsonAdapter Kotlin Tests"
description = "Generates Kotlin classes from the GsonAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--kotlin_out=wire-gson-support/src/test/java",
"all_structs.proto",
"dinosaur_kotlin.proto",
"period_kotlin.proto",
"person_kotlin.proto",
"getters_kotlin.proto",
"pizza.proto",
)
}
val generateGsonTests by tasks.creating {
group = "Generate Tests"
description = "Generates Java and Kotlin classes that use Gson from the test protos"
dependsOn(
generateGsonAdapterCompactJavaTests,
generateGsonAdapterJavaTests,
generateGsonAdapterInteropKotlinTests,
generateGsonAdapterKotlinTests
)
}
// INCLUDES / EXCLUDES
val generateIncludesExcludesTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Java classes with included and excluded protos from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaPrunedTest/proto-java",
"--includes=squareup.protos.roots.A,squareup.protos.roots.H",
"--excludes=squareup.protos.roots.B",
"roots.proto"
)
}
// ANDROID
val generateAndroidTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Java classes for Android from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaAndroidTest/proto-java",
"--android",
"person.proto"
)
}
// ANDROID COMPACT
val generateAndroidCompactTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates compact Java classes for Android from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmJavaAndroidCompactTest/proto-java",
"--android",
"--compact",
"person.proto"
)
}
// OPAQUE TYPES
val generateOpaqueTypeTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Java, Kotlin, and Swift code to demonstrate opaque types"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--java_out=wire-tests/src/jvmJavaTest/proto-java",
"--no_java_exclusive",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"--no_kotlin_exclusive",
"--swift_out=wire-tests-swift/opaques",
"--no_swift_exclusive",
"--opaque_types=squareup.protos.opaque_types.OuterOpaqueType.InnerOpaqueType1",
"opaque_types.proto"
)
}
// KOTLIN
val generateKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"--kotlin_box_oneofs_min_size=8",
"all_types.proto",
"bool.proto",
"boxed_oneofs.proto",
"custom_options.proto",
"deprecated.proto",
"deprecated_enum.proto",
"edge_cases.proto",
"external_message.proto",
"foreign.proto",
"form.proto",
"map.proto",
"negative_value_enum.proto",
"no_fields.proto",
"one_of.proto",
"optional_enum.proto",
"option_redacted.proto",
"packed_encoding.proto",
"person.proto",
"redacted_one_of.proto",
"redacted_test.proto",
"same_name_enum.proto",
"simple_message.proto",
"to_string.proto",
"unknown_fields.proto",
"uses_any.proto"
)
}
val generateKotlinBuildersOnlyTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin builders only classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"--kotlin_builders_only",
"redacted_test_builders_only.proto",
"simple_message_builders_only.proto",
)
}
val generateKotlinZipTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test jar"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin/protos.jar",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"squareup/geology/period.proto",
"squareup/dinosaurs/dinosaur.proto"
)
}
val generateKotlinEscapeKeywordsTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from protos containing fields whose names clash with Kotlin keywords"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"--kotlin_escape_keywords",
"keyword_kotlin.proto",
)
}
// KOTLIN PROTO3
val generateProto3KotlinTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test proto3s"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto3/kotlin",
"--kotlin_out=wire-tests/src/commonTest/proto-kotlin",
"all_types.proto",
"person.proto"
)
}
// Java PROTO3
val generateProto3JavaTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test proto3s"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto3/java",
"--java_out=wire-tests/src/jvmJavaTest/proto-java",
"all_types.proto",
"person.proto"
)
}
// KOTLIN SERVICES
val generateKotlinServicesTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
"service_kotlin.proto",
"service_without_package.proto",
)
}
val generateKotlinServicesAllFlagsTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes from the test protos with all flags"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--no_kotlin_exclusive",
"--kotlin_rpc_call_style=blocking",
"--kotlin_rpc_role=server",
"--kotlin_single_method_services",
"--kotlin_name_suffix=SomeSuffix",
"--kotlin_builders_only",
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
"service_kotlin_with_all_flags.proto",
)
}
// KOTLIN EMIT_PROTO_READER_32
val generateProtoReader32KotlinTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes that use emit_proto_reader_32"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmKotlinProtoReader32Test/proto-kotlin",
"--emit_proto_reader_32",
"all_types.proto",
)
}
// KOTLIN ANDROID
val generateKotlinAndroidTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes for Android from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmKotlinAndroidTest/proto-kotlin",
"--android",
"person.proto"
)
}
// KOTLIN JAVA INTEROP
val generateKotlinJavaInteropTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates Kotlin classes with Java interop from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--kotlin_out=wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
"--java_interop",
"--kotlin_box_oneofs_min_size=8",
"all_types.proto",
"deprecated.proto",
"custom_options.proto",
"easter.proto",
"external_message.proto",
"foreign.proto",
"form.proto",
"map.proto",
"no_fields.proto",
"one_of.proto",
"option_redacted.proto",
"packed_encoding.proto",
"percents_in_kdoc.proto",
"person.proto",
"recursive_map.proto",
"redacted_one_of.proto",
"repeated.proto",
"same_name_enum.proto",
"simple_message.proto",
"unknown_fields.proto",
"uses_any.proto"
)
}
// ONE JAVA CLASS WHICH WILL BE USING A KOTLIN OPTION
val generateJavaForKotlinJavaInteropTests by tasks.creating(JavaExec::class) {
group = "Generate Tests"
description = "Generates one Java class which will depend on a Kotlin generated annotation"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/java",
"--java_out=wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
"depend_on_kotlin_option.proto"
)
}
// SWIFT
val generateSwiftProto3Tests by tasks.creating(JavaExec::class) {
val swiftOut = "wire-tests-proto3-swift/src/main/swift/"
doFirst {
val outFile = file(swiftOut)
outFile.deleteRecursively()
outFile.mkdir()
}
group = "Generate Tests"
description = "Generates Swift classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto3/kotlin",
"--swift_out=$swiftOut",
"contains_duration.proto",
"contains_timestamp.proto"
)
}
val generateSwiftProto2ManifestTests by tasks.creating(JavaExec::class) {
val swiftOut = "wire-tests-swift/manifest"
group = "Generate Tests"
description = "Generates Swift classes from the test protos using a manifest"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--swift_out=$swiftOut",
"--experimental-module-manifest=wire-tests/src/commonTest/proto/kotlin/swift_modules_manifest.yaml",
"swift_module_one.proto",
"swift_module_two.proto",
"swift_module_three.proto",
)
}
val generateSwiftProto2Tests by tasks.creating(JavaExec::class) {
val swiftOut = "wire-tests-swift/no-manifest/src/main/swift"
doFirst {
val outFile = file(swiftOut)
outFile.deleteRecursively()
outFile.mkdir()
}
group = "Generate Tests"
description = "Generates Swift classes from the test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/proto/kotlin",
"--swift_out=$swiftOut",
"all_types.proto",
"custom_options.proto",
"deprecated.proto",
"deprecated_enum.proto",
"external_message.proto",
"foreign.proto",
"form.proto",
"map.proto",
"negative_value_enum.proto",
"no_fields.proto",
"one_of.proto",
"option_redacted.proto",
"optional_enum.proto",
"packed_encoding.proto",
"percents_in_kdoc.proto",
"person.proto",
"redacted_one_of.proto",
"recursive_map.proto",
"same_name_enum.proto",
"swift_edge_cases.proto",
"to_string.proto",
"unknown_fields.proto"
)
}
val generateSwiftTests by tasks.creating {
group = "Generate Tests"
description = "Generates Swift classes from the test protos"
if (project.properties.get("swift") != "false") {
dependsOn(
generateSwiftProto2ManifestTests,
generateSwiftProto2Tests,
generateSwiftProto3Tests,
":wire-runtime-swift:generateTestProtos"
)
}
}
// GRPC
val grpcProtosDir = "${rootProject.rootDir}/wire-grpc-tests/src/test/proto".toPath()
val GRPC_PROTOS = fileSystem.listRecursively(grpcProtosDir)
.filter { fileSystem.metadata(it).isRegularFile }
.map { it.relativeTo(grpcProtosDir).toString() }
.filter { !it.startsWith("kotlin") && it.endsWith(".proto") }
.sorted()
.toList()
val generateGrpcTests by tasks.creating(JavaExec::class) {
group = "Generate gRPC Tests"
description = "Generates Kotlin classes from the gRPC test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-grpc-tests/src/test/proto",
"--kotlin_out=wire-grpc-tests/src/test/proto-grpc",
"routeguide/RouteGuideProto.proto"
) + GRPC_PROTOS
}
// Moshi Adapter
val generateMoshiAdapterCompactJavaTests by tasks.creating(JavaExec::class) {
group = "Generate MoshiAdapter Compact Java Tests"
description = "Generates compat Java classes from the MoshiAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--java_out=wire-moshi-adapter/src/test/java",
"--compact",
"all_types_proto2.proto"
)
}
val generateMoshiAdapterJavaTests by tasks.creating(JavaExec::class) {
group = "Generate MoshiAdapter Java Tests"
description = "Generates Java classes from the MoshiAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--java_out=wire-moshi-adapter/src/test/java",
"collection_types.proto",
"person_java.proto",
"dinosaur_java.proto",
"period_java.proto",
"keyword_java.proto"
)
}
val generateMoshiAdapterInteropKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate MoshiAdapter Java interop Kotlin Tests"
description = "Generates Java interop Kotlin classes from the MoshiAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--kotlin_out=wire-moshi-adapter/src/test/java",
"--java_interop",
"person_java_interop_kotlin.proto",
"dinosaur_java_interop_kotlin.proto",
"period_java_interop_kotlin.proto",
"keyword_kotlin.proto"
)
}
val generateMoshiAdapterKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate MoshiAdapter Kotlin Tests"
description = "Generates Kotlin classes from the MoshiAdapter test protos"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--kotlin_out=wire-moshi-adapter/src/test/java",
"all_structs.proto",
"person_kotlin.proto",
"dinosaur_kotlin.proto",
"period_kotlin.proto",
"getters_kotlin.proto",
"pizza.proto",
)
}
val generateMoshiTests by tasks.creating {
group = "Generate Tests"
description = "Generates Java and Kotlin classes that use Moshi from the test protos"
dependsOn(
generateMoshiAdapterCompactJavaTests,
generateMoshiAdapterJavaTests,
generateMoshiAdapterInteropKotlinTests,
generateMoshiAdapterKotlinTests
)
}
// Shared Json tests.
val generateSharedJsonCompactJavaTests by tasks.creating(JavaExec::class) {
group = "Generate Shared JSON Tests"
description = "Generates compat Java classes for shared JSON tests"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--java_out=wire-tests/src/jvmJsonJavaTest/proto-java",
"--compact",
"all32.proto",
"all64.proto",
"all_types_proto2.proto",
"all_types_proto3_test_proto3_optional.proto",
"all_structs.proto",
"all_wrappers.proto",
"camel_case.proto",
"map_types.proto",
"pizza.proto"
)
}
val generateSharedJsonKotlinTests by tasks.creating(JavaExec::class) {
group = "Generate Shared JSON Tests"
description = "Generates Kotlin classes for shared JSON tests"
classpath = wire
mainClass.set("com.squareup.wire.WireCompiler")
args = listOf(
"--proto_path=wire-tests/src/commonTest/shared/proto/proto2",
"--proto_path=wire-tests/src/commonTest/shared/proto/proto3",
"--kotlin_out=wire-tests/src/jvmJsonKotlinTest/proto-kotlin",
"--java_interop",
"all32.proto",
"all64.proto",
"all_types_proto2.proto",
"all_types_proto3_test_proto3_optional.proto",
"all_structs.proto",
"all_wrappers.proto",
"camel_case.proto",
"map_types.proto",
"pizza.proto"
)
}
val generateSharedJson by tasks.creating {
group = "Generate Tests"
description = "Generates Java and Kotlin classes for shared JSON tests"
dependsOn(
generateSharedJsonCompactJavaTests,
generateSharedJsonKotlinTests
)
}
val generateTests by tasks.creating {
group = "Generate Tests"
description = "Generates all test classes"
dependsOn(
"wire-golden-files:generateProtos",
generateJavaTests,
generateCompactTests,
generateNoOptionsTests,
generateGsonTests,
generateIncludesExcludesTests,
generateAndroidTests,
generateAndroidCompactTests,
generateKotlinTests,
generateKotlinBuildersOnlyTests,
generateKotlinZipTests,
generateKotlinEscapeKeywordsTests,
generateKotlinServicesTests,
generateKotlinServicesAllFlagsTests,
generateKotlinAndroidTests,
generateKotlinJavaInteropTests,
generateJavaForKotlinJavaInteropTests,
generateSwiftTests,
generateGrpcTests,
generateMoshiTests,
generateProto3KotlinTests,
generateProto3JavaTests,
generateProtoReader32KotlinTests,
generateSharedJson,
generateOpaqueTypeTests,
)
}
val cleanGeneratedTests by tasks.creating(Delete::class) {
group = "Generate Tests"
description = "Delete all generated tests"
delete(
"wire-grpc-tests/src/test/proto-grpc",
"wire-gson-support/src/test/java/com/squareup/wire/protos",
"wire-gson-support/src/test/java/squareup/proto2/keywords/",
"wire-moshi-adapter/src/test/java/com/squareup/wire/protos",
"wire-moshi-adapter/src/test/java/squareup/proto2/keywords/",
"wire-tests/src/commonTest/proto-java",
"wire-tests/src/commonTest/proto-kotlin",
"wire-tests/src/jvmJavaAndroidCompactTest/proto-java",
"wire-tests/src/jvmJavaAndroidTest/proto-java",
"wire-tests/src/jvmJavaCompactTest/proto-java",
"wire-tests/src/jvmJavaNoOptionsTest/proto-java",
"wire-tests/src/jvmJavaPrunedTest/proto-java",
"wire-tests/src/jvmJavaTest/proto-java",
"wire-tests/src/jvmKotlinAndroidTest/proto-kotlin",
"wire-tests/src/jvmKotlinInteropTest/proto-kotlin",
"wire-tests/src/jvmKotlinProtoReader32Test/proto-kotlin",
"wire-tests/src/jvmJsonJavaTest/proto-java",
"wire-tests/src/jvmJsonKotlinTest/proto-kotlin"
)
}