Skip to content

Commit

Permalink
Build haddock docs on CI (attempt 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
avh4 committed Mar 11, 2023
1 parent 246536d commit 8371480
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Shakefile/build-elm-format.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ executable build-elm-format
aeson >=2.0.0.0
, base >=4.16.2.0
, directory >=1.3.6.2
, relude
, shake >=0.19.6 && <0.20
, yaml
default-language: Haskell2010
1 change: 1 addition & 0 deletions Shakefile/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
base: ">= 4.16.2.0"
directory: ">= 1.3.6.2"
shake: ">=0.19.6 && <0.20"
relude: {}
yaml: {}


Expand Down
9 changes: 7 additions & 2 deletions Shakefile/src/Shakefiles/Haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import qualified Shakefiles.Platform
import Data.Char (isSpace)
import Data.List (dropWhileEnd, stripPrefix)
import Shakefiles.Extra
import System.Directory (createDirectoryIfMissing)
import System.Directory (createDirectoryIfMissing, removeDirectoryRecursive)
import Data.Yaml (FromJSON, (.:))
import Data.Yaml.TH (FromJSON(..))
import qualified Data.Yaml as Yaml
import qualified Data.Aeson.Key as Key
import Relude.Bool.Guard (whenM)


docsDir :: FilePath
Expand Down Expand Up @@ -87,7 +88,11 @@ cabalProject name sourceFiles sourcePatterns deps testPatterns testDeps =
buildDir <- cabalBuildDir name
let docsBuildDir = buildDir </> "doc" </> "html" </> name
liftIO $ createDirectoryIfMissing True docsDir
cmd_ "rsync" "-a" "--delete" (docsBuildDir <> "/") (docsDir </> name <> "/")
let docsOutDir = docsDir </> name
whenM
(doesDirectoryExist docsOutDir)
(liftIO $ removeDirectoryRecursive docsOutDir)
cmd_ "cp" "-r" (docsBuildDir <> "/") docsOutDir
copyFileChanged haddockOk out


Expand Down

0 comments on commit 8371480

Please sign in to comment.