api: Build rust code in nix-shell.

This commit is contained in:
Orne Brocaar 2024-04-01 12:36:23 +01:00
parent 9453ab7e00
commit c3f463da4e
7 changed files with 9 additions and 1258 deletions

4
Cargo.lock generated
View File

@ -4577,9 +4577,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.36.0"
version = "1.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
dependencies = [
"backtrace",
"bytes",

View File

@ -58,7 +58,7 @@ docker-devshell-ui:
# Runs the tests
test:
cd api && make
cd api && make rust
cd backend && cargo test
cd chirpstack && make test
cd lrwn && make test
@ -66,7 +66,7 @@ test:
# Runs all the tests (including some that normally are ignored)
test-all:
cd api && make
cd api && make rust
cd backend && cargo test
cd chirpstack && make test-all
cd chirpstack-integration && cargo test

13
api/Dockerfile-rust vendored
View File

@ -1,13 +0,0 @@
FROM rust:1.73
ENV PROJECT_PATH=/chirpstack/api
RUN apt-get update && \
apt-get install -y make cmake git bash protobuf-compiler && \
apt-get clean
RUN git clone https://github.com/googleapis/googleapis.git /googleapis
RUN rustup component add rustfmt
RUN mkdir -p $PROJECT_PATH
WORKDIR $PROJECT_PATH

5
api/Makefile vendored
View File

@ -1,10 +1,9 @@
.PHONY: rust grpc-web go js python md java kotlin csharp
all:
docker compose up
all: rust grpc-web go js python md java kotlin csharp
rust:
docker compose run --rm chirpstack-api-rust
cd rust && make
grpc-web:
cd grpc-web && make

1234
api/rust/Cargo.lock generated vendored

File diff suppressed because it is too large Load Diff

2
api/rust/Cargo.toml vendored
View File

@ -22,7 +22,7 @@ hex = "0.4"
rand = "0.8"
tonic = { version = "0.11", features = ["codegen", "prost"], default-features = false, optional = true }
tokio = { version = "1.36", features = ["macros"], optional = true }
tokio = { version = "1.37", features = ["macros"], optional = true }
pbjson = { version = "0.6", optional = true }
pbjson-types = { version = "0.6", optional = true }
serde = { version = "1.0", optional = true }

5
api/rust/Makefile vendored
View File

@ -5,10 +5,9 @@ all: proto test
proto:
rm -rf proto
mkdir -p proto/chirpstack
mkdir -p proto/google
cp -r ../proto/* proto/chirpstack
mkdir -p proto/google/google/api
cp /googleapis/google/api/annotations.proto proto/google/google/api
cp /googleapis/google/api/http.proto proto/google/google/api
mv proto/chirpstack/google proto/google/
test:
cargo test