diff options
author | Yuchen Pei <hi@ypei.me> | 2022-06-09 11:59:03 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-06-09 11:59:03 +1000 |
commit | 5e5272e73a846dd79df67848baa823e0a09479dd (patch) | |
tree | 473f747e82e446db51fe8c93578ae24e4f15e421 | |
parent | 96eb626870127ae8bd4d9d7908b4a7f3def164fe (diff) |
cleaned up the tree and updated readme
-rw-r--r-- | README.md.original (renamed from README.md) | 0 | ||||
-rw-r--r-- | README.org | 16 | ||||
-rw-r--r-- | cabal.project.freeze | 228 | ||||
-rwxr-xr-x | install.hs | 171 | ||||
-rw-r--r-- | stack-8.0.2.yaml | 7 | ||||
-rw-r--r-- | stack-8.2.2.yaml | 7 | ||||
-rw-r--r-- | stack-8.4.3.yaml | 7 | ||||
-rw-r--r-- | stack-8.4.4.yaml | 7 | ||||
-rw-r--r-- | stack-8.6.3.yaml | 7 | ||||
-rw-r--r-- | stack-8.6.4.yaml | 7 | ||||
-rw-r--r-- | stack-8.6.5.yaml | 7 | ||||
-rw-r--r-- | stack-8.8.3.yaml | 12 | ||||
-rw-r--r-- | stack.yaml | 6 |
13 files changed, 15 insertions, 467 deletions
diff --git a/README.md b/README.md.original index 0a9beaa..0a9beaa 100644 --- a/README.md +++ b/README.md.original @@ -20,20 +20,28 @@ example: cabal unpack sqlite-simple cd sqlite-simple-x.y.z.w cabal configure --enable-testsuites --enable-benchmarks -cabal build +cabal build all haskell-code-indexer -p . #+end_src After this you can do #+begin_src sh -haskell-code-server -p /path/to/package1 -p /path/to/packag2 ... +haskell-code-server -p /path/to/package1 -p /path/to/package2 ... #+end_src and the app will be available at localhost:3000. -For the readme of the original version, see README.md, also available -at https://g.ypei.me/haskell-code-explorer.git/tree/README.md. +For the readme of the original version, see README.md.original in the +project tree, also available at +https://g.ypei.me/haskell-code-explorer.git/tree/README.md.original. + +* Difference from the original version + +The indexer of this version looks for all build targets, including +testsuites and benchmarks, in the .cabal file, therefore you'll need +to build them all before indexing, otherwise the indexer will complain +about missing files. * Contact and Copyright diff --git a/cabal.project.freeze b/cabal.project.freeze deleted file mode 100644 index 1a0ad4b..0000000 --- a/cabal.project.freeze +++ /dev/null @@ -1,228 +0,0 @@ -constraints: any.Cabal ==2.2.0.1 || ==2.4.0.1, - Cabal -bundled-binary-generic, - any.HTTP ==4000.3.12, - HTTP -conduit10 -mtl1 +network-uri -warn-as-error +warp-tests, - any.HUnit ==1.6.0.0, - any.IntervalMap ==0.6.0.0, - any.QuickCheck ==2.12.6.1, - QuickCheck +templatehaskell, - any.StateVar ==1.1.1.1, - any.aeson ==1.4.1.0, - aeson -bytestring-builder -cffi -developer -fast, - any.ansi-terminal ==0.8.2, - ansi-terminal -example, - any.ansi-wl-pprint ==0.6.8.2, - ansi-wl-pprint -example, - any.appar ==0.1.4, - any.array ==0.5.2.0, - any.async ==2.2.1, - async -bench, - any.attoparsec ==0.13.2.2, - attoparsec -developer, - any.attoparsec-iso8601 ==1.0.1.0, - attoparsec-iso8601 -developer -fast, - any.auto-update ==0.1.4, - any.base ==4.11.1.0, - any.base-compat ==0.10.5, - any.base-orphans ==0.8, - any.base16-bytestring ==0.1.1.6, - any.base64-bytestring ==1.0.0.1, - any.basement ==0.0.8, - any.bifunctors ==5.5.3, - bifunctors +semigroups +tagged, - any.binary ==0.8.5.1, - any.blaze-builder ==0.4.1.0, - any.blaze-html ==0.9.1.1, - any.blaze-markup ==0.8.2.2, - any.bsb-http-chunked ==0.0.0.4, - any.byteorder ==1.0.4, - any.bytestring ==0.10.8.2, - any.cabal-doctest ==1.0.6, - cabal-helper -dev, - any.cabal-install ==2.4.0.0, - cabal-install -debug-conflict-sets -debug-expensive-assertions -debug-tracetree +native-dns, - any.cabal-plan ==0.4.0.0, - cabal-plan -_ +exe -license-report, - any.call-stack ==0.1.0, - any.case-insensitive ==1.2.0.11, - any.cereal ==0.5.7.0, - cereal -bytestring-builder, - any.clock ==0.7.2, - clock -llvm, - any.colour ==2.3.4, - any.comonad ==5.0.4, - comonad +containers +contravariant +distributive +test-doctests, - any.conduit ==1.3.1, - any.conduit-extra ==1.3.0, - any.containers ==0.5.11.0, - any.contravariant ==1.5, - contravariant -safe +semigroups +statevar +tagged, - any.cookie ==0.4.4, - any.cryptohash-sha256 ==0.11.101.0, - cryptohash-sha256 -exe, - any.cryptonite ==0.25, - cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse, - any.data-default ==0.7.1.1, - any.data-default-class ==0.1.2.0, - any.data-default-instances-containers ==0.0.1, - any.data-default-instances-dlist ==0.0.1, - any.data-default-instances-old-locale ==0.0.1, - any.deepseq ==1.4.3.0, - any.digest ==0.0.1.2, - digest -bytestring-in-base, - any.directory ==1.3.1.5, - any.directory-tree ==0.12.1, - any.distributive ==0.6, - distributive +semigroups +tagged, - any.dlist ==0.8.0.5, - any.easy-file ==0.2.2, - any.echo ==0.1.3, - echo -example, - any.ed25519 ==0.0.5.0, - ed25519 +no-donna +test-doctests +test-hlint +test-properties, - any.edit-distance ==0.2.2.1, - any.erf ==2.0.0.0, - any.exceptions ==0.10.0, - any.expiring-cache-map ==0.0.6.1, - any.extra ==1.6.13, - any.fast-logger ==2.4.11, - any.file-embed ==0.0.11, - any.filemanip ==0.3.6.3, - any.filepath ==1.4.2, - any.ghc ==8.4.4, - any.ghc-boot ==8.4.4, - any.ghc-boot-th ==8.4.4, - any.ghc-compact ==0.1.0.0, - any.ghc-paths ==0.1.0.9, - any.ghc-prim ==0.5.2.0, - any.ghci ==8.4.4, - any.hackage-security ==0.5.3.0, - hackage-security +base48 -old-directory +use-network-uri, - any.haddock-library ==1.7.0, - any.happy ==1.19.9, - happy +small_base, - any.hashable ==1.2.7.0, - hashable -examples +integer-gmp +sse2 -sse41, - any.haskell-lexer ==1.0.2, - any.hpc ==0.6.0.3, - any.hsc2hs ==0.68.3, - hsc2hs -in-ghc-tree, - any.hspec ==2.6.0, - any.hspec-core ==2.6.0, - any.hspec-discover ==2.6.0, - any.hspec-expectations ==0.8.2, - any.http-api-data ==0.4, - http-api-data -use-text-show, - any.http-date ==0.0.8, - any.http-media ==0.7.1.3, - any.http-types ==0.12.2, - any.http2 ==1.6.4, - http2 -devel, - any.integer-gmp ==1.0.2.0, - any.integer-logarithms ==1.0.2.2, - integer-logarithms -check-bounds +integer-gmp, - any.iproute ==1.7.6, - any.lifted-base ==0.2.3.12, - any.memory ==0.14.18, - memory +support_basement +support_bytestring +support_deepseq +support_foundation, - any.mime-types ==0.1.0.8, - any.mmorph ==1.1.2, - any.monad-control ==1.0.2.3, - any.monad-logger ==0.3.30, - monad-logger +template_haskell, - any.monad-loops ==0.4.3, - monad-loops +base4, - any.mono-traversable ==1.0.9.0, - any.mtl ==2.2.2, - any.network ==2.8.0.0, - any.network-byte-order ==0.0.0.0, - any.network-uri ==2.6.1.0, - any.old-locale ==1.0.0.7, - any.old-time ==1.1.0.3, - any.optparse-applicative ==0.14.3.0, - any.pagination ==0.2.1, - pagination -dev, - any.parsec ==3.1.13.0, - any.pretty ==1.1.3.6, - any.pretty-show ==1.8.2, - any.primitive ==0.6.4.0, - any.process ==1.6.3.0, - any.psqueues ==0.2.7.0, - any.quickcheck-io ==0.2.0, - any.random ==1.1, - any.resolv ==0.1.1.2, - any.resourcet ==1.2.2, - any.rts ==1.0, - any.scientific ==0.3.6.2, - scientific -bytestring-builder -integer-simple, - any.semigroupoids ==5.2.2, - semigroupoids +comonad +containers +contravariant +distributive +doctests +tagged +unordered-containers, - any.semigroups ==0.18.5, - semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +text +transformers +unordered-containers, - any.servant ==0.15, - any.servant-server ==0.15, - any.setenv ==0.1.1.3, - any.simple-sendfile ==0.2.27, - simple-sendfile +allow-bsd, - any.singleton-bool ==0.1.4, - any.split ==0.2.3.3, - any.stm ==2.4.5.1, - any.stm-chans ==3.0.0.4, - any.streaming-commons ==0.2.1.0, - streaming-commons -use-bytestring-builder, - any.string-conversions ==0.4.0.1, - any.syb ==0.7, - any.tagged ==0.8.6, - tagged +deepseq +transformers, - any.tar ==0.5.1.0, - tar -old-bytestring -old-time, - any.template-haskell ==2.13.0.0, - any.temporary ==1.2.1.1, - any.terminfo ==0.4.1.1, - any.text ==1.2.3.1, - any.tf-random ==0.5, - any.th-abstraction ==0.2.8.0, - any.time ==1.8.0.2, - any.time-locale-compat ==0.1.1.5, - time-locale-compat -old-locale, - any.transformers ==0.5.5.0, - any.transformers-base ==0.4.5.2, - transformers-base +orphaninstances, - any.transformers-compat ==0.6.2, - transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, - any.typed-process ==0.2.3.0, - any.uniplate ==1.6.12, - uniplate +separate_syb +typeable_fingerprint, - any.unix ==2.7.2.2, - any.unix-compat ==0.5.1, - unix-compat -old-time, - any.unix-time ==0.3.8, - any.unliftio-core ==0.1.2.0, - any.unordered-containers ==0.2.9.0, - unordered-containers -debug, - any.uri-encode ==1.5.0.5, - uri-encode +network-uri -tools, - any.utf8-string ==1.0.1.1, - any.uuid-types ==1.0.3, - any.vault ==0.3.1.2, - vault +useghc, - any.vector ==0.12.0.1, - vector +boundschecks -internalchecks -unsafechecks -wall, - any.vector-algorithms ==0.8.0.1, - vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, - any.void ==0.7.2, - void -safe, - any.wai ==3.2.1.2, - any.wai-app-static ==3.1.6.2, - wai-app-static -print, - any.wai-extra ==3.0.24.3, - wai-extra -build-example, - any.wai-logger ==2.3.2, - any.wai-middleware-static ==0.8.2, - any.warp ==3.2.25, - warp +allow-sendfilefd -network-bytestring -warp-debug, - any.word8 ==0.1.3, - any.zip-archive ==0.3.3, - zip-archive -executable, - any.zlib ==0.6.2, - zlib -non-blocking-ffi -pkg-config diff --git a/install.hs b/install.hs deleted file mode 100755 index 6db36fa..0000000 --- a/install.hs +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env stack -{- stack script - --resolver lts-13.12 - --ghc-options -Wall - --package bytestring,text,filepath,directory,optparse-applicative,typed-process --} - -{-# LANGUAGE CPP #-} --- = About --- --- Install multiple versions of haskell-code-indexer, each with the version of --- GHC it was built with appended to the executable name. --- --- = Original --- --- Modified from the BSD3 licensed script at: --- https://github.com/haskell/haskell-ide-engine/blob/ec5e34ca52d389b713df918f02ff63920aede4be/install.hs --- --- Thanks haskell-ide-engine folks! --- --- = Changes from the original --- --- + Switched from Shake to IO script --- + Added optparse-applicative --- + Switched to Stack only (PRs welcome to support other tools) -module Main (main) where - -import Control.Monad -import Data.ByteString (ByteString) -import qualified Data.ByteString.Lazy as LBS -import Data.Char (isSpace) -import Data.Foldable -import Data.List (dropWhileEnd) -import qualified Data.Text as T -import Data.Text.Encoding -import System.FilePath ((<.>), (</>)) -import Options.Applicative -import System.Directory (copyFile, removeFile) -import System.Process.Typed - --- | Keep this in sync with the stack.yamls at the top level of the project. -supportedGhcVersions :: [Version] -supportedGhcVersions = - map Version ["8.0.2", "8.2.2", "8.4.3", "8.4.4", "8.6.3", "8.6.4","8.6.5"] - -newtype Version = Version { unVersion :: String } deriving Eq - --- * CLI args - -data Args = Args - { argBuildVersions :: [Version] - , argBuildServer :: Bool - } - -cliArgs :: IO Args -cliArgs = - customExecParser (prefs showHelpOnError) argsParser - -argsParser :: ParserInfo Args -argsParser = - fmap defaultToAll $ - info (helper <*> parser) (fullDesc <> progDesc desc) - where - parser :: Parser Args - parser = - Args - <$> (some indexVersion <|> pure mempty) - <*> switch - ( long "server" - <> help "Build haskell-code-server" - ) - - indexVersion :: Parser Version - indexVersion = - argument (eitherReader checkVersion) - ( metavar "INDEX_VERSION" - <> help "haskell-code-indexer-X-Y-Z version to build" - ) - - checkVersion :: String -> Either String Version - checkVersion s = - case find ((==) (Version s)) supportedGhcVersions of - Nothing -> - Left . unwords $ - "Not a supported GHC version. Currently supported versions are:" - : map unVersion supportedGhcVersions - - Just v -> - Right v - - defaultToAll :: Args -> Args - defaultToAll args = - if argBuildVersions args == mempty && argBuildServer args == False - then Args (reverse supportedGhcVersions) True -- reverse to build latest first - else args - - desc :: String - desc = - "Install haskell-code-indexer executables with the GHC version they were" - <> " compiled with appended to their name. Builds everything if you don't" - <> " specify options. Note that if you already have an indexer executable" - <> " without the GHC version appended in your Stack's local bin" - <> " it will be deleted." - --- * Build - -main :: IO () -main = - run =<< cliArgs - -run :: Args -> IO () -run args = do - putStrLn (startupNotice args) - when (argBuildServer args) buildServer - for_ (argBuildVersions args) buildVersion - -startupNotice :: Args -> String -startupNotice args = - unlines - $ "Building:" - : (if argBuildServer args - then [" + haskell-code-explorer"] - else mempty) - <> map versionEntry (argBuildVersions args) - where - versionEntry :: Version -> String - versionEntry v = - " + haskell-code-indexer-" <> unVersion v - -buildServer :: IO () -buildServer = - void $ execStack ["build", "--copy-bins", "haskell-code-explorer:haskell-code-server"] - -buildVersion :: Version -> IO () -buildVersion v = do - execStackWithVersion_ v ["build", "--copy-bins", "haskell-code-explorer:haskell-code-indexer"] - localBinDir <- getLocalBin - - let - -- exe is "exe" on Windows and "" otherwise - fromFile = localBinDir </> "haskell-code-indexer" <.> exe - toFile = localBinDir </> "haskell-code-indexer-" ++ unVersion v <.> exe - - copyFile fromFile toFile - removeFile fromFile - -exe :: String -#if defined(mingw32_HOST_OS) -exe = "exe" -#else -exe = "" -#endif - --- | E.g. @"/home/user/bin"@. -getLocalBin :: IO FilePath -getLocalBin = do - stackLocalDir' <- decodeUtf8 <$> execStack ["path", "--stack-yaml=stack.yaml", "--local-bin"] - pure $ trimEnd (T.unpack stackLocalDir') - --- | Uses the stack.yaml for the given @Version@. -execStackWithVersion_ :: Version -> [String] -> IO () -execStackWithVersion_ v args = do - let stackFile = "stack-" ++ unVersion v ++ ".yaml" - void $ execStack (("--stack-yaml=" ++ stackFile) : args) - -execStack :: [String] -> IO ByteString -execStack = - fmap LBS.toStrict . readProcessStdout_ . proc "stack" - -trimEnd :: String -> String -trimEnd = dropWhileEnd isSpace diff --git a/stack-8.0.2.yaml b/stack-8.0.2.yaml deleted file mode 100644 index 591dbd7..0000000 --- a/stack-8.0.2.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-9.14 -packages: -- '.' -extra-deps: - - servant-0.12.1 - - servant-server-0.12 - - cabal-helper-0.8.0.2 diff --git a/stack-8.2.2.yaml b/stack-8.2.2.yaml deleted file mode 100644 index 3815030..0000000 --- a/stack-8.2.2.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-11.3 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -extra-deps: - - cabal-plan-0.4.0.0 - - pretty-show-1.8.2 diff --git a/stack-8.4.3.yaml b/stack-8.4.3.yaml deleted file mode 100644 index d766956..0000000 --- a/stack-8.4.3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-12.12 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.4.4.yaml b/stack-8.4.4.yaml deleted file mode 100644 index c7fc9cc..0000000 --- a/stack-8.4.4.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-12.16 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.3.yaml b/stack-8.6.3.yaml deleted file mode 100644 index 498a9da..0000000 --- a/stack-8.6.3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-13.0 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml deleted file mode 100644 index 28009ab..0000000 --- a/stack-8.6.4.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-13.12 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml deleted file mode 100644 index f59b52d..0000000 --- a/stack-8.6.5.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-14.1 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml deleted file mode 100644 index 4ea255c..0000000 --- a/stack-8.8.3.yaml +++ /dev/null @@ -1,12 +0,0 @@ -resolver: lts-15.4 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - haddock-library-1.7.0@sha256:8f230ebb680b559256d9c18ce4942ba5bf220b167804b4ebd5cc9e47cc4973cd - - cabal-install-3.0.0.0@sha256:5e3c4376e53c06521cca2c037074423dbb967e228af6174bf842ff38aa82b035 - - git: https://github.com/haskell/hackage-security - commit: 2057cdf2abba852881cd9d055c96f03cd8c829e7 - subdirs: - - hackage-security @@ -1,7 +1,7 @@ -resolver: lts-14.1 +resolver: nightly-2022-06-06 packages: - '.' -- 'vendor/cabal-helper-0.8.1.2' +- 'vendor/cabal-helper' allow-newer: true extra-deps: - - cabal-plan-0.4.0.0 + - cabal-plan-0.7.2.1 |