File tree Expand file tree Collapse file tree 8 files changed +61
-6
lines changed
gradle-plugin/src/main/kotlin/kotlinx/rpc/proto
commonMain/kotlin/kotlinx/rpc/grpc/pb
jvmMain/kotlin/kotlinx/rpc/grpc/pb
nativeMain/kotlin/kotlinx/rpc/grpc/pb Expand file tree Collapse file tree 8 files changed +61
-6
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,11 @@ internal fun Project.createProtoExtensions() {
9898 project.withKotlinKmpExtension {
9999 findOrCreateAndConfigure(" jvmMain" , null )
100100 findOrCreateAndConfigure(" jvmTest" , null )
101+ findOrCreateAndConfigure(" commonMain" , null )
102+ findOrCreateAndConfigure(" commonTest" , null )
101103
102104 sourceSets.configureEach {
103- if (name == " jvmMain" || name == " jvmTest" || name == " nativeTest " || name == " commonTest" ) {
105+ if (name == " jvmMain" || name == " jvmTest" || name == " commonMain " || name == " commonTest" ) {
104106 findOrCreateAndConfigure(name, this )
105107 }
106108 }
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ protoSourceSets {
139139 }
140140 }
141141
142- configureEach {
142+ commonTest {
143143 proto {
144144 exclude(" exclude/**" )
145145 }
@@ -163,7 +163,7 @@ rpc {
163163 // Set compile for common(native) option
164164 if (name.endsWith(" CommonTest" )) {
165165 protocPlugins.kotlinMultiplatform {
166- options.set(options.getOrElse(emptyMap()) + mapOf ( " targetMode" to " common" ) )
166+ options.put( " targetMode" , " common" )
167167 }
168168 }
169169
Original file line number Diff line number Diff line change 44
55package kotlinx.rpc.grpc.pb
66
7+ import kotlinx.rpc.internal.utils.InternalRpcApi
8+
9+ @InternalRpcApi
710public enum class WireType {
811 VARINT , // 0
912 FIXED64 , // 1
@@ -13,6 +16,7 @@ public enum class WireType {
1316 FIXED32 , // 5
1417}
1518
19+ @InternalRpcApi
1620public data class KTag (val fieldNr : Int , val wireType : WireType ) {
1721
1822 init {
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public interface WireDecoder : AutoCloseable {
4242 public fun hadError (): Boolean
4343
4444 /* *
45- * When the read tag is null, it indicates EOF and the parse may stop at this point.
45+ * When the read tag is null, it indicates EOF and the parser may stop at this point.
4646 */
4747 public fun readTag (): KTag ?
4848 public fun readBool (): Boolean
Original file line number Diff line number Diff line change 44
55package kotlinx.rpc.grpc.pb
66
7+ import kotlinx.rpc.internal.utils.InternalRpcApi
8+
9+ @InternalRpcApi
710public object WireSize
811
12+ @InternalRpcApi
913public expect fun WireSize.int32 (value : Int ): Int
14+
15+ @InternalRpcApi
1016public expect fun WireSize.int64 (value : Long ): Int
17+
18+ @InternalRpcApi
1119public expect fun WireSize.uInt32 (value : UInt ): Int
20+
21+ @InternalRpcApi
1222public expect fun WireSize.uInt64 (value : ULong ): Int
23+
24+ @InternalRpcApi
1325public expect fun WireSize.sInt32 (value : Int ): Int
26+
27+ @InternalRpcApi
1428public expect fun WireSize.sInt64 (value : Long ): Int
1529
30+ @InternalRpcApi
1631public fun WireSize.bool (value : Boolean ): Int = int32(if (value) 1 else 0 )
32+
33+ @InternalRpcApi
1734public fun WireSize.enum (value : Int ): Int = int32(value)
35+
36+ @InternalRpcApi
1837public fun WireSize.packedInt32 (value : List <Int >): Int = value.sumOf { int32(it) }
38+
39+ @InternalRpcApi
1940public fun WireSize.packedInt64 (value : List <Long >): Int = value.sumOf { int64(it) }
41+
42+ @InternalRpcApi
2043public fun WireSize.packedUInt32 (value : List <UInt >): Int = value.sumOf { uInt32(it) }
44+
45+ @InternalRpcApi
2146public fun WireSize.packedUInt64 (value : List <ULong >): Int = value.sumOf { uInt64(it) }
47+
48+ @InternalRpcApi
2249public fun WireSize.packedSInt32 (value : List <Int >): Int = value.sumOf { sInt32(it) }
50+
51+ @InternalRpcApi
2352public fun WireSize.packedSInt64 (value : List <Long >): Int = value.sumOf { sInt64(it) }
53+
54+ @InternalRpcApi
2455public fun WireSize.packedEnum (value : List <Int >): Int = value.sumOf { enum(it) }
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ syntax = "proto3";
22
33package kotlinx.rpc.grpc.test.common ;
44
5- //import 'reference_package.proto';
6-
75message RepeatedCommon {
86 repeated fixed32 listFixed32 = 1 [packed = true ];
97 repeated int32 listInt32 = 2 [packed = false ];
Original file line number Diff line number Diff line change 55package kotlinx.rpc.grpc.pb
66
77import com.google.protobuf.CodedOutputStream.*
8+ import kotlinx.rpc.internal.utils.InternalRpcApi
89
10+ @InternalRpcApi
911public actual fun WireSize.int32 (value : Int ): Int {
1012 return computeInt32SizeNoTag(value)
1113}
1214
15+ @InternalRpcApi
1316public actual fun WireSize.int64 (value : Long ): Int {
1417 return computeInt64SizeNoTag(value)
1518}
1619
20+ @InternalRpcApi
1721public actual fun WireSize.uInt32 (value : UInt ): Int {
1822 // todo check java unsigned types
1923 return computeUInt32SizeNoTag(value.toInt())
2024}
2125
26+ @InternalRpcApi
2227public actual fun WireSize.uInt64 (value : ULong ): Int {
2328 // todo check java unsigned types
2429 return computeUInt64SizeNoTag(value.toLong())
2530}
2631
32+ @InternalRpcApi
2733public actual fun WireSize.sInt32 (value : Int ): Int {
2834 return computeSInt32SizeNoTag(value)
2935}
3036
37+ @InternalRpcApi
3138public actual fun WireSize.sInt64 (value : Long ): Int {
3239 return computeSInt64SizeNoTag(value)
3340}
Original file line number Diff line number Diff line change 77package kotlinx.rpc.grpc.pb
88
99import kotlinx.cinterop.ExperimentalForeignApi
10+ import kotlinx.rpc.internal.utils.InternalRpcApi
1011import libprotowire.*
1112
13+ @InternalRpcApi
1214public actual fun WireSize.int32 (value : Int ): Int = pw_size_int32(value).toInt()
15+
16+ @InternalRpcApi
1317public actual fun WireSize.int64 (value : Long ): Int = pw_size_int64(value).toInt()
18+
19+ @InternalRpcApi
1420public actual fun WireSize.uInt32 (value : UInt ): Int = pw_size_uint32(value).toInt()
21+
22+ @InternalRpcApi
1523public actual fun WireSize.uInt64 (value : ULong ): Int = pw_size_uint64(value).toInt()
24+
25+ @InternalRpcApi
1626public actual fun WireSize.sInt32 (value : Int ): Int = pw_size_sint32(value).toInt()
27+
28+ @InternalRpcApi
1729public actual fun WireSize.sInt64 (value : Long ): Int = pw_size_sint64(value).toInt()
1830
31+
You can’t perform that action at this time.
0 commit comments