diff options
author | xengineering <me@xengineering.eu> | 2024-05-28 19:35:35 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-05-28 20:28:46 +0200 |
commit | eab833271eeaa8d54991c11eccec9445f662a191 (patch) | |
tree | 6919587874959daa53e58d34a172988fcea68570 | |
parent | e6b74069e18736e6f2d3acb14c18013a7bd4c464 (diff) | |
download | iot-core-eab833271eeaa8d54991c11eccec9445f662a191.tar iot-core-eab833271eeaa8d54991c11eccec9445f662a191.tar.zst iot-core-eab833271eeaa8d54991c11eccec9445f662a191.zip |
scripts: Add folder and generate.sh
This allows generating Golang source code based on iot-protocol protobuf
definitions.
-rwxr-xr-x | scripts/generate.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/generate.sh b/scripts/generate.sh new file mode 100755 index 0000000..f549880 --- /dev/null +++ b/scripts/generate.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +PROTOC_GO_PLUGIN="google.golang.org/protobuf/cmd/protoc-gen-go@latest" + +script="$(realpath "$0")" +scripts="$(dirname "$script")" +iot_core="$(dirname "$scripts")" +proto="${iot_core}/iot-protocol/proto" +software="${iot_core}/software" +go_binaries="${HOME}/go/bin" + +generate_go_code() { + go install "$PROTOC_GO_PLUGIN" + export PATH="${PATH}:${go_binaries}" + protoc --proto_path="$proto" --go_out="$software" discovery.proto +} + +generate_go_code |