Skip to content

Commit

Permalink
Multiple Entry Points (#71)
Browse files Browse the repository at this point in the history
* Finer dep for BuckleScript compilation

* Finer dependency tracking in Ocaml Scheme

* Correctly compute transitive dependencies

* Start multiple entrypoint

* Firsty party dependencies work

* Scope bug

* Support all backends for multiple entry points

* Fix extensions

* Name the generated binaries appropriately

* Turn on module aliasing for top level dir for bucklescript engine

* Add merlin support back

* Merlin works with mutliple entry points

* Refactor

* Refactor round 2

* Refactor round 3 + comments

* Refactor round 4 + comments
  • Loading branch information
vramana authored and chenglou committed Oct 15, 2016
1 parent 73821d6 commit 3d1ae37
Show file tree
Hide file tree
Showing 17 changed files with 1,051 additions and 755 deletions.
6 changes: 4 additions & 2 deletions examples/bs-project/.merlin
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ S ./node_modules/Rexpress/src
S ./node_modules/remath/src

# B stands for build (artifacts). We generate ours into _build
B ./_build/default/*
B ./_build/client/*
B ./_build/server/*

# Bucklescript build artifacts
B ./node_modules/bs-platform/lib/ocaml
Expand All @@ -33,10 +34,11 @@ B ./node_modules/bs-platform/lib/ocaml
# understand our sources. You don't have to understand what these flags are for
# now; but if you're curious, go check the rebel.ml that generated this
# .merlin at https://github.com/reasonml/rebel
FLG -w -30 -w -40
FLG -w -30 -w -40 -open Client_Tar -open Server_Tar

# Currently the we use absolute path instead of relative path for bsppx.exe
# due to bug in merlin but this will be fixed in future.
More details on this github issue https://github.com/the-lambda-church/merlin/issues/571
FLG -ppx /home/vramana/Documents/reasonml/rebel/examples/bs-project/node_modules/bs-platform/bin/bsppx.exe

# User Custom config here
Expand Down
46 changes: 46 additions & 0 deletions examples/multiple-entrypoint/.merlin
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# DO NOT EDIT THIS SECTION. CUSTOM CONFIG GOES BELOW
# This file is autogenerated for
# [Merlin](https://github.com/the-lambda-church/merlin), a static analyser for
# OCaml that provides autocompletion, jump-to-location, recoverable syntax
# errors, type errors detection, etc., that your editor can use. To activate it,
# one usually provides a .merlin file at the Path.the_root of a project, describing where
# the sources and artifacts are. Since we dictated the project structure, we can
# auto generate .merlin files!

# S is the merlin flag for source files
S src

# Include all the third-party sources too. You might notice that we've put a
# .merlin into each node_modules package. This is subtle; in short, it's to make
# jump-to-location work correctly in conjunction with our build & namespacing
# setup, when you jump into a third-party file.


# B stands for build (artifacts). We generate ours into _build
B ./_build/native/*
B ./_build/byte/*
B ./_build/js-nice/*
B ./_build/js-ugly/*

# Bucklescript build artifacts
B ./node_modules/bs-platform/lib/ocaml

# PKG lists packages found through ocamlfind (aka findlib), a tool for finding
# the location of third-party dependencies. For us, most of our third-party deps
# reside in `node_modules/` (made visible to Merlin through the S command
# above); this PKG command is for discovering the opam/ocamlfind packages.


# FLG is the set of flags to pass to Merlin, as if it used ocamlc to compile and
# understand our sources. You don't have to understand what these flags are for
# now; but if you're curious, go check the rebel.ml that generated this
# .merlin at https://github.com/reasonml/rebel
FLG -w -30 -w -40 -open Native_Tar -open Byte_Tar -open JsNice_Tar -open JsUgly_Tar

# Currently the we use absolute path instead of relative path for bsppx.exe
# due to bug in merlin but this will be fixed in future.
More details on this github issue https://github.com/the-lambda-church/merlin/issues/571
FLG -ppx /home/vramana/Documents/reasonml/rebel/examples/multiple-entrypoint/node_modules/bs-platform/bin/bsppx.exe

# User Custom config here

39 changes: 39 additions & 0 deletions examples/multiple-entrypoint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "recursive-src",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "eval $(dependencyEnv) && rebel -show-actions-run-verbose -verbose -show-error-dependency-paths -brief-error-summary -show-buildable-discovery"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bs-platform": "^1.2.1"
},
"rebel": {
"targets": [
{
"target": "native",
"engine": "native",
"entry": "src/a.re"
},
{
"target": "byte",
"engine": "byte",
"entry": "src/a.re"
},
{
"target": "js-nice",
"engine": "bucklescript",
"entry": "src/a.re"
},
{
"target": "js-ugly",
"engine": "jsoo",
"entry": "src/a.re"
}
]
}
}
4 changes: 4 additions & 0 deletions examples/multiple-entrypoint/src/a.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* open A.B; */

print_endline "recursive src is coming!";
print_endline D.d;
3 changes: 3 additions & 0 deletions examples/multiple-entrypoint/src/b.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* open A.B; */

print_endline "recursive src is coming!";
1 change: 1 addition & 0 deletions examples/multiple-entrypoint/src/d.re
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let d = "d";
2 changes: 1 addition & 1 deletion examples/reason-project/.merlin
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PKG core
# understand our sources. You don't have to understand what these flags are for
# now; but if you're curious, go check the rebel.ml that generated this
# .merlin at https://github.com/reasonml/rebel
FLG -w -30 -w -40 -open Src
FLG -w -30 -w -40 -open Default_Tar



Expand Down
7 changes: 7 additions & 0 deletions examples/reason-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"rebel": {
"ocamlfindDependencies": [
"core"
],
"targets": [
{
"target": "default",
"engine": "byte",
"entry": "src/Index.re"
}
]
}
}
2 changes: 1 addition & 1 deletion examples/recursive-src/.merlin
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ B ./_build/default/*
# understand our sources. You don't have to understand what these flags are for
# now; but if you're curious, go check the rebel.ml that generated this
# .merlin at https://github.com/reasonml/rebel
FLG -w -30 -w -40 -open Src
FLG -w -30 -w -40 -open Default_Tar



Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"license": "ISC",
"scripts": {
"rebel:me": "npm run rebel && ./rebel.sh examples/multiple-entrypoint",
"rebel:re": "npm run rebel && ./rebel.sh examples/reason-project",
"rebel:rs": "npm run rebel && ./rebel.sh examples/recursive-src",
"rebel:bs": "npm run rebel && ./rebel.sh examples/bs-project",
Expand Down
Loading

0 comments on commit 3d1ae37

Please sign in to comment.