1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Merge pull request #367 from github/semantic-ast-docker

Include semantic-ast in the container
This commit is contained in:
Patrick Thomson 2019-10-30 10:49:56 -04:00 committed by GitHub
commit c8ff9bdd03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 15 deletions

View File

@ -1,6 +1,11 @@
Dockerfile
/.licenses
/.git
.ghci
.ghci_history
.ghc.environment.x86_64-darwin-8.6.5
*.yaml
*.md
/bin
/dist
@ -8,3 +13,7 @@ Dockerfile
/notices
/docs
/tmp
/semantic-source
/bench
/script
/test

View File

@ -17,7 +17,7 @@ Please note that this project is released with a [Contributor Code of Conduct][c
0. [Fork][fork] and clone the repository
0. Configure and install the dependencies: `script/bootstrap`
0. Make sure the tests pass on your machine: `cabal new-build`
0. Make sure the tests pass on your machine: `cabal v2-test`
0. Create a new branch: `git checkout -b my-branch-name`
0. Make your change, add tests, and make sure the tests still pass
0. Push to your fork and [submit a pull request][pr]

View File

@ -25,11 +25,11 @@ WORKDIR /build
# Build just the dependencies so that this layer can be cached
COPY semantic.cabal .
COPY semantic-analysis semantic-analysis/
COPY semantic-ast semantic-ast/
COPY semantic-core semantic-core/
COPY semantic-java semantic-java/
COPY semantic-json semantic-json/
COPY semantic-python semantic-python/
COPY semantic-source semantic-source/
COPY semantic-tags semantic-tags/
COPY cabal.project .
RUN cabal v2-update && \

View File

@ -104,15 +104,14 @@ We use `cabal's` [Nix-style local builds][nix] for development. To get started q
git clone git@github.com:github/semantic.git
cd semantic
script/bootstrap
cabal new-build
cabal new-test
cabal new-run semantic -- --help
cabal v2-build
cabal v2-test
cabal v2-run semantic -- --help
```
`stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability.
[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

View File

@ -12,11 +12,11 @@
### Nix-style local builds
`semantic` is a complicated app with a very large dependency tree. Because managing large dependency trees in a system-wide `ghc` installation is difficult, especially when developing on multiple Haskell projects, `cabal` enables "local" builds: each dependency is linked in per-project, not globally. In practice, this means that you should prefix your commands with the `new-` prefix: `cabal new-build` builds the project, `new-clean` purges its build artifacts, etc. (With versions of the `cabal` command line tool newer than 2.6, local builds become the default, with the `v1-` prefix required to yield old behavior.)
`semantic` is a complicated app with a very large dependency tree. Because managing large dependency trees in a system-wide `ghc` installation is difficult, especially when developing on multiple Haskell projects, `cabal` enables "local" builds: each dependency is linked in per-project, not globally. In practice, this means that you should prefix your commands with the `v2-` prefix: `cabal v2-build` builds the project, `v2-clean` purges its build artifacts, etc. (With versions of the `cabal` command line tool newer than 2.6, local builds become the default, with the `v1-` prefix required to yield old behavior.)
### Running a REPL
Running `cabal new-repl semantic:lib` will boot a GHCi with the right environment for Semantic set up.
Running `cabal v2-repl semantic:lib` will boot a GHCi with the right environment for Semantic set up.
See the [💡ProTips](💡ProTip!.md#ghci) for more info.

View File

@ -1,4 +1,4 @@
#!/bin/bash
git submodule sync --recursive && git submodule update --init --recursive --force
cabal new-update
cabal v2-update

View File

@ -37,20 +37,20 @@ generate_example () {
if [ -e "$fileA" ]; then
status $parseFileA
cabal new-run --verbose=0 semantic -- parse --sexpression $fileA > $parseFileA
cabal v2-run --verbose=0 semantic -- parse --sexpression $fileA > $parseFileA
fi
if [ -e "$fileB" ]; then
status $parseFileB
cabal new-run --verbose=0 semantic -- parse --sexpression $fileB > $parseFileB
cabal v2-run --verbose=0 semantic -- parse --sexpression $fileB > $parseFileB
fi
if [ -e "$fileA" -a -e "$fileB" ]; then
status $diffFileAB
cabal new-run --verbose=0 semantic -- diff --sexpression $fileA $fileB > $diffFileAB
cabal v2-run --verbose=0 semantic -- diff --sexpression $fileA $fileB > $diffFileAB
status $diffFileBA
cabal new-run --verbose=0 semantic -- diff --sexpression $fileB $fileA > $diffFileBA
cabal v2-run --verbose=0 semantic -- diff --sexpression $fileB $fileA > $diffFileBA
fi
}

View File

@ -15,13 +15,13 @@ PROFILE_DIR="$PROFILES_DIR/$TODAY/$NOW-$CURRENT_BRANCH-$HEAD_SHA/"
OUTFILE="$PROFILE_DIR/profile.out.log"
ERRFILE="$PROFILE_DIR/profile.err.log"
cabal new-build
cabal v2-build
mkdir -p "$PROFILE_DIR"
# NB: Do not try and use -N, it doesn't work and defaults to -N1.
cores=$(sysctl -n machdep.cpu.core_count || echo 4)
cabal new-run semantic -- +RTS -sstderr -N$((cores * 2)) -A8m -n2m -p -s -h -i0.1 -L1000 -xt -RTS $@ > "$OUTFILE" 2> "$ERRFILE"
cabal v2-run semantic -- +RTS -sstderr -N$((cores * 2)) -A8m -n2m -p -s -h -i0.1 -L1000 -xt -RTS $@ > "$OUTFILE" 2> "$ERRFILE"
profiteur semantic.prof || true