make+lnrpc: compile mobile RPC with docker too

Now that we have a base docker image that has all our RPC compilation
dependencies installed, we can also run the mobile RPC compilation
there. This removes the need to install falafel and goimports on the
local machine.
This commit is contained in:
Oliver Gugger 2021-01-15 13:44:54 +01:00
parent 19f7670a5b
commit 3bcfe931f9
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
4 changed files with 19 additions and 10 deletions

View File

@ -6,7 +6,6 @@ BTCD_PKG := github.com/btcsuite/btcd
GOVERALLS_PKG := github.com/mattn/goveralls
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
GOACC_PKG := github.com/ory/go-acc
FALAFEL_PKG := github.com/lightninglabs/falafel
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports
GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build
GOFUZZ_PKG := github.com/dvyukov/go-fuzz/go-fuzz
@ -37,7 +36,6 @@ BTCD_COMMIT := $(shell cat go.mod | \
LINT_COMMIT := v1.18.0
GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5
FALAFEL_COMMIT := v0.7.1
GOFUZZ_COMMIT := 21309f307f61
DEPGET := cd /tmp && GO111MODULE=on go get -v
@ -113,10 +111,6 @@ btcd:
@$(call print, "Installing btcd.")
$(DEPGET) $(BTCD_PKG)@$(BTCD_COMMIT)
falafel:
@$(call print, "Installing falafel.")
$(DEPGET) $(FALAFEL_PKG)@$(FALAFEL_COMMIT)
goimports:
@$(call print, "Installing goimports.")
$(DEPGET) $(GOIMPORTS_PKG)
@ -277,9 +271,9 @@ sample-conf-check:
@$(call print, "Making sure every flag has an example in the sample-lnd.conf file")
for flag in $$(GO_FLAGS_COMPLETION=1 go run -tags="$(RELEASE_TAGS)" $(PKG)/cmd/lnd -- | grep -v help | cut -c3-); do if ! grep -q $$flag sample-lnd.conf; then echo "Command line flag --$$flag not added to sample-lnd.conf"; exit 1; fi; done
mobile-rpc: falafel goimports
mobile-rpc:
@$(call print, "Creating mobile RPC from protos.")
cd ./mobile; ./gen_bindings.sh $(FALAFEL_COMMIT)
cd ./lnrpc; COMPILE_MOBILE=1 ./gen_protos_docker.sh
vendor:
@$(call print, "Re-creating vendor directory.")
@ -316,7 +310,6 @@ clean:
unit \
unit-cover \
unit-race \
falafel \
goveralls \
travis-race \
travis-cover \

View File

@ -11,11 +11,20 @@ RUN apt-get update && apt-get install -y \
ARG PROTOC_GEN_VERSION
ARG GRPC_GATEWAY_VERSION
ENV FALAFEL_VERSION="v0.7.1"
ENV GOCACHE=/tmp/build/.cache
ENV GOMODCACHE=/tmp/build/.modcache
RUN cd /tmp \
&& mkdir -p /tmp/build/.cache \
&& mkdir -p /tmp/build/.modcache \
&& export GO111MODULE=on \
&& go get github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_VERSION} \
&& go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \
&& go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${GRPC_GATEWAY_VERSION}
&& go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${GRPC_GATEWAY_VERSION} \
&& go get github.com/lightninglabs/falafel@${FALAFEL_VERSION} \
&& go get golang.org/x/tools/cmd/goimports \
&& chmod -R 777 /tmp/build/
WORKDIR /build

View File

@ -42,3 +42,9 @@ pushd lnrpc
format
generate
popd
if [[ "$COMPILE_MOBILE" == "1" ]]; then
pushd mobile
./gen_bindings.sh $FALAFEL_VERSION
popd
fi

View File

@ -19,5 +19,6 @@ docker run \
--rm \
--user "$UID:$(id -g)" \
-e UID=$UID \
-e COMPILE_MOBILE \
-v "$DIR/../:/build" \
lnd-protobuf-builder