Skip to content

Commit 0d460d8

Browse files
kotlin support (#312)
1 parent 2e6a29b commit 0d460d8

52 files changed

Lines changed: 3975 additions & 28 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-java.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ on:
1010
jobs:
1111
build-and-test-java:
1212
name: Build, Test
13-
runs-on: ${{ matrix.os[0] }}
13+
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ ubuntu-latest, windows-latest, macos-10.15 ]
17+
os: [ ubuntu-latest, windows-latest] # , macos-latest ] - disabled due to interesting macos issues
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -47,7 +47,7 @@ jobs:
4747
if: always()
4848
uses: actions/upload-artifact@v2
4949
with:
50-
name: Java Unit Test Results (${{ matrix.os[0] }})
50+
name: Java Unit Test Results (${{ matrix.os }})
5151
path: 'java/build/test-results/test/TEST-*.xml'
5252

5353
publish-test-results-java:

devops/generate_proto_files.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ def update_ruby():
7878
def update_java():
7979
java_path = get_language_dir('java')
8080
java_proto_path = join(java_path, 'src', 'main', 'java')
81-
# TODO - clean_proto_dir(java_proto_path)
82-
run_protoc({'java_out': java_proto_path}, {}, get_proto_files(),
83-
plugin=r"C:\bin\protoc-gen-grpc-java-1.39.0-windows-x86_64.exe")
84-
# remove okapi pbmse
85-
shutil.rmtree(join(java_proto_path, 'trinsic', 'okapi'))
81+
# clean_proto_dir(java_proto_path)
82+
run_protoc({'java_out': java_proto_path, 'kotlin_out': java_proto_path}, {}, get_proto_files(),
83+
plugin=r"C:\bin\\protoc-gen-grpc-java-1.39.0-windows-x86_64.exe")
8684

8785

8886
def update_swift():
@@ -98,12 +96,11 @@ def update_python():
9896
:return:
9997
"""
10098
# Remove everything under output directory
101-
python_proto_path = join(get_language_dir('python'), "proto")
99+
python_proto_path = join(get_language_dir('python'), 'trinsicokapi', "proto")
102100
clean_proto_dir(python_proto_path)
103101
# Paths for proto compilation
104102
file_path = abspath(dirname(abspath(__file__)))
105103
base_path = abspath(join(file_path, '..', 'proto'))
106-
proto_file_path = abspath(join(base_path, "**", "*.proto"))
107104
# Come up with better locations, import google defaults from the package location (see code in protoc.main)
108105
proto_include = pkg_resources.resource_filename('grpc_tools', '_proto').replace("lib", "Lib")
109106
# Inject an empty python code file path to mimic the first argument.
@@ -117,7 +114,7 @@ def main():
117114
update_golang()
118115
update_ruby()
119116
update_java()
120-
update_swift()
117+
# update_swift()
121118
update_python()
122119

123120

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//Generated by the protocol buffer compiler. DO NOT EDIT!
2+
// source: okapi/examples/v1/examples.proto
3+
4+
package trinsic.okapi.examples.v1;
5+
6+
@kotlin.jvm.JvmSynthetic
7+
inline fun basicMessage(block: trinsic.okapi.examples.v1.BasicMessageKt.Dsl.() -> Unit): trinsic.okapi.examples.v1.Examples.BasicMessage =
8+
trinsic.okapi.examples.v1.BasicMessageKt.Dsl._create(trinsic.okapi.examples.v1.Examples.BasicMessage.newBuilder()).apply { block() }._build()
9+
object BasicMessageKt {
10+
@kotlin.OptIn(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)
11+
@com.google.protobuf.kotlin.ProtoDslMarker
12+
class Dsl private constructor(
13+
@kotlin.jvm.JvmField private val _builder: trinsic.okapi.examples.v1.Examples.BasicMessage.Builder
14+
) {
15+
companion object {
16+
@kotlin.jvm.JvmSynthetic
17+
@kotlin.PublishedApi
18+
internal fun _create(builder: trinsic.okapi.examples.v1.Examples.BasicMessage.Builder): Dsl = Dsl(builder)
19+
}
20+
21+
@kotlin.jvm.JvmSynthetic
22+
@kotlin.PublishedApi
23+
internal fun _build(): trinsic.okapi.examples.v1.Examples.BasicMessage = _builder.build()
24+
25+
/**
26+
* <code>string text = 1;</code>
27+
*/
28+
var text: kotlin.String
29+
@JvmName("getText")
30+
get() = _builder.getText()
31+
@JvmName("setText")
32+
set(value) {
33+
_builder.setText(value)
34+
}
35+
/**
36+
* <code>string text = 1;</code>
37+
*/
38+
fun clearText() {
39+
_builder.clearText()
40+
}
41+
}
42+
}
43+
@kotlin.jvm.JvmSynthetic
44+
inline fun trinsic.okapi.examples.v1.Examples.BasicMessage.copy(block: trinsic.okapi.examples.v1.BasicMessageKt.Dsl.() -> Unit): trinsic.okapi.examples.v1.Examples.BasicMessage =
45+
trinsic.okapi.examples.v1.BasicMessageKt.Dsl._create(this.toBuilder()).apply { block() }._build()

0 commit comments

Comments
 (0)