Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,21 @@ script:
- cd build
- cmake --build . --target install
- cd ..
- cp VERSION VERSION.SAVED
- echo "" >> VERSION
- echo "VERSION_PATCH = \"GitHub_MasterBranch\"" >> VERSION
- cd build
- cmake -D FILTER_PROTO2CPP_PY_PATH=${DEPS_DIR}/proto2cpp ..
- doxygen
- cd ..
- python test_cases_doc.py
- mv VERSION.SAVED VERSION
- sh convert-to-proto3.sh
- mkdir -p build3
- cd build3
- cmake -D CMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..
- cmake --build .
- cd ..

# Deploy the documentation on github (only for master branch).
deploy:
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ The compatibility of both recorded files and code remains.
- Clarification of text passages explaining the message content


Proto3 Support
--------------

For users that need to use proto3 syntax, for example because the language
binding of choice only supports proto3 syntax out of the box, a shell script
called `convert-to-proto3.sh` is supplied that converts all proto files to
proto3 syntax. If this is run prior to building, the resulting libaries will
use proto3, with the on-the-wire format remaining compatible between proto2
and proto3 libraries.

Packaging
---------

Expand Down
19 changes: 19 additions & 0 deletions convert-to-proto3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# This shell script converts all proto files to proto3 syntax, which can
# then be used as a stand in for the proto2 syntax files. The resulting
# on-the-wire format should be compatible with the proto2-based formats
# in all respects.
#
# Call this script prior to building normally if you want/need to use
# proto3 syntax, e.g. for language bindings that do not support proto2,
# like C#.

test -f osi_version.proto && rm osi_version.proto

for f in osi_version.proto.in osi_*.proto
do
mv $f $f.pb2 && sed -e 's/syntax *= *"proto2";/syntax = "proto3";/' -e 's/^\([ \t]*\)optional /\1/' $f.pb2 > $f
done

mv CMakeLists.txt CMakeLists.txt.pb2 && sed -e 's/find_package(Protobuf 2.6.1 REQUIRED)/find_package(Protobuf 3.0.0 REQUIRED)/' CMakeLists.txt.pb2 > CMakeLists.txt