diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..bfe65e281 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +XDRS = xdr/Stellar-SCP.x \ +xdr/Stellar-ledger-entries.x \ +xdr/Stellar-ledger.x \ +xdr/Stellar-overlay.x \ +xdr/Stellar-transaction.x \ +xdr/Stellar-types.x \ +xdr/Stellar-contract-env-meta.x \ +xdr/Stellar-contract-meta.x \ +xdr/Stellar-contract-spec.x \ +xdr/Stellar-contract.x \ +xdr/Stellar-internal.x \ +xdr/Stellar-contract-config-setting.x + +XDRGEN_COMMIT=472eac8c5609d310d48bd8eed68aa24d2626df53 +XDRNEXT_COMMIT=e372df9f677961aac04c5a4cc80a3667f310b29f + +.PHONY: xdr xdr-clean xdr-update + +xdr-generate: $(XDRS) + docker run -it --rm -v $$PWD:/wd -w /wd ruby /bin/bash -c '\ + gem install specific_install -v 0.3.8 && \ + gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_COMMIT) && \ + xdrgen \ + --language java \ + --namespace org.stellar.sdk.xdr \ + --output src/main/java/org/stellar/sdk/xdr/ \ + $(XDRS)' + ./gradlew :spotlessApply + +xdr/%.x: + curl -Lsf -o $@ https://raw.githubusercontent.com/stellar/stellar-xdr/$(XDRNEXT_COMMIT)/$(@F) + +xdr-clean: + rm xdr/*.x || true + rm src/main/java/org/stellar/sdk/xdr/*.java || true + +xdr-update: xdr-clean xdr-generate \ No newline at end of file diff --git a/readme.md b/readme.md index 5d44136cd..79be07361 100644 --- a/readme.md +++ b/readme.md @@ -40,7 +40,7 @@ For information on how to contribute, please refer to our [contribution guide](h java-stellar-sdk is licensed under an Apache-2.0 license. See the [LICENSE](https://github.com/stellar/java-stellar-sdk/blob/master/LICENSE) file for details. ## xdr to jave code generation -All the java source files in org.stellar.sdk.xdr package are generated using the `xdrgen` command from the [stellar/xdrgen](https://github.com/stellar/xdrgen) -``` -xdrgen -o ./src/main/java/org/stellar/sdk/xdr -l java -n org.stellar.sdk.xdr ./xdr/*.x +All the java source files in `org.stellar.sdk.xdr` package are generated using the following command: +```bash +make xdr-update ``` \ No newline at end of file