Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opensourcing kotlin protos #8272

Merged
merged 32 commits into from Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4f829fb
Copying in kotlin proto specific files
deannagarcia Feb 9, 2021
887462a
Fixing some of the kokoro tests
deannagarcia Feb 9, 2021
8399bb8
Fixing more kokoro tests
deannagarcia Feb 9, 2021
f25ca77
Make kotlin a top-level directory
deannagarcia Feb 9, 2021
be2f000
Adding most recent work
deannagarcia Mar 10, 2021
73e0e7a
Removing target folder
deannagarcia Mar 15, 2021
eef2418
Adding most recent work
deannagarcia Mar 18, 2021
751d05c
Fixing core ExtendableMessageExtension
deannagarcia Mar 20, 2021
1949746
Commit with --kotlin_out working
deannagarcia Mar 23, 2021
87faccd
Merge branch 'master' into kotlinProtos
deannagarcia Mar 23, 2021
e263c7e
Updating the makefile with new files
deannagarcia Mar 23, 2021
6f5c6eb
Merge branch 'kotlinProtos' of https://github.com/deannagarcia/protob…
deannagarcia Mar 23, 2021
0454655
updating typo in makefile
deannagarcia Mar 23, 2021
2c9aca5
Adding another file to the makefile
deannagarcia Mar 23, 2021
438d777
Adding file names to cmake files
deannagarcia Mar 24, 2021
726241f
Changing structure to have kotlin submodules
deannagarcia Mar 30, 2021
30355ff
Fixing build
deannagarcia Mar 30, 2021
b0acba3
cleaning up
deannagarcia Mar 31, 2021
9aaaf70
updating makefile
deannagarcia Mar 31, 2021
74a32c0
fixing kokoro tests
deannagarcia Mar 31, 2021
a088736
Adding OptIn to the allow list for spell check
deannagarcia Mar 31, 2021
043935b
Fixing codespell allow list
deannagarcia Mar 31, 2021
4a82094
Reversing codespell changes
deannagarcia Mar 31, 2021
7b23ae1
Merge remote-tracking branch 'remotes/upstream/master' into kotlinProtos
deannagarcia Apr 1, 2021
610fc63
Adding opt to codespell instead of OptIn
deannagarcia Apr 1, 2021
7c3b28d
Trying optin in codespell
deannagarcia Apr 1, 2021
50592a5
Making dependency on java proto instead of copying files and generati…
deannagarcia Apr 2, 2021
e844a53
Merge branch 'master' into kotlinProtos
deannagarcia Apr 6, 2021
a250d3f
Restrict extension setter and getter operations to non-nullable T
deannagarcia Apr 12, 2021
1b637aa
Merge branch 'kotlinProtos' of https://github.com/deannagarcia/protob…
deannagarcia Apr 12, 2021
1c81c89
Add the codespell file to list of files not checked by codespell
deannagarcia Apr 12, 2021
f650807
Adding note to the README about kotlin protos
deannagarcia Apr 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codespell.yml
Expand Up @@ -12,5 +12,5 @@ jobs:
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./.github/workflows/codespell.yml
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,OptIn"
skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./github/workflows/codespell.yml
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed? I think this made its way into a different PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that the spell check has to have the lowercase version, so this is the fix to the other PR.

1 change: 1 addition & 0 deletions BUILD
Expand Up @@ -401,6 +401,7 @@ cc_library(
"src/google/protobuf/compiler/java/java_generator.cc",
"src/google/protobuf/compiler/java/java_generator_factory.cc",
"src/google/protobuf/compiler/java/java_helpers.cc",
"src/google/protobuf/compiler/java/java_kotlin_generator.cc",
"src/google/protobuf/compiler/java/java_map_field.cc",
"src/google/protobuf/compiler/java/java_map_field_lite.cc",
"src/google/protobuf/compiler/java/java_message.cc",
Expand Down
29 changes: 29 additions & 0 deletions Makefile.am
Expand Up @@ -530,6 +530,35 @@ java_EXTRA_DIST=
java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \
java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \
java/core/src/test/proto/com/google/protobuf/wrappers_test.proto \
java/kotlin/generate-sources-build.xml \
java/kotlin/generate-test-sources-build.xml \
java/kotlin/pom.xml \
java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\
java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\
java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt \
java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto \
java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto \
java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto \
java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto \
java/kotlin-lite/generate-sources-build.xml \
java/kotlin-lite/generate-test-sources-build.xml \
java/kotlin-lite/lite.awk \
java/kotlin-lite/pom.xml \
java/kotlin-lite/process-lite-sources-build.xml \
java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt\
java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt \
java/lite.md \
java/lite/BUILD \
java/lite/generate-sources-build.xml \
Expand Down
1 change: 1 addition & 0 deletions cmake/extract_includes.bat.in
Expand Up @@ -26,6 +26,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\cshar
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h
Expand Down
1 change: 1 addition & 0 deletions cmake/libprotoc.cmake
Expand Up @@ -44,6 +44,7 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
Expand Down
5 changes: 5 additions & 0 deletions java/README.md
Expand Up @@ -178,3 +178,8 @@ The complete documentation for Protocol Buffers is available via the
web at:

https://developers.google.com/protocol-buffers/

## Kotlin Protocol Buffers

Code to support more idiomatic Kotlin protocol buffers has been added to the
repository, and Kotlin support will be launched in the next numbered release.
19 changes: 19 additions & 0 deletions java/kotlin-lite/generate-sources-build.xml
@@ -0,0 +1,19 @@
<project name="generate-sources">
<echo message="Running protoc ..."/>
<mkdir dir="${generated.sources.dir}"/>
<exec executable="${protoc}">
<arg value="--kotlin_out=lite:${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/source_context.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/struct.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/timestamp.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/type.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/wrappers.proto"/>
</exec>
</project>

34 changes: 34 additions & 0 deletions java/kotlin-lite/generate-test-sources-build.xml
@@ -0,0 +1,34 @@
<project name="generate-test-sources">
<mkdir dir="${generated.testsources.dir}"/>
<exec executable="${protoc}">
<arg value="--java_out=lite:${generated.testsources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.basedir}/java/kotlin/${test.proto.dir}"/>
<arg value="--experimental_allow_proto3_optional"/>
<arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public_lite.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/example_extensible_message.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
</exec>
<exec executable="${protoc}">
<arg value="--kotlin_out=lite:${generated.testsources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.basedir}/java/kotlin/${test.proto.dir}"/>
<arg value="--experimental_allow_proto3_optional"/>
<arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/example_extensible_message.proto"/>
<arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
</exec>
</project>
25 changes: 25 additions & 0 deletions java/kotlin-lite/lite.awk
@@ -0,0 +1,25 @@
# Remove code enclosed by "BEGIN FULL-RUNTIME" and "END FULL-RUNTIME" to
# create the lite-only version of a test file.

BEGIN {
in_full_runtime = 0;
}

/BEGIN FULL-RUNTIME/ {
in_full_runtime = 1;
next;
}

/END FULL-RUNTIME/ {
in_full_runtime = 0;
next;
}

in_full_runtime {
# Skip full runtime code path.
next;
}

{
print;
}