3 #####################################################################################################
4 #Instructions on generating the protocol buffer Java source files
6 #These instructions are developers who are planning to generate the protocolbuffer java source files.
8 #1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
9 #The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
12 #2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
15 #3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
16 # get generation in proper packages. For more information check
17 # https://developers.google.com/protocol-buffers/docs/javatutorial
19 # For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
21 #4. To generate the java source files execute in sal-protocolbuffer-encoding execute ./run.sh i.e. this script
23 # protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
25 #5. Run mvn clean install & build the .jar
27 #6 !!!WARNING!!!! never edit the source files generated
29 #7. !!!NOTE!!! if you are planning to add new .proto file option java_package should begin with
30 # org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
31 ########################################################################################################
33 protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
35 echo "Done generating Java source files."
37 #to remove trailing spaces in the code files
38 find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
40 #to remove trailing spaces in the generated code on OSX
41 find src/main/java -type f -print0 |xargs -0 perl -pi -e 's/ +$//'