Skip to content

Commit ff1dc85

Browse files
[ fix #1743 ] move README to doc/ directory (#2184)
* [ admin ] dev playground * [ fix #1743 ] move README to doc/ directory * [ fix ] whitespace violations * [ ci ] update to cope with new doc/ directory * [ cleanup ] remove stale reference to travis.yml * [ admin ] update README-related instructions * [ admin ] fix build badges * [ fix ] `make test` build * Moved contents of notes/ to doc/ * Added CHANGELOG entry --------- Co-authored-by: MatthewDaggitt <[email protected]>
1 parent e0879db commit ff1dc85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+76
-43
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/workflows/ci-ubuntu.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ env:
5151
CABAL_VERSION: 3.6.2.0
5252
CABAL_INSTALL: cabal v1-install --ghc-options='-O1 +RTS -M6G -RTS'
5353
# CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS'
54-
AGDA: agda -Werror +RTS -M3.5G -H3.5G -A128M -RTS -i. -i src/
54+
AGDA: agda -Werror +RTS -M3.5G -H3.5G -A128M -RTS -i. -isrc -idoc
5555

5656
jobs:
5757
test-stdlib:
@@ -152,7 +152,7 @@ jobs:
152152
- name: Test stdlib
153153
run: |
154154
cabal run GenerateEverything
155-
cp travis/* .
155+
cp .github/tooling/* .
156156
./index.sh
157157
${{ env.AGDA }} --safe EverythingSafe.agda
158158
${{ env.AGDA }} index.agda
@@ -178,7 +178,7 @@ jobs:
178178
rm -f '${{ env.AGDA_HTML_DIR }}'/*.css
179179
${{ env.AGDA }} --html --html-dir ${{ env.AGDA_HTML_DIR }} index.agda
180180
181-
cp travis/* .
181+
cp .github/tooling/* .
182182
./landing.sh
183183
184184
- name: Deploy HTML

CHANGELOG.md

Lines changed: 11 additions & 0 deletions

GNUmakefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@ AGDA=$(AGDA_EXEC) $(AGDA_OPTIONS) $(AGDA_RTS_OPTIONS)
99
# cabal install fix-whitespace
1010

1111
test: Everything.agda check-whitespace
12-
$(AGDA) -i. -isrc README.agda
12+
cd doc && $(AGDA) README.agda
1313

1414
testsuite:
1515
$(MAKE) -C tests test AGDA="$(AGDA)" AGDA_EXEC="$(AGDA_EXEC)" only=$(only)
1616

17+
fix-whitespace:
18+
cabal exec -- fix-whitespace
19+
1720
check-whitespace:
1821
cabal exec -- fix-whitespace --check
1922

2023
setup: Everything.agda
2124

2225
.PHONY: Everything.agda
2326
Everything.agda:
24-
cabal run GenerateEverything
27+
cabal run GenerateEverything -- --out-dir doc
2528

2629
.PHONY: listings
2730
listings: Everything.agda
28-
$(AGDA) -i. -isrc --html README.agda -v0
31+
cd doc && $(AGDA) --html README.agda -v0
2932

3033
clean :
3134
find . -type f -name '*.agdai' -delete
35+
rm -f Everything.agda EverythingSafe.agda

GenerateEverything.hs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE PatternGuards #-}
22
{-# LANGUAGE PatternSynonyms #-}
3+
{-# LANGUAGE RecordWildCards #-}
34

45
import Control.Applicative
56
import Control.Monad
@@ -299,18 +300,37 @@ checkFilePaths cat fps = forM_ fps $ \ fp -> do
299300
unless b $
300301
die $ fp ++ " is listed as " ++ cat ++ " but does not exist."
301302

303+
data Options = Options
304+
{ includeDeprecated :: Bool
305+
, outputDirectory :: FilePath
306+
}
307+
308+
initOptions :: Options
309+
initOptions = Options
310+
{ includeDeprecated = False
311+
, outputDirectory = "."
312+
}
313+
314+
parseOptions :: [String] -> Options -> Maybe Options
315+
parseOptions [] opts = pure opts
316+
parseOptions ("--include-deprecated" : rest) opts
317+
= parseOptions rest (opts { includeDeprecated = True })
318+
parseOptions ("--out-dir" : dir : rest) opts
319+
= parseOptions rest (opts { outputDirectory = dir })
320+
parseOptions _ _ = Nothing
321+
302322
---------------------------------------------------------------------------
303323
-- Collecting all non-Core library files, analysing them and generating
304-
-- 4 files:
324+
-- 2 files:
305325
-- Everything.agda all the modules
306326
-- EverythingSafe.agda all the safe modules
307327

328+
main :: IO ()
308329
main = do
309330
args <- getArgs
310-
includeDeprecated <- case args of
311-
[] -> return False
312-
["--include-deprecated"] -> return True
313-
_ -> hPutStr stderr usage >> exitFailure
331+
Options{..} <- case parseOptions args initOptions of
332+
Just opts -> pure opts
333+
Nothing -> hPutStr stderr usage >> exitFailure
314334

315335
checkFilePaths "unsafe" unsafeModules
316336
checkFilePaths "using K" withKModules
@@ -325,14 +345,14 @@ main = do
325345

326346
let mkModule str = "module " ++ str ++ " where"
327347

328-
writeFileUTF8 (allOutputFile ++ ".agda") $
348+
writeFileUTF8 (outputDirectory ++ "/" ++ allOutputFile ++ ".agda") $
329349
unlines [ header
330350
, "{-# OPTIONS --rewriting --guardedness --sized-types #-}\n"
331351
, mkModule allOutputFile
332352
, format libraryfiles
333353
]
334354

335-
writeFileUTF8 (safeOutputFile ++ ".agda") $
355+
writeFileUTF8 (outputDirectory ++ "/" ++ safeOutputFile ++ ".agda") $
336356
unlines [ header
337357
, "{-# OPTIONS --safe --guardedness #-}\n"
338358
, mkModule safeOutputFile
@@ -353,6 +373,9 @@ usage = unlines
353373
, "The program generates documentation for the library by extracting"
354374
, "headers from library modules. The output is written to " ++ allOutputFile
355375
, "with the file " ++ headerFile ++ " inserted verbatim at the beginning."
376+
, ""
377+
, "If the option --out-dir is used then the output is placed in the"
378+
, "subdirectory thus selected."
356379
]
357380

358381

0 commit comments

Comments
 (0)