mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
switch hereFile to FileEmbed
This commit is contained in:
parent
e7197460b3
commit
f4254609fd
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Some naming conventions used in this module:
|
||||
--
|
||||
-- * @32@: the base32 representation of a hash
|
||||
@ -295,7 +297,6 @@ import Data.Map.NonEmpty qualified as NEMap
|
||||
import Data.Maybe qualified as Maybe
|
||||
import Data.Sequence qualified as Seq
|
||||
import Data.Set qualified as Set
|
||||
import Data.String.Here.Uninterpolated (hereFile)
|
||||
import Data.Text qualified as Text
|
||||
import Data.Text.Encoding qualified as Text
|
||||
import Data.Text.Lazy qualified as Text.Lazy
|
||||
@ -383,6 +384,7 @@ import Unison.Hash32.Orphans.Sqlite ()
|
||||
import Unison.Prelude
|
||||
import Unison.Sqlite
|
||||
import Unison.Util.Alternative qualified as Alternative
|
||||
import Unison.Util.FileEmbed (embedProjectStringFile)
|
||||
import Unison.Util.Lens qualified as Lens
|
||||
import Unison.Util.Map qualified as Map
|
||||
|
||||
@ -395,7 +397,7 @@ currentSchemaVersion = 15
|
||||
|
||||
createSchema :: Transaction ()
|
||||
createSchema = do
|
||||
executeStatements [hereFile|unison/sql/create.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/create.sql")
|
||||
addTempEntityTables
|
||||
addNamespaceStatsTables
|
||||
addReflogTable
|
||||
@ -415,45 +417,45 @@ createSchema = do
|
||||
|
||||
addTempEntityTables :: Transaction ()
|
||||
addTempEntityTables =
|
||||
executeStatements [hereFile|unison/sql/001-temp-entity-tables.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/001-temp-entity-tables.sql")
|
||||
|
||||
addNamespaceStatsTables :: Transaction ()
|
||||
addNamespaceStatsTables =
|
||||
executeStatements [hereFile|unison/sql/003-namespace-statistics.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/003-namespace-statistics.sql")
|
||||
|
||||
addReflogTable :: Transaction ()
|
||||
addReflogTable =
|
||||
executeStatements [hereFile|unison/sql/002-reflog-table.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/002-reflog-table.sql")
|
||||
|
||||
fixScopedNameLookupTables :: Transaction ()
|
||||
fixScopedNameLookupTables =
|
||||
executeStatements [hereFile|unison/sql/004-fix-scoped-name-lookup-tables.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/004-fix-scoped-name-lookup-tables.sql")
|
||||
|
||||
addProjectTables :: Transaction ()
|
||||
addProjectTables =
|
||||
executeStatements [hereFile|unison/sql/005-project-tables.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/005-project-tables.sql")
|
||||
|
||||
addMostRecentBranchTable :: Transaction ()
|
||||
addMostRecentBranchTable =
|
||||
executeStatements [hereFile|unison/sql/006-most-recent-branch-table.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/006-most-recent-branch-table.sql")
|
||||
|
||||
addNameLookupMountTables :: Transaction ()
|
||||
addNameLookupMountTables =
|
||||
executeStatements [hereFile|unison/sql/007-add-name-lookup-mounts.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/007-add-name-lookup-mounts.sql")
|
||||
|
||||
addMostRecentNamespaceTable :: Transaction ()
|
||||
addMostRecentNamespaceTable =
|
||||
executeStatements [hereFile|unison/sql/008-add-most-recent-namespace-table.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/008-add-most-recent-namespace-table.sql")
|
||||
|
||||
addSquashResultTable :: Transaction ()
|
||||
addSquashResultTable =
|
||||
executeStatements [hereFile|unison/sql/009-add-squash-cache-table.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/009-add-squash-cache-table.sql")
|
||||
|
||||
-- | Added as a fix because 'addSquashResultTable' was missed in the createSchema action
|
||||
-- for a portion of time.
|
||||
addSquashResultTableIfNotExists :: Transaction ()
|
||||
addSquashResultTableIfNotExists =
|
||||
executeStatements [hereFile|unison/sql/010-ensure-squash-cache-table.sql|]
|
||||
executeStatements $(embedProjectStringFile "sql/010-ensure-squash-cache-table.sql")
|
||||
|
||||
schemaVersion :: Transaction SchemaVersion
|
||||
schemaVersion =
|
||||
|
@ -19,7 +19,6 @@ dependencies:
|
||||
- containers
|
||||
- extra
|
||||
- generic-lens
|
||||
- here
|
||||
- lens
|
||||
- monad-validate
|
||||
- mtl
|
||||
@ -39,6 +38,7 @@ dependencies:
|
||||
- unison-sqlite
|
||||
- unison-util-base32hex
|
||||
- unison-util-cache
|
||||
- unison-util-file-embed
|
||||
- unison-util-serialization
|
||||
- unison-util-term
|
||||
- unliftio
|
||||
|
@ -110,7 +110,6 @@ library
|
||||
, containers
|
||||
, extra
|
||||
, generic-lens
|
||||
, here
|
||||
, lens
|
||||
, monad-validate
|
||||
, mtl
|
||||
@ -130,6 +129,7 @@ library
|
||||
, unison-sqlite
|
||||
, unison-util-base32hex
|
||||
, unison-util-cache
|
||||
, unison-util-file-embed
|
||||
, unison-util-serialization
|
||||
, unison-util-term
|
||||
, unliftio
|
||||
|
3
hie.yaml
3
hie.yaml
@ -69,6 +69,9 @@ cradle:
|
||||
- path: "lib/unison-util-cache/test"
|
||||
component: "unison-util-cache:test:util-cache-tests"
|
||||
|
||||
- path: "lib/unison-util-file-embed/src"
|
||||
component: "unison-util-file-embed:lib"
|
||||
|
||||
- path: "lib/unison-util-relation/src"
|
||||
component: "unison-util-relation:lib"
|
||||
|
||||
|
34
lib/unison-util-file-embed/package.yaml
Normal file
34
lib/unison-util-file-embed/package.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
name: unison-util-file-embed
|
||||
github: unisonweb/unison
|
||||
copyright: Copyright (C) 2013-2023 Unison Computing, PBC and contributors
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
when:
|
||||
- condition: false
|
||||
other-modules: Paths_unison_util_file_embed
|
||||
|
||||
dependencies:
|
||||
- base
|
||||
- file-embed
|
||||
- template-haskell
|
||||
|
||||
ghc-options:
|
||||
-Wall
|
||||
|
||||
default-extensions:
|
||||
- ApplicativeDo
|
||||
- BlockArguments
|
||||
- DeriveFunctor
|
||||
- DerivingStrategies
|
||||
- DoAndIfThenElse
|
||||
- FlexibleContexts
|
||||
- FlexibleInstances
|
||||
- ImportQualifiedPost
|
||||
- LambdaCase
|
||||
- MultiParamTypeClasses
|
||||
- NamedFieldPuns
|
||||
- ScopedTypeVariables
|
||||
- TupleSections
|
||||
- TypeApplications
|
||||
- ViewPatterns
|
7
lib/unison-util-file-embed/src/Unison/Util/FileEmbed.hs
Normal file
7
lib/unison-util-file-embed/src/Unison/Util/FileEmbed.hs
Normal file
@ -0,0 +1,7 @@
|
||||
module Unison.Util.FileEmbed (embedProjectStringFile) where
|
||||
|
||||
import Data.FileEmbed (embedStringFile, makeRelativeToProject)
|
||||
import Language.Haskell.TH.Syntax (Exp, Q)
|
||||
|
||||
embedProjectStringFile :: FilePath -> Q Exp
|
||||
embedProjectStringFile fp = makeRelativeToProject fp >>= embedStringFile
|
44
lib/unison-util-file-embed/unison-util-file-embed.cabal
Normal file
44
lib/unison-util-file-embed/unison-util-file-embed.cabal
Normal file
@ -0,0 +1,44 @@
|
||||
cabal-version: 1.12
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.35.2.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: unison-util-file-embed
|
||||
version: 0.0.0
|
||||
homepage: https://github.com/unisonweb/unison#readme
|
||||
bug-reports: https://github.com/unisonweb/unison/issues
|
||||
copyright: Copyright (C) 2013-2023 Unison Computing, PBC and contributors
|
||||
build-type: Simple
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
location: https://github.com/unisonweb/unison
|
||||
|
||||
library
|
||||
exposed-modules:
|
||||
Unison.Util.FileEmbed
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions:
|
||||
ApplicativeDo
|
||||
BlockArguments
|
||||
DeriveFunctor
|
||||
DerivingStrategies
|
||||
DoAndIfThenElse
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
ImportQualifiedPost
|
||||
LambdaCase
|
||||
MultiParamTypeClasses
|
||||
NamedFieldPuns
|
||||
ScopedTypeVariables
|
||||
TupleSections
|
||||
TypeApplications
|
||||
ViewPatterns
|
||||
ghc-options: -Wall
|
||||
build-depends:
|
||||
base
|
||||
, file-embed
|
||||
, template-haskell
|
||||
default-language: Haskell2010
|
@ -57,7 +57,6 @@ dependencies:
|
||||
- hashable
|
||||
- hashtables
|
||||
- haskeline
|
||||
- here
|
||||
- http-client
|
||||
- http-media
|
||||
- http-types
|
||||
|
@ -246,7 +246,6 @@ library
|
||||
, hashable
|
||||
, hashtables
|
||||
, haskeline
|
||||
, here
|
||||
, http-client
|
||||
, http-media
|
||||
, http-types
|
||||
@ -436,7 +435,6 @@ test-suite parser-typechecker-tests
|
||||
, hashable
|
||||
, hashtables
|
||||
, haskeline
|
||||
, here
|
||||
, http-client
|
||||
, http-media
|
||||
, http-types
|
||||
|
@ -28,6 +28,7 @@ packages:
|
||||
- lib/unison-util-base32hex
|
||||
- lib/unison-util-bytes
|
||||
- lib/unison-util-cache
|
||||
- lib/unison-util-file-embed
|
||||
- lib/unison-util-relation
|
||||
- lib/unison-util-rope
|
||||
- parser-typechecker
|
||||
|
@ -35,7 +35,6 @@ dependencies:
|
||||
- friendly-time
|
||||
- generic-lens
|
||||
- haskeline
|
||||
- here
|
||||
- http-client >= 0.7.6
|
||||
- http-client-tls
|
||||
- http-types
|
||||
|
@ -176,7 +176,6 @@ library
|
||||
, fuzzyfind
|
||||
, generic-lens
|
||||
, haskeline
|
||||
, here
|
||||
, http-client >=0.7.6
|
||||
, http-client-tls
|
||||
, http-types
|
||||
@ -311,7 +310,6 @@ executable cli-integration-tests
|
||||
, fuzzyfind
|
||||
, generic-lens
|
||||
, haskeline
|
||||
, here
|
||||
, http-client >=0.7.6
|
||||
, http-client-tls
|
||||
, http-types
|
||||
@ -440,7 +438,6 @@ executable transcripts
|
||||
, fuzzyfind
|
||||
, generic-lens
|
||||
, haskeline
|
||||
, here
|
||||
, http-client >=0.7.6
|
||||
, http-client-tls
|
||||
, http-types
|
||||
@ -575,7 +572,6 @@ executable unison
|
||||
, fuzzyfind
|
||||
, generic-lens
|
||||
, haskeline
|
||||
, here
|
||||
, http-client >=0.7.6
|
||||
, http-client-tls
|
||||
, http-types
|
||||
|
Loading…
Reference in New Issue
Block a user