Skip to content

Vendor compiler libs and build with ocaml 4.12. #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
key: ${{matrix.os}}-rescript-vscode-v1

- name: Use OCaml
uses: ocaml/setup-ocaml@v1.1.11
uses: ocaml/setup-ocaml@v2
with:
ocaml-version: 4.06.1
ocaml-compiler: 4.12.x

- name: Use Node.js
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Thanks for your interest. Below is an informal spec of how the plugin's server c
## Install Dependencies

- Run `npm install` at the root. This will also install the npm modules for both the `client` and `server` folders.
- `opam switch 4.06.1`. OPAM [here](https://opam.ocaml.org). This is needed for the `analysis` folder, which is native code.
- `opam switch 4.12.0`. OPAM [here](https://opam.ocaml.org). This is needed for the `analysis` folder, which is native code.
- Optionally, you can `opam install ocamlformat` and format the `.ml` files in `analysis`.

## Build & Run
Expand Down
574 changes: 540 additions & 34 deletions analysis/.depend

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions analysis/.merlin
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ B src/vendor
B src/vendor/odoc_parser
B src/vendor/omd
B src/vendor/res_outcome_printer
B src/vendor/compiler-libs-406
B ../../../.opam/4.06.1/lib/ocaml/compiler-libs/

S src
S src/vendor
S src/vendor/odoc_parser
S src/vendor/omd
S src/vendor/res_outcome_printer
S src/vendor/compiler-libs-406
S ../../../.opam/4.06.1/lib/ocaml/compiler-libs/

FLG -w +26+27+32+33+39
10 changes: 5 additions & 5 deletions analysis/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SHELL = /bin/bash
MAKEFLAGS += --jobs 4
INCLUDES = -I src -I src/vendor/res_outcome_printer -I src/vendor
INCLUDES = -I src -I src/vendor/res_outcome_printer -I src/vendor -I src/vendor/compiler-libs-406

OCAMLOPT = ocamlopt.opt
OCAMLFLAGS = -g -w +26+27+32+33+39 -bin-annot -I +compiler-libs $(INCLUDES)
OCAMLFLAGS = -g -w +26+27+32+33+39 -bin-annot $(INCLUDES)
OCAMLDEP = ocamldep.opt

OUTPUT = rescript-editor-analysis.exe
Expand All @@ -24,18 +24,18 @@ SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.m
$(OUTPUT): $(SOURCE_FILES)
@echo Linking...
@$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \
unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES)
unix.cmxa str.cmxa $(INCLUDES) $(SOURCE_FILES)
@echo Done!

build-native: $(OUTPUT) depend

dce: build-native
../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor
../../reanalyze/_build/install/default/bin/reanalyze.exe -dce-cmt src -suppress src/vendor

tests/node_modules/.bin/rescript:
@cd tests && npm install

test: dce tests/node_modules/.bin/rescript
test: build-native tests/node_modules/.bin/rescript
@cd tests && node_modules/.bin/rescript
./test.sh

Expand Down
8 changes: 5 additions & 3 deletions analysis/src/ProcessCmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ let extraForStructureItems ~(file : File.t)
| Partial_signature_item str -> Iter.iter_signature_item str
| Partial_expression expression -> Iter.iter_expression expression
| Partial_pattern pattern -> Iter.iter_pattern pattern
| Partial_class_expr class_expr -> Iter.iter_class_expr class_expr
| Partial_class_expr () -> ()
| Partial_module_type module_type -> Iter.iter_module_type module_type
| Partial_structure _ | Partial_structure_item _ -> ());
extra
Expand Down Expand Up @@ -1183,7 +1183,7 @@ let extraForSignatureItems ~(file : File.t)
| Partial_signature_item str -> Iter.iter_signature_item str
| Partial_expression expression -> Iter.iter_expression expression
| Partial_pattern pattern -> Iter.iter_pattern pattern
| Partial_class_expr class_expr -> Iter.iter_class_expr class_expr
| Partial_class_expr () -> ()
| Partial_module_type module_type -> Iter.iter_module_type module_type
| Partial_structure _ | Partial_structure_item _ -> ());
extra
Expand Down Expand Up @@ -1278,7 +1278,9 @@ let rec resolvePath ~env ~path ~package =
match result with
| `Local (env, name) -> Some (env, name)
| `Global (moduleName, fullPath) -> (
Log.log ("resolvePath Global path:" ^ pathToString fullPath ^ " module:" ^ moduleName);
Log.log
("resolvePath Global path:" ^ pathToString fullPath ^ " module:"
^ moduleName);
match fileForModule ~package moduleName with
| None -> None
| Some file ->
Expand Down
Loading