M .builds.dhall/debian-stable.dhall => .builds.dhall/debian-stable.dhall +13 -0
@@ 19,10 19,23 @@
make lint
bundle install --path="../.gems"
make test
+ ''
+ },
+ { build =
+ ''
+ cd dhall-ruby
bundle exec ruby -E UTF-8 bin/dhall-compile -e -o /tmp/Prelude dhall-lang/Prelude
tar -cJf Prelude.tar.xz /tmp/Prelude/
curl -F'file=@Prelude.tar.xz' http://0x0.st
''
+ },
+ { build =
+ ''
+ cd dhall-ruby
+ bundle exec ruby -E UTF-8 bin/dhall-compile -co /tmp/PreludeCache dhall-lang/Prelude
+ tar -cJf PreludeCache.tar.xz /tmp/PreludeCache/
+ curl -F'file=@PreludeCache.tar.xz' http://0x0.st
+ ''
}
]
}
M .builds/debian-stable.yml => .builds/debian-stable.yml +7 -0
@@ 9,9 9,16 @@ tasks:
make lint
bundle install --path="../.gems"
make test
+- build: |
+ cd dhall-ruby
bundle exec ruby -E UTF-8 bin/dhall-compile -e -o /tmp/Prelude dhall-lang/Prelude
tar -cJf Prelude.tar.xz /tmp/Prelude/
curl -F'file=@Prelude.tar.xz' http://0x0.st
+- build: |
+ cd dhall-ruby
+ bundle exec ruby -E UTF-8 bin/dhall-compile -co /tmp/PreludeCache dhall-lang/Prelude
+ tar -cJf PreludeCache.tar.xz /tmp/PreludeCache/
+ curl -F'file=@PreludeCache.tar.xz' http://0x0.st
packages:
- bundler
- curl
M bin/dhall-compile => bin/dhall-compile +27 -4
@@ 13,17 13,31 @@ def compile(source)
resolver: Dhall::Resolvers::Default.new(
max_depth: Float::INFINITY
)
- ).then(&:to_binary)
+ )
end
def compile_file(file_path, relative_to: Pathname.new("."))
out = file_path.sub_ext(@extension)
if @output_directory
out = @output_directory + out.relative_path_from(relative_to)
- out.dirname.mkpath
end
- warn "#{file_path} => #{out}"
- compile(file_path.expand_path).then(&out.method(:write))
+ $stderr.print "#{file_path} => "
+ warn out unless @cache
+ compile(file_path.expand_path).then { |dhall|
+ if @cache
+ base = "1220#{dhall.digest.hexdigest}"
+ out = file_path.dirname + base
+ if @output_directory
+ out = @output_directory + base
+ out.dirname.mkpath
+ end
+ warn out
+ out.write(dhall.to_cbor)
+ else
+ out.dirname.mkpath
+ out.write(dhall.to_binary)
+ end
+ }
end
opt_parser = OptionParser.new do |opts|
@@ 45,6 59,15 @@ opt_parser = OptionParser.new do |opts|
@extension = ext ? ".#{ext}" : ""
end
+ opts.on(
+ "-c",
+ "--cache",
+ "Write output in standard dhall file cache format"
+ ) do
+ @extension = ""
+ @cache = true
+ end
+
opts.on("-h", "--help", "Show this usage information") do
warn opts
exit