Skip to content

Commit

Permalink
Rename src file and move agda-lib to root
Browse files Browse the repository at this point in the history
This does not require any addition arguments to run agda on the lagda files.
  • Loading branch information
ch1bo committed Aug 20, 2024
1 parent 4eafcca commit 15e7791
Show file tree
Hide file tree
Showing 50 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ nix build

In a nix shell (`nix develop` or using `nix-direnv`) you can type check:
```sh
cd hydra-protocol
agda Hydra/Protocol/Main.lagda
agda src/Hydra/Protocol/Main.lagda
```

or build the PDF iteratively:
Expand Down
12 changes: 6 additions & 6 deletions Shakefile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
removeFilesAfter "_build" ["//*"]

"_build/hydra-spec" <.> "pdf" %> \out -> do
assets <- getDirectoryFiles "hydra-protocol" ["//*.sty", "Hydra/Protocol/Figures/*.pdf", "//*.bib", "//*.ttf"]
assets <- getDirectoryFiles "src" ["//*.sty", "Hydra/Protocol/Figures/*.pdf", "//*.bib", "//*.ttf"]
need ["_build/latex" </> c | c <- assets]

srcs <- getDirectoryFiles "hydra-protocol" ["//*.lagda", "//*.tex"]
srcs <- getDirectoryFiles "src" ["//*.lagda", "//*.tex"]
need ["_build/latex" </> c -<.> "tex" | c <- srcs]

cmd_ (Cwd "_build/latex") "latexmk -xelatex -shell-escape -halt-on-error Hydra/Protocol/Main.tex"
Expand All @@ -25,17 +25,17 @@ main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
-- Copy assets
forM ["sty", "pdf", "bib", "ttf"] $ \ext ->
("_build/latex//*." <> ext) %> \out -> do
let src = "hydra-protocol" </> dropDirectory1 (dropDirectory1 out)
let src = "src" </> dropDirectory1 (dropDirectory1 out)
copyFile' src out

-- Copy or compile from lagda files
"_build/latex//*.tex" %> \out -> do
let src = "hydra-protocol" </> dropDirectory1 (dropDirectory1 out)
let src = "src" </> dropDirectory1 (dropDirectory1 out)
b <- doesFileExist src
if b then do
need [src]
copyFile' src out
else do
let src = "hydra-protocol" </> dropDirectory1 (dropDirectory1 (out -<.> "lagda"))
let src = "src" </> dropDirectory1 (dropDirectory1 (out -<.> "lagda"))
need [src]
cmd_ $ "agda -i hydra-protocol -l formal-ledger --transliterate --latex --latex-dir _build/latex " <> src
cmd_ $ "agda --transliterate --latex --latex-dir _build/latex " <> src
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ depend:
standard-library
standard-library-classes
standard-library-meta
include: .
include: src
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 15e7791

Please sign in to comment.