From eab833271eeaa8d54991c11eccec9445f662a191 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 28 May 2024 19:35:35 +0200 Subject: scripts: Add folder and generate.sh This allows generating Golang source code based on iot-protocol protobuf definitions. --- scripts/generate.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/generate.sh 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 -- cgit v1.2.3-70-g09d2