Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit b2bbda5

Browse files
Patrick Thomsondcreager
authored andcommitted
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.
1 parent 0f01935 commit b2bbda5

File tree

8 files changed

+156
-67
lines changed

8 files changed

+156
-67
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@ tmp/
3131
.licenses/log/
3232

3333
codex.tags
34-
35-
vendor/proto3-suite

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,21 @@ Available options:
9494

9595
## Development
9696

97-
`semantic` is built using [`cabal`](https://www.haskell.org/cabal/) and the [ghc](https://www.haskell.org/ghc/) compiler. To get started:
97+
We use `cabal's` [Nix-style local builds][nix] for development. To get started quickly:
98+
99+
```bash
100+
git clone [email protected]:github/semantic.git
101+
cd semantic
102+
git submodule sync --recursive && git submodule update --init --recursive --force
103+
cabal new-build
104+
cabal new-test
105+
```
106+
107+
`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.
98108

99-
1. **TBD**
109+
[nix]: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html
110+
[stackage]: https://stackage.org
111+
[ghcup]: https://www.haskell.org/ghcup/
100112

101113
## Technology and architecture
102114

cabal.project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
packages: vendor/* vendor/proto3-suite vendor/haskell-tree-sitter/languages/* semantic.cabal
2+
3+
package proto3-suite

script/clone-example-repos

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
#/ Usage: script/clone-example-repos
3+
#/
4+
#/ Clone some example repositories for smoke testing parsing and assignment
5+
#/
6+
#/ NOTES:
7+
#/ - This script is intended to be called by `test/Examples.hs`
8+
#/ - Go and Ruby examples are in submodules
9+
#/ - PHP doesn't have any parse-examples
10+
#/ - Java and Haskell have good examples, but they have assignment failures so currently aren't tested
11+
12+
13+
set -e
14+
cd $(dirname "$0")/..
15+
16+
dir="vendor/haskell-tree-sitter/languages"
17+
18+
# clone_repo LOCAL_PATH URL SHA
19+
function clone_repo {
20+
path=$1
21+
url="https://github.com/$2"
22+
sha=$3
23+
24+
if [ ! -d "$path" ]; then
25+
echo "Cloning $url@$sha"
26+
git clone "$url" "$path"
27+
else
28+
echo "$url@$sha already exists"
29+
fi
30+
31+
pushd "$path" > /dev/null # && git pull -q # NB: Enable this if you need to pin to a different sha for one of the repos.
32+
git reset --hard -q $sha
33+
popd > /dev/null
34+
}
35+
36+
python_examples="$dir/python/vendor/tree-sitter-python/examples"
37+
clone_repo "$python_examples/numpy" numpy/numpy 058851c5cfc98f50f11237b1c13d77cfd1f40475
38+
clone_repo "$python_examples/thealgorithms" thealgorithms/python c6be53e1c43f870f5364eef1499ee1b411c966fb
39+
clone_repo "$python_examples/flask" pallets/flask 0b5b4a66ef99c8b91569dd9b9b34911834689d3f
40+
clone_repo "$python_examples/httpie" jakubroztocil/httpie 358342d1c915d6462a080a77aefbb20166d0bd5d
41+
clone_repo "$python_examples/keras" keras-team/keras e59570ae26670f788d6c649191031e4a8824f955
42+
clone_repo "$python_examples/requests" requests/requests 64bde6582d9b49e9345d9b8df16aaa26dc372d13
43+
clone_repo "$python_examples/scikit-learn" scikit-learn/scikit-learn d0f63a760d9993a7f68cfc5e1a075700d67c53d3
44+
clone_repo "$python_examples/scrapy" scrapy/scrapy 65d631329a1434ec013f24341e4b8520241aec70
45+
clone_repo "$python_examples/pytorch" pytorch/pytorch c865d46736db4afff51690a712e35ed8e3899490
46+
clone_repo "$python_examples/certbot" certbot/certbot bb8222200a8cbd39a3ce9584ce6dfed6c5d05228
47+
48+
ts_examples="$dir/typescript/vendor/tree-sitter-typescript/examples"
49+
clone_repo "$ts_examples/desktop" desktop/desktop d1324f56d02dd9afca5d2e9da545905a7d41d671
50+
51+
java_examples="$dir/java/vendor/tree-sitter-java/examples"
52+
clone_repo "$java_examples/elasticsearch" elastic/elasticsearch 4d62640bf116af7e825d89c7319a39c3f2f325b4
53+
clone_repo "$java_examples/guava" google/guava e24fddc5fff7fd36d33ea38737b6606a7e476845
54+
clone_repo "$java_examples/RxJava" ReactiveX/RxJava 8a6bf14fc9a61f7c1c0016ca217be02ca86211d2
55+
56+
clone_repo "$ts_examples/npm" npm/npm ee147fbbca6f2707d3b16f4fa78f4c4606b2d9b1
57+
58+
haskell_examples="$dir/haskell/vendor/tree-sitter-haskell/examples"
59+
clone_repo "$haskell_examples/effects" joshvera/effects 08f5f36f2600362685af593f4b327e933b60bf97
60+
clone_repo "$haskell_examples/postgrest" PostgRest/postgrest f80cfbf165f951a062b3cbedac4556019905ca49
61+
clone_repo "$haskell_examples/ivory" GaloisInc/ivory 3d00324ad1c113c7e70957ff6a6d636d271d0fc4
62+
63+
go_examples="$dir/go/vendor/tree-sitter-go/examples"
64+
clone_repo "$go_examples/go" "golang/go" "870e12d7bfaea70fb0d743842f5864eb059cb939"
65+
clone_repo "$go_examples/moby" "moby/moby" "f57f260b49b6142366e6bc1274204ee0a1205945"
66+
67+
ruby_examples="$dir/ruby/vendor/tree-sitter-ruby/examples"
68+
clone_repo "$ruby_examples/ruby_spec" "ruby/spec" "c3e6b9017926f44a76e2b966c4dd35fa84c4cd3b"

script/generate-example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ generate_example () {
3737

3838
if [ -e "$fileA" ]; then
3939
status $parseFileA
40-
stack exec semantic -- parse --sexpression $fileA > $parseFileA
40+
cabal new-run semantic -- parse --sexpression $fileA > $parseFileA
4141
fi
4242

4343
if [ -e "$fileB" ]; then
4444
status $parseFileB
45-
stack exec semantic -- parse --sexpression $fileB > $parseFileB
45+
cabal new-run semantic -- parse --sexpression $fileB > $parseFileB
4646
fi
4747

4848
if [ -e "$fileA" -a -e "$fileB" ]; then
4949
status $diffFileAB
50-
stack exec semantic -- diff --sexpression $fileA $fileB > $diffFileAB
50+
cabal new-run semantic -- diff --sexpression $fileA $fileB > $diffFileAB
5151

5252
status $diffFileBA
53-
stack exec semantic -- diff --sexpression $fileB $fileA > $diffFileBA
53+
cabal new-run semantic -- diff --sexpression $fileB $fileA > $diffFileBA
5454
fi
5555
}
5656

semantic.cabal

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ category: Web
1313
build-type: Simple
1414
stability: alpha
1515

16+
tested-with: GHC == 8.6.4
17+
1618
flag release
1719
description: Build with optimizations on (for CI or deployment builds)
1820
default: False
@@ -35,33 +37,36 @@ common haskell
3537
, StrictData
3638
, TypeApplications
3739

40+
-- Except in case of vendored dependencies, these deps should be expressed
41+
-- as caret-operator bounds relative to a version in Stackage.
42+
-- These are currently pinned to lts-13.13.
3843
common dependencies
3944
build-depends: base >= 4.8 && < 5
40-
, aeson
41-
, algebraic-graphs
42-
, async
43-
, bifunctors
44-
, bytestring
45-
, containers
46-
, directory
45+
, aeson ^>= 1.4.2.0
46+
, algebraic-graphs ^>= 0.3
47+
, async ^>= 2.2.1
48+
, bifunctors ^>= 5.5
49+
, bytestring ^>= 0.10.8.2
50+
, containers ^>= 0.6.0.1
51+
, directory ^>= 1.3.3.0
4752
, fastsum
48-
, filepath
49-
, free
53+
, filepath ^>= 1.4.2.1
54+
, free ^>= 5.1
5055
, fused-effects
5156
, fused-effects-exceptions
52-
, hashable
57+
, hashable ^>= 1.2.7.0
5358
, haskell-tree-sitter
54-
, machines
55-
, mtl
56-
, network
59+
, machines ^>= 0.6.4
60+
, mtl ^>= 2.2.2
61+
, network ^>= 2.8.0.0
5762
, process
58-
, recursion-schemes
59-
, scientific
63+
, recursion-schemes ^>= 5.1
64+
, scientific ^>= 0.3.6.2
6065
, safe-exceptions
6166
, semilattices
62-
, text
63-
, these
64-
, unix
67+
, text ^>= 1.2.3.1
68+
, these >= 0.7 && <1
69+
, unix ^>= 2.7.2.2
6570
, proto3-suite
6671
, proto3-wire
6772

@@ -276,46 +281,47 @@ library
276281
, Tags.Tagging
277282
-- Custom Prelude
278283
, Prologue
284+
279285
build-depends: base >= 4.8 && < 5
280-
, ansi-terminal
281-
, array
282-
, attoparsec
283-
, cmark-gfm
284-
, cryptohash
285-
, deepseq
286-
, directory-tree
286+
, ansi-terminal ^>= 0.8.2
287+
, array ^>= 0.5.3.0
288+
, attoparsec ^>= 0.13.2.2
289+
, cmark-gfm == 0.1.8
290+
, cryptohash ^>= 0.11.9
291+
, deepseq ^>= 1.4.4.0
292+
, directory-tree ^>= 0.12.1
287293
, freer-cofreer
288-
, generic-monoid
289-
, ghc-prim
290-
, gitrev
291-
, haskeline
292-
, hostname
293-
, hscolour
294-
, http-client
295-
, http-client-tls
296-
, http-types
297-
, http-media
298-
, kdt
299-
, lens
300-
, mersenne-random-pure64
301-
, network-uri
302-
, optparse-applicative
303-
, parallel
304-
, parsers
305-
, pretty-show
306-
, prettyprinter
307-
, profunctors
308-
, reducers
309-
, semigroupoids
310-
, servant
294+
, generic-monoid ^>= 0.1.0.0
295+
, ghc-prim ^>= 0.5.3
296+
, gitrev ^>= 1.3.1
297+
, haskeline ^>= 0.7.5.0
298+
, hostname ^>= 1.0
299+
, hscolour ^>= 1.24.4
300+
, http-client ^>= 0.6.2
301+
, http-client-tls ^>= 0.3.5.3
302+
, http-types ^>= 0.12.3
303+
, http-media ^>= 0.7.1.3
304+
, kdt ^>= 0.2.4
305+
, lens ^>= 4.17
306+
, mersenne-random-pure64 ^>= 0.2.2.0
307+
, network-uri ^>= 2.6.1.0
308+
, optparse-applicative ^>= 0.14.3.0
309+
, parallel ^>= 3.2.2.0
310+
, parsers ^>= 0.12.9
311+
, prettyprinter ^>= 1.2.1
312+
, pretty-show ^>= 1.9.5
313+
, profunctors ^>= 5.3
314+
, reducers ^>= 3.12.3
315+
, semigroupoids ^>= 5.3.2
316+
, servant ^>= 0.15
311317
, shelly
312-
, split
313-
, stm-chans
314-
, template-haskell
315-
, time
318+
, split ^>= 0.2.3.3
319+
, stm-chans ^>= 3.0.0.4
320+
, template-haskell ^>= 2.14
321+
, time ^>= 1.8.0.2
316322
, unliftio-core
317-
, unordered-containers
318-
, vector
323+
, unordered-containers ^>= 0.2.9.0
324+
, vector ^>= 0.12.0.2
319325
, haskell-tree-sitter
320326
, tree-sitter-go
321327
, tree-sitter-haskell
@@ -391,11 +397,11 @@ test-suite test
391397
build-depends: semantic
392398
, tree-sitter-json
393399
, Glob
394-
, hspec >= 2.4.1
395-
, hspec-core
396-
, hspec-expectations-pretty-diff
397-
, HUnit
398-
, leancheck
400+
, hspec >= 2.6 && <3
401+
, hspec-core >= 2.6 && <3
402+
, hspec-expectations-pretty-diff ^>= 0.7.2.5
403+
, HUnit ^>= 1.6.0.0
404+
, leancheck >= 0.8 && <1
399405
, temporary
400406
ghc-options: -O0
401407
if flag(release)

vendor/proto3-suite

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 83f3352f0c7c94ea091e6087f60692eda9991fae

vendor/proto3-wire

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 84664e22f01beb67870368f1f88ada5d0ad01f56

0 commit comments

Comments
 (0)