Skip to content

Commit 48e3d37

Browse files
committed
more docs
1 parent d9fd51e commit 48e3d37

File tree

1 file changed

+80
-6
lines changed

1 file changed

+80
-6
lines changed

site/docsource/Build-system-support.adoc

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ files with the extension `.cmj` which are later used for cross module
1313
inlining, arity inference and other information.
1414
======
1515

16-
=== Build with bsb
16+
=== BuckleScript build system: `bsb`
1717

18-
BuckleScript proivdes a native build tool using https://github.com/ninja-build/ninja/releases[ninja],
19-
it is designed for fast feedback loop (typically 100ms feedback loop).
18+
BuckleScript proivdes a native build tool on top of Google's https://github.com/ninja-build/ninja/releases[ninja-build],
19+
it is designed for fast feedback loop (typically 100ms feedback loop) and works cross platform.
2020

21-
[NOTE]
21+
[INFO]
2222
======
23-
Currently user needs install ninja first (version >= 1.7.1)
23+
Currently for non-Windows users, they needs install ninja first (version >= 1.7.1),
24+
please don't be confused with the npm ninja,
25+
we are using Google's https://github.com/ninja-build/ninja/releases[ninja-build].
2426
======
2527

26-
It is a schema based build tool, the schema is
28+
`bsb` can be running in any subdirectory, it is a schema based build tool, the schema is
2729
http://bloomberg.github.io/bucklescript/docson/#build-schema.json[available]
2830

2931
The build system is installed as `bsb.exe` in `bs-platform/bin/bsb.exe`, due to a known issue in npm,
@@ -86,7 +88,79 @@ bsb -w
8688
--------------------
8789

8890

91+
92+
93+
94+
==== Build with other BuckleScript dependencies
95+
96+
List your dependency in `bs-dependencies` and install it via `npm install` as below:
97+
98+
.bsconfig.json
99+
[source,js]
100+
-----------
101+
{
102+
"name": "bs-string",
103+
"version": "0.1.3",
104+
"bs-dependencies": [
105+
"bs-mocha" // <1>
106+
],
107+
"sources": [
108+
.. .
109+
],
110+
"generate-merlin" : true // <2>
111+
}
112+
-----------
113+
<1> Yet another BuckleScript dependency
114+
<2> bsb will generate merlin file for you
115+
116+
.package.json
117+
[source,js]
118+
-----------
119+
{
120+
"dependencies": {
121+
"bs-mocha": "0.1.5"
122+
},
123+
...
124+
}
125+
-----------
126+
127+
After your `npm install`,
128+
[source,sh]
129+
----------
130+
bsb -clean-world // <1>
131+
bsb -make-world // <2>
132+
----------
133+
<1> Clean the binary artifact of current build and your dependency
134+
<2> Build dependencies and lib itself
135+
136+
137+
==== Mark your directory as dev only
138+
139+
140+
Note sometimes, you have directories which are just tests that you don't need your dependent
141+
to build in that case you can mark it as dev only
142+
143+
.bsconfig.json
144+
[source,js]
145+
-----------
146+
{
147+
"sources" : {
148+
"dir" : "test",
149+
"type" : "dev" // <1>
150+
}
151+
}
152+
-----------
153+
<1> directory `test` is in dev mode, it will not be built when used as a dependency
154+
155+
156+
89157
=== Build using Make
158+
[WARNING]
159+
========
160+
`bsb` is officialy recommended build system, this section is listed here only for people who
161+
are curious about how the build works
162+
========
163+
90164
BuckleScript distribution has `bsdep.exe` which has the same interface as `ocamldep`
91165

92166
Here is a simple Makefile to get started:

0 commit comments

Comments
 (0)