Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add makefile rules for regenerating from a local xdrgen #221

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,37 @@ generate: src/curr/generated.rs xdr/curr-version src/next/generated.rs xdr/next-

src/curr/generated.rs: $(sort $(wildcard xdr/curr/*.x))
> $@
ifeq ($(LOCAL_XDRGEN),)
docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
gem install specific_install -v 0.3.7 && \
gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_VERSION) && \
xdrgen --language rust --namespace generated --output src/curr $^ \
'
else
docker run -i --rm -v $$PWD/../xdrgen:/xdrgen -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
pushd /xdrgen && bundle install --deployment && rake install && popd && \
brson marked this conversation as resolved.
Show resolved Hide resolved
xdrgen --language rust --namespace generated --output src/curr $^ \
'
endif
rustfmt $@

xdr/curr-version: $(wildcard .git/modules/xdr/curr/**/*) $(wildcard xdr/curr/*.x)
git submodule status -- xdr/curr | sed 's/^ *//g' | cut -f 1 -d " " | tr -d '\n' > xdr/curr-version

src/next/generated.rs: $(sort $(wildcard xdr/next/*.x))
> $@
ifeq ($(LOCAL_XDRGEN),)
docker run -i --rm -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
gem install specific_install -v 0.3.7 && \
gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_VERSION) && \
xdrgen --language rust --namespace generated --output src/next $^ \
'
else
docker run -i --rm -v $$PWD/../xdrgen:/xdrgen -v $$PWD:/wd -w /wd docker.io/library/ruby:latest /bin/bash -c '\
pushd /xdrgen && bundle install --deployment && rake install && popd && \
xdrgen --language rust --namespace generated --output src/next $^ \
'
endif
rustfmt $@

xdr/next-version: $(wildcard .git/modules/xdr/next/**/*) $(wildcard xdr/next/*.x)
Expand Down