mirror of
https://github.com/github/semantic.git
synced 2024-12-24 15:35:14 +03:00
Specify version bounds in .cabal file (#1)
Establish library bounds based on Stackage LTS 13.13. We use the new cabal `^>=` operator to establish PVP-compatible versioning.
This commit is contained in:
parent
0f01935571
commit
b2bbda5fca
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,5 +31,3 @@ tmp/
|
|||||||
.licenses/log/
|
.licenses/log/
|
||||||
|
|
||||||
codex.tags
|
codex.tags
|
||||||
|
|
||||||
vendor/proto3-suite
|
|
||||||
|
16
README.md
16
README.md
@ -94,9 +94,21 @@ Available options:
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
`semantic` is built using [`cabal`](https://www.haskell.org/cabal/) and the [ghc](https://www.haskell.org/ghc/) compiler. To get started:
|
We use `cabal's` [Nix-style local builds][nix] for development. To get started quickly:
|
||||||
|
|
||||||
1. **TBD**
|
```bash
|
||||||
|
git clone git@github.com:github/semantic.git
|
||||||
|
cd semantic
|
||||||
|
git submodule sync --recursive && git submodule update --init --recursive --force
|
||||||
|
cabal new-build
|
||||||
|
cabal new-test
|
||||||
|
```
|
||||||
|
|
||||||
|
`semantic` requires GHC 8.6.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. Our version bounds are based on [Stackage][stackage] LTS versions. The current LTS version is 13.13; `stack` build should also work if you prefer.
|
||||||
|
|
||||||
|
[nix]: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html
|
||||||
|
[stackage]: https://stackage.org
|
||||||
|
[ghcup]: https://www.haskell.org/ghcup/
|
||||||
|
|
||||||
## Technology and architecture
|
## Technology and architecture
|
||||||
|
|
||||||
|
3
cabal.project
Normal file
3
cabal.project
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
packages: vendor/* vendor/proto3-suite vendor/haskell-tree-sitter/languages/* semantic.cabal
|
||||||
|
|
||||||
|
package proto3-suite
|
68
script/clone-example-repos
Executable file
68
script/clone-example-repos
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#/ Usage: script/clone-example-repos
|
||||||
|
#/
|
||||||
|
#/ Clone some example repositories for smoke testing parsing and assignment
|
||||||
|
#/
|
||||||
|
#/ NOTES:
|
||||||
|
#/ - This script is intended to be called by `test/Examples.hs`
|
||||||
|
#/ - Go and Ruby examples are in submodules
|
||||||
|
#/ - PHP doesn't have any parse-examples
|
||||||
|
#/ - Java and Haskell have good examples, but they have assignment failures so currently aren't tested
|
||||||
|
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd $(dirname "$0")/..
|
||||||
|
|
||||||
|
dir="vendor/haskell-tree-sitter/languages"
|
||||||
|
|
||||||
|
# clone_repo LOCAL_PATH URL SHA
|
||||||
|
function clone_repo {
|
||||||
|
path=$1
|
||||||
|
url="https://github.com/$2"
|
||||||
|
sha=$3
|
||||||
|
|
||||||
|
if [ ! -d "$path" ]; then
|
||||||
|
echo "Cloning $url@$sha"
|
||||||
|
git clone "$url" "$path"
|
||||||
|
else
|
||||||
|
echo "$url@$sha already exists"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd "$path" > /dev/null # && git pull -q # NB: Enable this if you need to pin to a different sha for one of the repos.
|
||||||
|
git reset --hard -q $sha
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
python_examples="$dir/python/vendor/tree-sitter-python/examples"
|
||||||
|
clone_repo "$python_examples/numpy" numpy/numpy 058851c5cfc98f50f11237b1c13d77cfd1f40475
|
||||||
|
clone_repo "$python_examples/thealgorithms" thealgorithms/python c6be53e1c43f870f5364eef1499ee1b411c966fb
|
||||||
|
clone_repo "$python_examples/flask" pallets/flask 0b5b4a66ef99c8b91569dd9b9b34911834689d3f
|
||||||
|
clone_repo "$python_examples/httpie" jakubroztocil/httpie 358342d1c915d6462a080a77aefbb20166d0bd5d
|
||||||
|
clone_repo "$python_examples/keras" keras-team/keras e59570ae26670f788d6c649191031e4a8824f955
|
||||||
|
clone_repo "$python_examples/requests" requests/requests 64bde6582d9b49e9345d9b8df16aaa26dc372d13
|
||||||
|
clone_repo "$python_examples/scikit-learn" scikit-learn/scikit-learn d0f63a760d9993a7f68cfc5e1a075700d67c53d3
|
||||||
|
clone_repo "$python_examples/scrapy" scrapy/scrapy 65d631329a1434ec013f24341e4b8520241aec70
|
||||||
|
clone_repo "$python_examples/pytorch" pytorch/pytorch c865d46736db4afff51690a712e35ed8e3899490
|
||||||
|
clone_repo "$python_examples/certbot" certbot/certbot bb8222200a8cbd39a3ce9584ce6dfed6c5d05228
|
||||||
|
|
||||||
|
ts_examples="$dir/typescript/vendor/tree-sitter-typescript/examples"
|
||||||
|
clone_repo "$ts_examples/desktop" desktop/desktop d1324f56d02dd9afca5d2e9da545905a7d41d671
|
||||||
|
|
||||||
|
java_examples="$dir/java/vendor/tree-sitter-java/examples"
|
||||||
|
clone_repo "$java_examples/elasticsearch" elastic/elasticsearch 4d62640bf116af7e825d89c7319a39c3f2f325b4
|
||||||
|
clone_repo "$java_examples/guava" google/guava e24fddc5fff7fd36d33ea38737b6606a7e476845
|
||||||
|
clone_repo "$java_examples/RxJava" ReactiveX/RxJava 8a6bf14fc9a61f7c1c0016ca217be02ca86211d2
|
||||||
|
|
||||||
|
clone_repo "$ts_examples/npm" npm/npm ee147fbbca6f2707d3b16f4fa78f4c4606b2d9b1
|
||||||
|
|
||||||
|
haskell_examples="$dir/haskell/vendor/tree-sitter-haskell/examples"
|
||||||
|
clone_repo "$haskell_examples/effects" joshvera/effects 08f5f36f2600362685af593f4b327e933b60bf97
|
||||||
|
clone_repo "$haskell_examples/postgrest" PostgRest/postgrest f80cfbf165f951a062b3cbedac4556019905ca49
|
||||||
|
clone_repo "$haskell_examples/ivory" GaloisInc/ivory 3d00324ad1c113c7e70957ff6a6d636d271d0fc4
|
||||||
|
|
||||||
|
go_examples="$dir/go/vendor/tree-sitter-go/examples"
|
||||||
|
clone_repo "$go_examples/go" "golang/go" "870e12d7bfaea70fb0d743842f5864eb059cb939"
|
||||||
|
clone_repo "$go_examples/moby" "moby/moby" "f57f260b49b6142366e6bc1274204ee0a1205945"
|
||||||
|
|
||||||
|
ruby_examples="$dir/ruby/vendor/tree-sitter-ruby/examples"
|
||||||
|
clone_repo "$ruby_examples/ruby_spec" "ruby/spec" "c3e6b9017926f44a76e2b966c4dd35fa84c4cd3b"
|
@ -37,20 +37,20 @@ generate_example () {
|
|||||||
|
|
||||||
if [ -e "$fileA" ]; then
|
if [ -e "$fileA" ]; then
|
||||||
status $parseFileA
|
status $parseFileA
|
||||||
stack exec semantic -- parse --sexpression $fileA > $parseFileA
|
cabal new-run semantic -- parse --sexpression $fileA > $parseFileA
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$fileB" ]; then
|
if [ -e "$fileB" ]; then
|
||||||
status $parseFileB
|
status $parseFileB
|
||||||
stack exec semantic -- parse --sexpression $fileB > $parseFileB
|
cabal new-run semantic -- parse --sexpression $fileB > $parseFileB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$fileA" -a -e "$fileB" ]; then
|
if [ -e "$fileA" -a -e "$fileB" ]; then
|
||||||
status $diffFileAB
|
status $diffFileAB
|
||||||
stack exec semantic -- diff --sexpression $fileA $fileB > $diffFileAB
|
cabal new-run semantic -- diff --sexpression $fileA $fileB > $diffFileAB
|
||||||
|
|
||||||
status $diffFileBA
|
status $diffFileBA
|
||||||
stack exec semantic -- diff --sexpression $fileB $fileA > $diffFileBA
|
cabal new-run semantic -- diff --sexpression $fileB $fileA > $diffFileBA
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
124
semantic.cabal
124
semantic.cabal
@ -13,6 +13,8 @@ category: Web
|
|||||||
build-type: Simple
|
build-type: Simple
|
||||||
stability: alpha
|
stability: alpha
|
||||||
|
|
||||||
|
tested-with: GHC == 8.6.4
|
||||||
|
|
||||||
flag release
|
flag release
|
||||||
description: Build with optimizations on (for CI or deployment builds)
|
description: Build with optimizations on (for CI or deployment builds)
|
||||||
default: False
|
default: False
|
||||||
@ -35,33 +37,36 @@ common haskell
|
|||||||
, StrictData
|
, StrictData
|
||||||
, TypeApplications
|
, TypeApplications
|
||||||
|
|
||||||
|
-- Except in case of vendored dependencies, these deps should be expressed
|
||||||
|
-- as caret-operator bounds relative to a version in Stackage.
|
||||||
|
-- These are currently pinned to lts-13.13.
|
||||||
common dependencies
|
common dependencies
|
||||||
build-depends: base >= 4.8 && < 5
|
build-depends: base >= 4.8 && < 5
|
||||||
, aeson
|
, aeson ^>= 1.4.2.0
|
||||||
, algebraic-graphs
|
, algebraic-graphs ^>= 0.3
|
||||||
, async
|
, async ^>= 2.2.1
|
||||||
, bifunctors
|
, bifunctors ^>= 5.5
|
||||||
, bytestring
|
, bytestring ^>= 0.10.8.2
|
||||||
, containers
|
, containers ^>= 0.6.0.1
|
||||||
, directory
|
, directory ^>= 1.3.3.0
|
||||||
, fastsum
|
, fastsum
|
||||||
, filepath
|
, filepath ^>= 1.4.2.1
|
||||||
, free
|
, free ^>= 5.1
|
||||||
, fused-effects
|
, fused-effects
|
||||||
, fused-effects-exceptions
|
, fused-effects-exceptions
|
||||||
, hashable
|
, hashable ^>= 1.2.7.0
|
||||||
, haskell-tree-sitter
|
, haskell-tree-sitter
|
||||||
, machines
|
, machines ^>= 0.6.4
|
||||||
, mtl
|
, mtl ^>= 2.2.2
|
||||||
, network
|
, network ^>= 2.8.0.0
|
||||||
, process
|
, process
|
||||||
, recursion-schemes
|
, recursion-schemes ^>= 5.1
|
||||||
, scientific
|
, scientific ^>= 0.3.6.2
|
||||||
, safe-exceptions
|
, safe-exceptions
|
||||||
, semilattices
|
, semilattices
|
||||||
, text
|
, text ^>= 1.2.3.1
|
||||||
, these
|
, these >= 0.7 && <1
|
||||||
, unix
|
, unix ^>= 2.7.2.2
|
||||||
, proto3-suite
|
, proto3-suite
|
||||||
, proto3-wire
|
, proto3-wire
|
||||||
|
|
||||||
@ -276,46 +281,47 @@ library
|
|||||||
, Tags.Tagging
|
, Tags.Tagging
|
||||||
-- Custom Prelude
|
-- Custom Prelude
|
||||||
, Prologue
|
, Prologue
|
||||||
|
|
||||||
build-depends: base >= 4.8 && < 5
|
build-depends: base >= 4.8 && < 5
|
||||||
, ansi-terminal
|
, ansi-terminal ^>= 0.8.2
|
||||||
, array
|
, array ^>= 0.5.3.0
|
||||||
, attoparsec
|
, attoparsec ^>= 0.13.2.2
|
||||||
, cmark-gfm
|
, cmark-gfm == 0.1.8
|
||||||
, cryptohash
|
, cryptohash ^>= 0.11.9
|
||||||
, deepseq
|
, deepseq ^>= 1.4.4.0
|
||||||
, directory-tree
|
, directory-tree ^>= 0.12.1
|
||||||
, freer-cofreer
|
, freer-cofreer
|
||||||
, generic-monoid
|
, generic-monoid ^>= 0.1.0.0
|
||||||
, ghc-prim
|
, ghc-prim ^>= 0.5.3
|
||||||
, gitrev
|
, gitrev ^>= 1.3.1
|
||||||
, haskeline
|
, haskeline ^>= 0.7.5.0
|
||||||
, hostname
|
, hostname ^>= 1.0
|
||||||
, hscolour
|
, hscolour ^>= 1.24.4
|
||||||
, http-client
|
, http-client ^>= 0.6.2
|
||||||
, http-client-tls
|
, http-client-tls ^>= 0.3.5.3
|
||||||
, http-types
|
, http-types ^>= 0.12.3
|
||||||
, http-media
|
, http-media ^>= 0.7.1.3
|
||||||
, kdt
|
, kdt ^>= 0.2.4
|
||||||
, lens
|
, lens ^>= 4.17
|
||||||
, mersenne-random-pure64
|
, mersenne-random-pure64 ^>= 0.2.2.0
|
||||||
, network-uri
|
, network-uri ^>= 2.6.1.0
|
||||||
, optparse-applicative
|
, optparse-applicative ^>= 0.14.3.0
|
||||||
, parallel
|
, parallel ^>= 3.2.2.0
|
||||||
, parsers
|
, parsers ^>= 0.12.9
|
||||||
, pretty-show
|
, prettyprinter ^>= 1.2.1
|
||||||
, prettyprinter
|
, pretty-show ^>= 1.9.5
|
||||||
, profunctors
|
, profunctors ^>= 5.3
|
||||||
, reducers
|
, reducers ^>= 3.12.3
|
||||||
, semigroupoids
|
, semigroupoids ^>= 5.3.2
|
||||||
, servant
|
, servant ^>= 0.15
|
||||||
, shelly
|
, shelly
|
||||||
, split
|
, split ^>= 0.2.3.3
|
||||||
, stm-chans
|
, stm-chans ^>= 3.0.0.4
|
||||||
, template-haskell
|
, template-haskell ^>= 2.14
|
||||||
, time
|
, time ^>= 1.8.0.2
|
||||||
, unliftio-core
|
, unliftio-core
|
||||||
, unordered-containers
|
, unordered-containers ^>= 0.2.9.0
|
||||||
, vector
|
, vector ^>= 0.12.0.2
|
||||||
, haskell-tree-sitter
|
, haskell-tree-sitter
|
||||||
, tree-sitter-go
|
, tree-sitter-go
|
||||||
, tree-sitter-haskell
|
, tree-sitter-haskell
|
||||||
@ -391,11 +397,11 @@ test-suite test
|
|||||||
build-depends: semantic
|
build-depends: semantic
|
||||||
, tree-sitter-json
|
, tree-sitter-json
|
||||||
, Glob
|
, Glob
|
||||||
, hspec >= 2.4.1
|
, hspec >= 2.6 && <3
|
||||||
, hspec-core
|
, hspec-core >= 2.6 && <3
|
||||||
, hspec-expectations-pretty-diff
|
, hspec-expectations-pretty-diff ^>= 0.7.2.5
|
||||||
, HUnit
|
, HUnit ^>= 1.6.0.0
|
||||||
, leancheck
|
, leancheck >= 0.8 && <1
|
||||||
, temporary
|
, temporary
|
||||||
ghc-options: -O0
|
ghc-options: -O0
|
||||||
if flag(release)
|
if flag(release)
|
||||||
|
1
vendor/proto3-suite
vendored
Submodule
1
vendor/proto3-suite
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 83f3352f0c7c94ea091e6087f60692eda9991fae
|
1
vendor/proto3-wire
vendored
Submodule
1
vendor/proto3-wire
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 84664e22f01beb67870368f1f88ada5d0ad01f56
|
Loading…
Reference in New Issue
Block a user