File tree Expand file tree Collapse file tree 3 files changed +46
-26
lines changed
Expand file tree Collapse file tree 3 files changed +46
-26
lines changed Original file line number Diff line number Diff line change 11# Copyright 2023 SECO Mind Srl
22# SPDX-License-Identifier: Apache-2.0
33
4- .PHONY =clean
4+ .PHONY : check all
55
6- FILES =$(wildcard proto/edgehog/device/forwarder/* .proto)
7- OUTPUT =rust/edgehog-device-forwarder-proto/src/proto.rs
8- CODEGEN_SCRIPT =./scripts/codegen.sh
6+ PROTO_DIR =proto
7+ PROTO_FILES =$(wildcard $(PROTO_DIR ) /edgehog/device/forwarder/* .proto)
8+ export PROTO_DIR
9+ export PROTO_FILES
910
10- $(OUTPUT ) : $(FILES ) $(CODEGEN_SCRIPT )
11- $(CODEGEN_SCRIPT )
11+ # Rust
12+ RUST_OUT_DIR =rust/edgehog-device-forwarder-proto/src
13+ RUST_OUTPUT =$(RUST_OUT_DIR ) /proto.rs
1214
13- clean :
14- rm -vr out/
15+ all : check $(RUST_OUTPUT )
16+
17+ check :
18+ ./scripts/check-dependencies.sh
19+
20+ $(RUST_OUTPUT ) : $(PROTO_FILES )
21+ cargo run --manifest-path rust/Cargo.toml -p rust-codegen -- -w proto -o $(RUST_OUT_DIR )
22+ mv $(RUST_OUT_DIR ) /edgehog.device.forwarder.rs $(RUST_OUTPUT )
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Copyright 2023 SECO Mind Srl
4+ # SPDX-License-Identifier: Apache-2.0
5+
6+ set -exu
7+
8+ REQUIRED_PROTOC_MAJOR=" 24"
9+
10+ # check only major version of protoc
11+ PROTOC_MAJOR=$( command -v protoc > /dev/null &&
12+ protoc --version | cut -d ' ' -f 2 | cut -d . -f 1 ||
13+ true)
14+
15+ if [ " $PROTOC_MAJOR " != " $REQUIRED_PROTOC_MAJOR " ]; then
16+ echo " incompatible protoc version: found \" $PROTOC_MAJOR \" , expected \" $PROTOC_MAJOR \" " >&2
17+ exit 1
18+ fi
19+
20+ if ! command -v protoc-gen-elixir > /dev/null
21+ then
22+ echo ' protoc-gen-elixir not found in PATH'
23+ exit 1
24+ fi
25+
26+ if ! command -v escript > /dev/null
27+ then
28+ echo ' escript not found in PATH'
29+ exit 1
30+ fi
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments