-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Simon Grondin
committed
Aug 9, 2020
1 parent
7a4155c
commit b26226c
Showing
13 changed files
with
115 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Dockerfile | ||
**/.DS_Store | ||
.vscode | ||
_opam/ | ||
_build/ | ||
**/.merlin | ||
vue/ | ||
src/flow_parser | ||
src/prototype | ||
*.strings | ||
*.exe | ||
*.mac | ||
*.linux | ||
strings/ | ||
flow/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,8 @@ vue/ | |
src/flow_parser | ||
src/prototype | ||
*.strings | ||
strings.exe | ||
*.exe | ||
*.mac | ||
*.linux | ||
strings/ | ||
flow/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Local development | ||
|
||
### Setup | ||
From the root of the repo: | ||
```bash | ||
opam switch create . ocaml-variants.4.10.0+flambda --deps-only | ||
|
||
git clone --branch v0.120.1 --depth 1 [email protected]:facebook/flow.git flow | ||
ln -s "$(pwd)/flow/src/parser" src/flow_parser | ||
|
||
# MacOS | ||
sed -i '' 's/Pervasives/Stdlib/g' flow/src/parser/parser_flow.ml | ||
# Linux | ||
sed -i 's/Pervasives/Stdlib/g' flow/src/parser/parser_flow.ml | ||
``` | ||
|
||
### MacOS - Build & Run | ||
```bash | ||
dune build src/cli/strings.exe && cp _build/default/src/cli/strings.exe strings.mac && strip strings.mac | ||
|
||
./strings.mac ../group-income-simple/ | ||
``` | ||
|
||
### Docker (Linux) - Build & Run | ||
```bash | ||
docker build . -t strings:latest | ||
STRINGS_CID="$(docker create strings:latest)" | ||
docker cp "$STRINGS_CID":/app/strings.exe strings.linux | ||
docker rm "$STRINGS_CID" | ||
|
||
# Trying it on Ubuntu 18.04 | ||
docker run -it --rm \ | ||
-v "$(pwd):/app" \ | ||
-v "$(realpath "$(pwd)/../group-income-simple"):/repo" \ | ||
-w /repo \ | ||
ubuntu:18.04 | ||
# Then run: '/app/strings.linux .' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM ocaml/opam2:debian-8-opam | ||
WORKDIR /home/opam/opam-repository | ||
|
||
RUN sudo apt-get update \ | ||
&& sudo apt-get install -y m4 pkg-config libev-dev \ | ||
&& git pull origin master \ | ||
&& opam-sandbox-disable \ | ||
&& opam init -k git -a /home/opam/opam-repository --bare \ | ||
&& opam init --bare \ | ||
&& opam switch create 4.10 4.10.0+flambda \ | ||
&& opam switch 4.10 \ | ||
&& opam install -y opam-depext | ||
|
||
RUN opam repository set-url default https://opam.ocaml.org \ | ||
&& opam update \ | ||
&& OPAMYES=1 opam install core \ | ||
&& opam clean | ||
|
||
WORKDIR /app | ||
|
||
COPY strings.opam . | ||
|
||
RUN OPAMYES=1 opam install . --deps-only | ||
|
||
RUN sudo chown -R opam /app \ | ||
&& git clone --branch v0.120.1 --depth 1 https://github.com/facebook/flow.git flow | ||
|
||
COPY . . | ||
|
||
ENV DUNE_PROFILE release | ||
|
||
RUN sudo chown -R opam /app \ | ||
&& ln -s "$(pwd)/flow/src/parser" src/flow_parser \ | ||
&& sed -i 's/Pervasives/Stdlib/g' flow/src/parser/parser_flow.ml \ | ||
&& opam exec -- dune build src/cli/strings.exe \ | ||
&& cp /app/_build/default/src/cli/strings.exe . \ | ||
&& chmod 755 strings.exe \ | ||
&& strip strings.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
stdlib-shims | ||
angstrom-lwt-unix | ||
core_kernel | ||
core | ||
lwt | ||
lwt.unix | ||
lwt_ppx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ | |
(libraries | ||
core_kernel | ||
|
||
angstrom-lwt-unix | ||
flow_parser | ||
|
||
angstrom-lwt-unix | ||
lwt | ||
lwt_ppx | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(library | ||
(name utils) | ||
(libraries | ||
core_kernel | ||
core | ||
lwt | ||
lwt.unix | ||
lwt_ppx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters