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
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ install:

script:
- export PATH="${PATH}:$(pwd)/bin"
- stack build --flag dhall-json:gpl --copy-bins --local-bin-path ./bin
- stack build --copy-bins --local-bin-path ./bin
- source .travis-functions.sh
- tar -jcvf $(mk_release_name dhall) bin/dhall
- tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall bin/yaml-to-dhall
- tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall
- tar -jcvf $(mk_release_name dhall-bash) bin/dhall-to-bash
- tar -jcvf $(mk_release_name dhall-lsp-server) bin/dhall-lsp-server
- tar -jcvf $(mk_release_name dhall-nix) bin/dhall-to-nix
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how we're installing the binaries for dhall-to-nix, dhall-lsp-server etc. I only see the --copy-bins for dhall-json so far. Does anyone know?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed Travis fails now with:

$ tar -jcvf $(mk_release_name dhall) bin/dhall
tar: bin/dhall: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
The command "tar -jcvf $(mk_release_name dhall) bin/dhall" exited with 1.
3.75s$ tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall
a bin/dhall-to-json
a bin/dhall-to-yaml
a bin/json-to-dhall
The command "tar -jcvf $(mk_release_name dhall-json) bin/dhall-to-json bin/dhall-to-yaml bin/json-to-dhall" exited with 0.
0.03s$ tar -jcvf $(mk_release_name dhall-bash) bin/dhall-to-bash
tar: bin/dhall-to-bash: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
The command "tar -jcvf $(mk_release_name dhall-bash) bin/dhall-to-bash" exited with 1.
0.03s$ tar -jcvf $(mk_release_name dhall-lsp-server) bin/dhall-lsp-server
tar: bin/dhall-lsp-server: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
The command "tar -jcvf $(mk_release_name dhall-lsp-server) bin/dhall-lsp-server" exited with 1.
0.03s$ tar -jcvf $(mk_release_name dhall-nix) bin/dhall-to-nix
tar: bin/dhall-to-nix: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
The command "tar -jcvf $(mk_release_name dhall-nix) bin/dhall-to-nix" exited with 1.

Could it be that we have distributed ancient cached binaries for OS X so far?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was just 96e694d that restricted the binary build to dhall-json.

- tar -jcvf $(mk_release_name dhall-yaml) bin/dhall-to-yaml-ng bin/yaml-to-dhall
- mkdir -p uploads
- mv *.tar.bz2 uploads/

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ the following packages:
* [`dhall`](./dhall) - [![Hackage](https://img.shields.io/hackage/v/dhall.svg)](https://hackage.haskell.org/package/dhall)
* [`dhall-bash`](./dhall-bash) - [![Hackage](https://img.shields.io/hackage/v/dhall-bash.svg)](https://hackage.haskell.org/package/dhall-bash)
* [`dhall-json`](./dhall-json) - [![Hackage](https://img.shields.io/hackage/v/dhall-json.svg)](https://hackage.haskell.org/package/dhall-json)
* [`dhall-yaml`](./dhall-yaml) - [![Hackage](https://img.shields.io/hackage/v/dhall-yaml.svg)](https://hackage.haskell.org/package/dhall-yaml)
* [`dhall-nix`](./dhall-nix) - [![Hackage](https://img.shields.io/hackage/v/dhall-nix.svg)](https://hackage.haskell.org/package/dhall-nix)

Navigate to each package's directory for their respective `README`s
Expand Down Expand Up @@ -38,6 +39,7 @@ visit one of the following links:
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall/latest)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-bash/latest)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-json/latest)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-yaml/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-yaml/latest)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-nix/latest)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest](https://hydra.dhall-lang.org/job/dhall-haskell/master/linux-dhall-lsp-server/latest)

Expand Down Expand Up @@ -67,6 +69,7 @@ download image archives for each package using the following URLs:
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall/latest/download/1/docker-image-dhall.tar.gz)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-bash/latest/download/1/docker-image-dhall-bash.tar.gz)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-json/latest/download/1/docker-image-dhall-json.tar.gz)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-yaml/latest/download/1/docker-image-dhall-yaml.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-yaml/latest/download/1/docker-image-dhall-yaml.tar.gz)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-lsp-server/latest/download/1/docker-image-dhall-lsp-server.tar.gz)
* [https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz](https://hydra.dhall-lang.org/job/dhall-haskell/master/image-dhall-nix/latest/download/1/docker-image-dhall-nix.tar.gz)

Expand Down
8 changes: 6 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ for:
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-json.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-yaml.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\json-to-dhall.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-json-%DEPLOY_TAG%" "%DEPLOY_DIR%\yaml-to-dhall.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-bash-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-bash.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-lsp-server-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-lsp-server.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-yaml-%DEPLOY_TAG%" "%DEPLOY_DIR%\dhall-to-yaml-ng.exe")
- if /I "%DEPLOY_TAG%" NEQ "" (7z a "bin\dhall-yaml-%DEPLOY_TAG%" "%DEPLOY_DIR%\yaml-to-dhall.exe")

test_script:
# chcp 65001 (utf-8) needed to make doctest work
- chcp 65001 && stack test dhall
- stack test dhall-json
- stack test dhall-yaml
- stack test dhall-bash
- stack test dhall-lsp-server
- stack bench dhall --benchmark-arguments "--quick --min-duration=0 --include-first-iter"
Expand All @@ -79,6 +81,8 @@ artifacts:
name: dhall
- path: bin\dhall-json-%DEPLOY_TAG%
name: dhall-json
- path: bin\dhall-yaml-%DEPLOY_TAG%
name: dhall-yaml
- path: bin\dhall-bash-%DEPLOY_TAG%
name: dhall-bash
- path: bin\dhall-lsp-server-%DEPLOY_TAG%
Expand All @@ -88,7 +92,7 @@ deploy:
- provider: GitHub
auth_token:
secure: Gs/tiz6Jtg/Zjd4zGHDhuSv4Y9a+zJ574LWwzOe2bvZNGX/M8XupkxdGmBpDlnOf
artifact: dhall, dhall-json, dhall-bash, dhall-lsp-server
artifact: dhall, dhall-json, dhall-yaml, dhall-bash, dhall-lsp-server
on:
APPVEYOR_REPO_TAG: true
STACK_YAML: stack.yaml
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-lsp-server ./dhall-nix
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-yaml ./dhall-lsp-server ./dhall-nix
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ in
dhall-json
dhall-lsp-server
dhall-nix
dhall-yaml
;

inherit (shared_ghcjs) dhall-try;
Expand Down
3 changes: 0 additions & 3 deletions dhall-json/LICENSE.BSD3 → dhall-json/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
The following license applies to this package when built without the
`-fgpl` Cabal configure flag

Copyright (c) 2018 Gabriel Gonzalez
All rights reserved.

Expand Down
13 changes: 9 additions & 4 deletions dhall-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ Full documentation here:

## Introduction

This `dhall-json` package provides a Dhall to JSON compiler and a Dhall to YAML
compiler. The reason this package is called `dhall-json` is that the Haskell
`yaml` library uses the same data structure as Haskell's `aeson` library for
JSON
This `dhall-json` package provides a Dhall to JSON compiler, and a Dhall to YAML
compiler based on that. The `dhall-to-yaml` executable is a "basic" version of
the `dhall-to-yaml-ng` executable in the `dhall-yaml` package.

## Example

Expand All @@ -30,3 +29,9 @@ foo:
bar:
baz: true
```

## Development

This package's `dhall-to-yaml` and `dhall-yaml`'s `dhall-to-yaml-ng` should be
kept as closely in sync as possible. Common code for these executables lives
in this package, tests live in `dhall-yaml`.
59 changes: 8 additions & 51 deletions dhall-json/dhall-json.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Cabal-Version: >=1.8.0.2
Build-Type: Simple
Tested-With: GHC == 7.10.3, GHC == 8.4.3, GHC == 8.6.1
License: BSD3
License-Files: LICENSE.BSD3, LICENSE.GPLv3
License-File: LICENSE
Copyright: 2017 Gabriel Gonzalez
Author: Gabriel Gonzalez
Maintainer: [email protected]
Expand All @@ -26,24 +26,18 @@ Extra-Source-Files:
CHANGELOG.md
tasty/data/*.dhall
tasty/data/*.json
tasty/data/*.txt
tasty/data/*.yaml

Source-Repository head
Type: git
Location: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json

Flag gpl
Description: Use GPL-licensed components like HsYAML, and enable yaml-to-dhall binary
Default: False
Manual: True

Library
Hs-Source-Dirs: src
Build-Depends:
base >= 4.8.0.0 && < 5 ,
aeson >= 1.0.0.0 && < 1.5 ,
aeson-pretty < 0.9 ,
aeson-yaml >= 1.0.4 && < 1.1 ,
bytestring < 0.11,
containers ,
dhall >= 1.27.0 && < 1.28,
Expand All @@ -58,21 +52,11 @@ Library
Exposed-Modules:
Dhall.JSON
Dhall.JSONToDhall
Dhall.Yaml
if flag(gpl)
Exposed-Modules:
Dhall.YamlToDhall
Dhall.JSON.Yaml
Dhall.DhallToYaml.Main
Other-Modules:
Dhall.JSON.Util
GHC-Options: -Wall
if flag(gpl)
CPP-Options: -DGPL
Build-Depends:
HsYAML >= 0.2 && < 0.3,
HsYAML-aeson >= 0.2 && < 0.3
else
Build-Depends:
aeson-yaml >= 1.0.2 && < 1.1

Executable dhall-to-json
Hs-Source-Dirs: dhall-to-json
Expand All @@ -94,13 +78,8 @@ Executable dhall-to-yaml
Hs-Source-Dirs: dhall-to-yaml
Main-Is: Main.hs
Build-Depends:
base ,
aeson ,
bytestring < 0.11,
dhall ,
dhall-json ,
optparse-applicative ,
text
base ,
dhall-json
Other-Modules:
Paths_dhall_json
GHC-Options: -Wall
Expand All @@ -126,39 +105,17 @@ Executable json-to-dhall
Paths_dhall_json
GHC-Options: -Wall

Executable yaml-to-dhall
if !flag(gpl)
Buildable: False
Hs-Source-Dirs: yaml-to-dhall
Main-Is: Main.hs
Build-Depends:
base ,
aeson ,
ansi-terminal >= 0.6.3.1 && < 0.11,
bytestring < 0.11,
dhall ,
dhall-json ,
exceptions >= 0.8.3 && < 0.11,
optparse-applicative ,
prettyprinter ,
prettyprinter-ansi-terminal >= 1.1.1 && < 1.2 ,
text < 1.3
if !impl(ghc >= 8.0) && !impl(eta >= 0.8.4)
Build-Depends: semigroups == 0.18.*
Other-Modules:
Paths_dhall_json
GHC-Options: -Wall

Test-Suite tasty
Type: exitcode-stdio-1.0
Hs-Source-Dirs: tasty
Main-Is: Main.hs
Build-Depends:
base,
base ,
aeson ,
bytestring ,
dhall ,
dhall-json ,
tasty < 1.3,
text ,
tasty-hunit >= 0.2
GHC-Options: -Wall
101 changes: 4 additions & 97 deletions dhall-json/dhall-to-yaml/Main.hs
Original file line number Diff line number Diff line change
@@ -1,101 +1,8 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Main where

import Control.Applicative (optional, (<|>))
import Control.Exception (SomeException)
import Data.Monoid ((<>))
import Dhall.JSON (parsePreservationAndOmission, parseConversion)
import Dhall.Yaml (Options(..), dhallToYaml, parseDocuments, parseQuoted)
import Options.Applicative (Parser, ParserInfo)

import qualified Control.Exception
import qualified Data.ByteString
import qualified Data.Text.IO as Text.IO
import qualified Data.Version
import qualified GHC.IO.Encoding
import qualified Options.Applicative as Options
import qualified Paths_dhall_json as Meta
import qualified System.Exit
import qualified System.IO

parseOptions :: Parser (Maybe Options)
parseOptions =
Just
<$> ( Options
<$> parseExplain
<*> Dhall.JSON.parsePreservationAndOmission
<*> parseDocuments
<*> parseQuoted
<*> Dhall.JSON.parseConversion
<*> optional parseFile
<*> optional parseOutput
)
<|> parseVersion
where
parseExplain =
Options.switch
( Options.long "explain"
<> Options.help "Explain error messages in detail"
)

parseFile =
Options.strOption
( Options.long "file"
<> Options.help "Read expression from a file instead of standard input"
<> Options.metavar "FILE"
)

parseVersion =
Options.flag'
Nothing
( Options.long "version"
<> Options.help "Display version"
)

parseOutput =
Options.strOption
( Options.long "output"
<> Options.help "Write YAML to a file instead of standard output"
<> Options.metavar "FILE"
)

parserInfo :: ParserInfo (Maybe Options)
parserInfo =
Options.info
(Options.helper <*> parseOptions)
( Options.fullDesc
<> Options.progDesc "Compile Dhall to YAML"
)
import qualified Dhall.DhallToYaml.Main
import qualified Dhall.JSON.Yaml
import qualified Paths_dhall_json as Meta

main :: IO ()
main = do
GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8

maybeOptions <- Options.execParser parserInfo

case maybeOptions of
Nothing -> do
putStrLn (Data.Version.showVersion Meta.version)

Just options@(Options {..}) -> do
handle $ do
contents <- case file of
Nothing -> Text.IO.getContents
Just path -> Text.IO.readFile path

let write =
case output of
Nothing -> Data.ByteString.putStr
Just file_ -> Data.ByteString.writeFile file_

write =<< dhallToYaml options file contents

handle :: IO a -> IO a
handle = Control.Exception.handle handler
where
handler :: SomeException -> IO a
handler e = do
System.IO.hPutStrLn System.IO.stderr ""
System.IO.hPrint System.IO.stderr e
System.Exit.exitFailure
main = Dhall.DhallToYaml.Main.main Meta.version Dhall.JSON.Yaml.dhallToYaml
8 changes: 0 additions & 8 deletions dhall-json/release.nix

This file was deleted.

Loading