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 GOVERALLS_PKG := github.com/mattn/goveralls
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
GOACC_PKG := github.com/ory/go-acc GOACC_PKG := github.com/ory/go-acc
FALAFEL_PKG := github.com/lightninglabs/falafel
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports
GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build
GOFUZZ_PKG := github.com/dvyukov/go-fuzz/go-fuzz GOFUZZ_PKG := github.com/dvyukov/go-fuzz/go-fuzz
@ -37,7 +36,6 @@ BTCD_COMMIT := $(shell cat go.mod | \
LINT_COMMIT := v1.18.0 LINT_COMMIT := v1.18.0
GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5 GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5
FALAFEL_COMMIT := v0.7.1
GOFUZZ_COMMIT := 21309f307f61 GOFUZZ_COMMIT := 21309f307f61
DEPGET := cd /tmp && GO111MODULE=on go get -v DEPGET := cd /tmp && GO111MODULE=on go get -v
@ -113,10 +111,6 @@ btcd:
@$(call print, "Installing btcd.") @$(call print, "Installing btcd.")
$(DEPGET) $(BTCD_PKG)@$(BTCD_COMMIT) $(DEPGET) $(BTCD_PKG)@$(BTCD_COMMIT)
falafel:
@$(call print, "Installing falafel.")
$(DEPGET) $(FALAFEL_PKG)@$(FALAFEL_COMMIT)
goimports: goimports:
@$(call print, "Installing goimports.") @$(call print, "Installing goimports.")
$(DEPGET) $(GOIMPORTS_PKG) $(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") @$(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 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.") @$(call print, "Creating mobile RPC from protos.")
cd ./mobile; ./gen_bindings.sh $(FALAFEL_COMMIT) cd ./lnrpc; COMPILE_MOBILE=1 ./gen_protos_docker.sh
vendor: vendor:
@$(call print, "Re-creating vendor directory.") @$(call print, "Re-creating vendor directory.")
@ -316,7 +310,6 @@ clean:
unit \ unit \
unit-cover \ unit-cover \
unit-race \ unit-race \
falafel \
goveralls \ goveralls \
travis-race \ travis-race \
travis-cover \ travis-cover \

View File

@ -11,11 +11,20 @@ RUN apt-get update && apt-get install -y \
ARG PROTOC_GEN_VERSION ARG PROTOC_GEN_VERSION
ARG GRPC_GATEWAY_VERSION ARG GRPC_GATEWAY_VERSION
ENV FALAFEL_VERSION="v0.7.1"
ENV GOCACHE=/tmp/build/.cache
ENV GOMODCACHE=/tmp/build/.modcache
RUN cd /tmp \ RUN cd /tmp \
&& mkdir -p /tmp/build/.cache \
&& mkdir -p /tmp/build/.modcache \
&& export GO111MODULE=on \ && export GO111MODULE=on \
&& go get github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_VERSION} \ && 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-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 WORKDIR /build

View File

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

View File

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