Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ xdr/Stellar-internal.x \
xdr/Stellar-contract-config-setting.x \
xdr/Stellar-exporter.x

# xdrgen commit to use, see https://github.com/stellar/xdrgen
XDRGEN_COMMIT=621d042b824f67ac65cc53d0e5e381e24aed4583
# stellar-xdr commit to use, see https://github.com/stellar/stellar-xdr
XDR_COMMIT=4b7a2ef7931ab2ca2499be68d849f38190b443ca

.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/lightsail-network/xdrgen.git -b $(XDRGEN_COMMIT) && \
xdrgen \
--language java \
--namespace org.stellar.sdk.xdr \
--output src/main/java/org/stellar/sdk/xdr/ \
$(XDRS)'
docker run --rm -v $$PWD:/wd -w /wd ruby:3.4 /bin/bash -c '\
cd xdr-generator && \
bundle install --quiet && \
bundle exec ruby generate.rb'
./gradlew :spotlessApply

xdr/%.x:
Expand All @@ -38,4 +32,4 @@ xdr-clean:
rm xdr/*.x || true
find src/main/java/org/stellar/sdk/xdr -type f -name "*.java" ! -name "package-info.java" -delete

xdr-update: xdr-clean xdr-generate
xdr-update: xdr-clean xdr-generate
20 changes: 10 additions & 10 deletions src/main/java/org/stellar/sdk/xdr/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
public final class Constants {
private Constants() {}

public static final int AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200;
public static final int CONTRACT_COST_COUNT_LIMIT = 1024;
public static final int LIQUIDITY_POOL_FEE_V18 = 30;
public static final int MASK_ACCOUNT_FLAGS = 0x7;
public static final int MASK_ACCOUNT_FLAGS_V17 = 0xF;
public static final int MAX_SIGNERS = 20;
public static final int MASK_CLAIMABLE_BALANCE_FLAGS = 0x1;
public static final int MASK_LEDGER_HEADER_FLAGS = 0x7;
public static final int MASK_OFFERENTRY_FLAGS = 1;
public static final int MASK_TRUSTLINE_FLAGS = 1;
public static final int MASK_TRUSTLINE_FLAGS_V13 = 3;
public static final int MASK_TRUSTLINE_FLAGS_V17 = 7;
public static final int MASK_OFFERENTRY_FLAGS = 1;
public static final int MASK_CLAIMABLE_BALANCE_FLAGS = 0x1;
public static final int MASK_LEDGER_HEADER_FLAGS = 0x7;
public static final int AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200;
public static final int TX_ADVERT_VECTOR_MAX_SIZE = 1000;
public static final int TX_DEMAND_VECTOR_MAX_SIZE = 1000;
public static final int MAX_OPS_PER_TX = 100;
public static final int LIQUIDITY_POOL_FEE_V18 = 30;
public static final int SC_SPEC_DOC_LIMIT = 1024;
public static final int MAX_SIGNERS = 20;
public static final int SCSYMBOL_LIMIT = 32;
public static final int CONTRACT_COST_COUNT_LIMIT = 1024;
public static final int SC_SPEC_DOC_LIMIT = 1024;
public static final int TX_ADVERT_VECTOR_MAX_SIZE = 1000;
public static final int TX_DEMAND_VECTOR_MAX_SIZE = 1000;
}
10 changes: 10 additions & 0 deletions xdr-generator/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source "https://rubygems.org"

gem "xdrgen", git: "https://github.com/stellar/xdrgen", branch: "master"

# Required for Ruby 3.4+ compatibility
gem "base64"
gem "benchmark"
gem "bigdecimal"
gem "logger"
gem "mutex_m"
55 changes: 55 additions & 0 deletions xdr-generator/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
GIT
remote: https://github.com/stellar/xdrgen
revision: 9796d627a739533d0c158ce87fde349b5f764f8b
branch: master
specs:
xdrgen (0.1.3)
activesupport (~> 6)
concurrent-ruby (<= 1.3.4)
memoist (~> 0.11.0)
slop (~> 3.4)
treetop (~> 1.5.3)

GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.10)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (4.0.1)
concurrent-ruby (1.3.4)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
logger (1.7.0)
memoist (0.11.0)
minitest (6.0.1)
prism (~> 1.5)
mutex_m (0.3.0)
polyglot (0.3.5)
prism (1.9.0)
slop (3.6.0)
treetop (1.5.3)
polyglot (~> 0.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
zeitwerk (2.7.4)

PLATFORMS
aarch64-linux
ruby

DEPENDENCIES
base64
benchmark
bigdecimal
logger
mutex_m
xdrgen!

BUNDLED WITH
2.6.9
17 changes: 17 additions & 0 deletions xdr-generator/generate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'xdrgen'
require_relative 'generator/generator'

puts "Generating Java XDR classes..."

# Operate on the root directory of the repo.
Dir.chdir("..")

# Compile the XDR files into Java.
Xdrgen::Compilation.new(
Dir.glob("xdr/*.x"),
output_dir: "src/main/java/org/stellar/sdk/xdr/",
generator: Generator,
namespace: "org.stellar.sdk.xdr",
).compile

puts "Done!"
Loading
Loading