@@ -13,17 +13,19 @@ files with the extension `.cmj` which are later used for cross module
13
13
inlining, arity inference and other information.
14
14
======
15
15
16
- === Build with bsb
16
+ === BuckleScript build system: `bsb`
17
17
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 .
20
20
21
- [NOTE ]
21
+ [INFO ]
22
22
======
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].
24
26
======
25
27
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
27
29
http://bloomberg.github.io/bucklescript/docson/#build-schema.json[available]
28
30
29
31
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
86
88
--------------------
87
89
88
90
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
+
89
157
=== 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
+
90
164
BuckleScript distribution has `bsdep.exe` which has the same interface as `ocamldep`
91
165
92
166
Here is a simple Makefile to get started:
0 commit comments