This repository was archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRakefile
More file actions
50 lines (41 loc) · 1.26 KB
/
Rakefile
File metadata and controls
50 lines (41 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require "bundler"
Bundler.setup()
namespace :xdr do
# As stellar-core adds more .x files, we'll need to update this array
# Prior to launch, we should be separating our .x files into a separate
# repo, and should be able to improve this integration.
HAYASHI_XDR = [
"src/xdr/Stellar-ledger-entries.x",
"src/xdr/Stellar-ledger.x",
"src/xdr/Stellar-overlay.x",
"src/xdr/Stellar-transaction.x",
"src/xdr/Stellar-types.x",
"src/xdr/Stellar-SCP.x",
]
task :update => [:download, :generate]
task :download do
require 'octokit'
require 'base64'
client = Octokit::Client.new(:netrc => true)
HAYASHI_XDR.each do |src|
local_path = "xdr/" + File.basename(src)
encoded = client.contents("stellar/stellar-core", path: src).content
decoded = Base64.decode64 encoded
IO.write(local_path, decoded)
end
end
task :generate do
require "pathname"
require "xdrgen"
require 'fileutils'
FileUtils.rm_rf "src/main/java/org/stellar/base/xdr"
paths = Pathname.glob("xdr/**/*.x")
compilation = Xdrgen::Compilation.new(
paths,
output_dir: "src/main/java/org/stellar/base/xdr",
namespace: "org.stellar.base.xdr",
language: :java
)
compilation.compile
end
end