Skip to content

Commit

Permalink
Move LSP dependencies under a condition, update CPP code
Browse files Browse the repository at this point in the history
  • Loading branch information
fizruk committed Sep 30, 2023
1 parent 24ca087 commit 19ff8d5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 58 deletions.
24 changes: 13 additions & 11 deletions rzk/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ description: Please see the README on GitHub at <https://github.com/rzk-lang/rzk
flags:
lsp:
description: >-
Build with LSP support.
Build with LSP support (only available with GHC, not GHCJS).
manual: true
default: true

Expand All @@ -31,21 +31,14 @@ build-tools:

dependencies:
array: ">= 0.5.3.0"
aeson: ">= 1.4.2.0"
base: ">= 4.7 && < 5"
bifunctors: ">= 5.5.3"
bytestring: ">= 0.10.8.2"
Glob: ">= 0.9.3"
mtl: ">= 2.2.2"
optparse-generic: ">= 1.3.0"
template-haskell: ">= 2.14.0.0"
text: ">= 1.2.3.1"
optparse-generic: ">= 1.3.0"
Glob: ">= 0.9.3"
lens: ">= 4.17"
filepath: ">= 1.4.2.1"
stm: ">= 2.5.0.0"
yaml: ">= 0.11.0.0"
data-default-class: ">= 0.1.2.0"
co-log-core: ">= 0.3.2.0"

ghc-options:
- -Wall
Expand Down Expand Up @@ -73,9 +66,18 @@ library:
- Language.Rzk.VSCode.Lsp
- Language.Rzk.VSCode.State
- Language.Rzk.VSCode.Tokenize
- Language.Rzk.VSCode.Logging
dependencies:
aeson: ">= 1.4.2.0"
co-log-core: ">= 0.3.2.0"
data-default-class: ">= 0.1.2.0"
filepath: ">= 1.4.2.1"
lens: ">= 4.17"
lsp: ">= 2.1.0.0"
lsp-types: ">= 2.0.1.0"
stm: ">= 2.5.0.0"
yaml: ">= 0.11.0.0"
cpp-options: -DLSP

executables:
rzk:
Expand All @@ -88,7 +90,7 @@ executables:
dependencies:
- rzk
when:
- condition: flag(lsp) && !impl(ghcjs)
- condition: "!impl(ghcjs)"
dependencies:
with-utf8: ">= 1.0.2.4"

Expand Down
44 changes: 12 additions & 32 deletions rzk/rzk.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source-repository head
location: https://github.com/rzk-lang/rzk

flag lsp
description: Build with LSP support.
description: Build with LSP support (only available with GHC, not GHCJS).
manual: True
default: True

Expand All @@ -41,7 +41,6 @@ library
Language.Rzk.Syntax.Lex
Language.Rzk.Syntax.Par
Language.Rzk.Syntax.Print
Language.Rzk.VSCode.Logging
Rzk
Rzk.Main
Rzk.TypeCheck
Expand All @@ -55,21 +54,14 @@ library
, happy >=1.19.9
build-depends:
Glob >=0.9.3
, aeson >=1.4.2.0
, array >=0.5.3.0
, base >=4.7 && <5
, bifunctors >=5.5.3
, bytestring >=0.10.8.2
, co-log-core >=0.3.2.0
, data-default-class >=0.1.2.0
, filepath >=1.4.2.1
, lens >=4.17
, mtl >=2.2.2
, optparse-generic >=1.3.0
, stm >=2.5.0.0
, template-haskell >=2.14.0.0
, text >=1.2.3.1
, yaml >=0.11.0.0
default-language: Haskell2010
if flag(lsp) && !impl(ghcjs)
exposed-modules:
Expand All @@ -78,9 +70,18 @@ library
Language.Rzk.VSCode.Lsp
Language.Rzk.VSCode.State
Language.Rzk.VSCode.Tokenize
Language.Rzk.VSCode.Logging
cpp-options: -DLSP
build-depends:
lsp >=2.1.0.0
aeson >=1.4.2.0
, co-log-core >=0.3.2.0
, data-default-class >=0.1.2.0
, filepath >=1.4.2.1
, lens >=4.17
, lsp >=2.1.0.0
, lsp-types >=2.0.1.0
, stm >=2.5.0.0
, yaml >=0.11.0.0

executable rzk
main-is: Main.hs
Expand All @@ -94,24 +95,17 @@ executable rzk
, happy >=1.19.9
build-depends:
Glob >=0.9.3
, aeson >=1.4.2.0
, array >=0.5.3.0
, base >=4.7 && <5
, bifunctors >=5.5.3
, bytestring >=0.10.8.2
, co-log-core >=0.3.2.0
, data-default-class >=0.1.2.0
, filepath >=1.4.2.1
, lens >=4.17
, mtl >=2.2.2
, optparse-generic >=1.3.0
, rzk
, stm >=2.5.0.0
, template-haskell >=2.14.0.0
, text >=1.2.3.1
, yaml >=0.11.0.0
default-language: Haskell2010
if flag(lsp) && !impl(ghcjs)
if !impl(ghcjs)
build-depends:
with-utf8 >=1.0.2.4

Expand All @@ -127,22 +121,15 @@ test-suite doctests
build-depends:
Glob
, QuickCheck
, aeson >=1.4.2.0
, array >=0.5.3.0
, base
, bifunctors >=5.5.3
, bytestring >=0.10.8.2
, co-log-core >=0.3.2.0
, data-default-class >=0.1.2.0
, doctest
, filepath >=1.4.2.1
, lens >=4.17
, mtl >=2.2.2
, optparse-generic >=1.3.0
, stm >=2.5.0.0
, template-haskell
, text >=1.2.3.1
, yaml >=0.11.0.0
default-language: Haskell2010

test-suite rzk-test
Expand All @@ -158,20 +145,13 @@ test-suite rzk-test
, happy >=1.19.9
build-depends:
Glob >=0.9.3
, aeson >=1.4.2.0
, array >=0.5.3.0
, base >=4.7 && <5
, bifunctors >=5.5.3
, bytestring >=0.10.8.2
, co-log-core >=0.3.2.0
, data-default-class >=0.1.2.0
, filepath >=1.4.2.1
, lens >=4.17
, mtl >=2.2.2
, optparse-generic >=1.3.0
, rzk
, stm >=2.5.0.0
, template-haskell >=2.14.0.0
, text >=1.2.3.1
, yaml >=0.11.0.0
default-language: Haskell2010
20 changes: 9 additions & 11 deletions rzk/rzk.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ mkDerivation, aeson, alex, array, base, bifunctors, bytestring
, data-default-class, doctest, filepath, Glob, happy, hpack, lens
, lib, mtl, optparse-generic, QuickCheck, stm, template-haskell
, text, yaml
{ mkDerivation, alex, array, base, bifunctors, bytestring, doctest
, Glob, happy, hpack, lib, mtl, optparse-generic, QuickCheck
, template-haskell, text
}:
mkDerivation {
pname = "rzk";
Expand All @@ -10,19 +9,18 @@ mkDerivation {
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson array base bifunctors bytestring data-default-class filepath
Glob lens mtl optparse-generic stm template-haskell text yaml
array base bifunctors bytestring Glob mtl optparse-generic
template-haskell text
];
libraryToolDepends = [ alex happy hpack ];
executableHaskellDepends = [
aeson array base bifunctors bytestring data-default-class filepath
Glob lens mtl optparse-generic stm template-haskell text yaml
array base bifunctors bytestring Glob mtl optparse-generic
template-haskell text
];
executableToolDepends = [ alex happy ];
testHaskellDepends = [
aeson array base bifunctors bytestring data-default-class doctest
filepath Glob lens mtl optparse-generic QuickCheck stm
template-haskell text yaml
array base bifunctors bytestring doctest Glob mtl optparse-generic
QuickCheck template-haskell text
];
testToolDepends = [ alex happy ];
prePatch = "hpack";
Expand Down
8 changes: 5 additions & 3 deletions rzk/src/Rzk/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ module Rzk.Main where
import Control.Monad (forM, void)
import Data.List (sort)
import Data.Version (showVersion)
#ifndef __GHCJS__

#ifdef LSP
import Language.Rzk.VSCode.Lsp (runLsp)
#endif

import Options.Generic
import System.Exit (exitFailure)
import System.FilePath.Glob (glob)
Expand Down Expand Up @@ -41,10 +43,10 @@ main = getRecord "rzk: an experimental proof assistant for synthetic ∞-categor
Right _decls -> putStrLn "Everything is ok!"

Lsp ->
#ifndef __GHCJS__
#ifdef LSP
void runLsp
#else
error "rzk lsp is not supported with a GHCJS build"
error "rzk lsp is not supported with this build"
#endif

Version -> putStrLn (showVersion version)
Expand Down
1 change: 0 additions & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resolver: snapshot.yaml
packages:
- rzk

0 comments on commit 19ff8d5

Please sign in to comment.