Skip to content

Commit 98f8fad

Browse files
committed
change bucklescript build system to make
the first release of bsb.exe (only for internal use yet), need more cleaning up
1 parent 03e8483 commit 98f8fad

File tree

265 files changed

+14190
-11997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+14190
-11997
lines changed

.gitignore

+3-13
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,8 @@ ocaml_src
6161
# for npm publish
6262
!bin/bsc.exe
6363
!bin/bsppx
64-
!bin/ocaml
65-
!bin/ocamldep
66-
!bin/ocamldep.opt
67-
!bin/ocamlyacc
68-
!bin/ocamllex.opt
69-
!bin/ocamllex
70-
!bin/ocamlobjinfo
71-
!bin/ocamlopt
72-
!bin/ocamlopt.opt
73-
!bin/ocamlrun
74-
!bin/ocamlc
75-
!bin/ocamlc.opt
7664
!bin/bspack
65+
!/bin/bsb
7766
!ocaml.tar.gz
7867

7968
#ninja
@@ -84,4 +73,5 @@ ocaml_src
8473
*.d
8574
.bsbuild
8675
jscomp/bin/bsb
87-
jscomp/bin/bsc
76+
jscomp/bin/bsc
77+
jscomp/bin/config_whole_compiler.ml

bsconfig.json

+7-18
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,27 @@
33
"version": "1.2.2",
44
"ocaml-config" :
55
{
6-
"bsdep" : "jscomp/bin/bsdep.exe",
7-
"bsc" : "jscomp/bin/bsc.exe",
86
"bs-external-includes" : [
97
"jscomp/runtime",
108
"jscomp/stdlib",
119
"jscomp/others"
1210
],
13-
14-
1511
"bsc-flags" :
1612
[
1713
"-w", "-40", "-bs-no-version-header", "-bs-cross-module-opt"
1814
],
19-
"bs-copy-or-symlink" :
20-
// for out of source build, on Unix will do a symlink
21-
// on windows will copy
22-
[
23-
"jscomp/test/flow_parser_sample.js",
24-
"jscomp/test/joinClasses.js"
25-
]
26-
,
27-
// so the design is this way
28-
// if we find
29-
// "files" : [
30-
// ]
31-
// we will update it *before* spitting out build.ninja
32-
3315
"sources" :
3416
[
3517

3618
{
3719
"dir" : "jscomp/test/" ,
20+
"resources" :
21+
[
22+
"flow_parser_sample.js",
23+
"joinClasses.js"
24+
]
25+
,
26+
3827
"subdirs": [
3928
{
4029
"dir": "acyc",

docs/Manual.html

+123-3
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,12 @@ <h1><a href="https://github.com/bloomberg/bucklescript">BuckleScript</a> User Ma
629629
<li><a href="#_changes_to_command_line_options">Changes to command line options</a></li>
630630
</ul>
631631
</li>
632-
<li><a href="#_build_system_support">Build system support</a></li>
632+
<li><a href="#_build_system_support">Build system support</a>
633+
<ul class="sectlevel2">
634+
<li><a href="#_build_with_bsb_experimental">Build with bsb (experimental)</a></li>
635+
<li><a href="#_build_using_make">Build using Make</a></li>
636+
</ul>
637+
</li>
633638
<li><a href="#_faq">FAQ</a></li>
634639
<li><a href="#_high_level_compiler_workflow">High Level compiler workflow</a>
635640
<ul class="sectlevel2">
@@ -985,8 +990,7 @@ <h4 id="_minimal_dependencies"><a class="anchor" href="#_minimal_dependencies"><
985990
</div>
986991
<div class="listingblock">
987992
<div class="content">
988-
<pre class="pygments highlight"><code data-lang="sh"><span class="tok-nb">export </span><span class="tok-nv">BS_RELEASE_BUILD</span><span class="tok-o">=</span>1
989-
make world</code></pre>
993+
<pre class="pygments highlight"><code data-lang="sh">make world</code></pre>
990994
</div>
991995
</div>
992996
<hr>
@@ -3753,6 +3757,121 @@ <h2 id="_build_system_support"><a class="anchor" href="#_build_system_support"><
37533757
</tr>
37543758
</table>
37553759
</div>
3760+
<div class="sect2">
3761+
<h3 id="_build_with_bsb_experimental"><a class="anchor" href="#_build_with_bsb_experimental"></a>Build with bsb (experimental)</h3>
3762+
<div class="paragraph">
3763+
<p>BuckleScript proivdes a native build tool using <a href="https://github.com/ninja-build/ninja/releases">ninja</a>,
3764+
it is designed for fast feedback loop (typically 100ms feedback loop).</p>
3765+
</div>
3766+
<div class="admonitionblock note">
3767+
<table>
3768+
<tr>
3769+
<td class="icon">
3770+
<div class="title">Note</div>
3771+
</td>
3772+
<td class="content">
3773+
<div class="paragraph">
3774+
<p>Currently user needs install ninja first</p>
3775+
</div>
3776+
</td>
3777+
</tr>
3778+
</table>
3779+
</div>
3780+
<div class="paragraph">
3781+
<p>It is a schema based build tool, the schema is
3782+
<a href="http://bloomberg.github.io/bucklescript/docson/#build-schema.json">available</a></p>
3783+
</div>
3784+
<div class="paragraph">
3785+
<p>Here is a typical configuration:</p>
3786+
</div>
3787+
<div class="listingblock">
3788+
<div class="title">bsconfig.json</div>
3789+
<div class="content">
3790+
<pre class="pygments highlight"><code data-lang="js"><span class="tok-p">{</span>
3791+
<span class="tok-s2">&quot;name&quot;</span><span class="tok-o">:</span> <span class="tok-s2">&quot;bs-string&quot;</span><span class="tok-p">,</span>
3792+
<span class="tok-s2">&quot;version&quot;</span><span class="tok-o">:</span> <span class="tok-s2">&quot;0.1.2&quot;</span><span class="tok-p">,</span>
3793+
<span class="tok-s2">&quot;ocaml-config&quot;</span><span class="tok-o">:</span> <span class="tok-p">{</span>
3794+
<span class="tok-c1">// &quot;bs-dependencies&quot;: [&quot;bs-mocha&quot;], </span><b class="conum">(1)</b>
3795+
<span class="tok-s2">&quot;sources&quot;</span><span class="tok-o">:</span> <span class="tok-p">[</span>
3796+
<span class="tok-p">{</span>
3797+
<span class="tok-s2">&quot;dir&quot;</span><span class="tok-o">:</span> <span class="tok-s2">&quot;src&quot;</span><span class="tok-p">,</span>
3798+
<span class="tok-s2">&quot;public&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;all&quot;</span><span class="tok-p">,</span> <b class="conum">(2)</b>
3799+
<span class="tok-s2">&quot;files&quot;</span><span class="tok-o">:</span> <span class="tok-p">[</span>
3800+
<span class="tok-s2">&quot;bs_string.ml&quot;</span><span class="tok-p">,</span>
3801+
<span class="tok-s2">&quot;bs_nativeint.ml&quot;</span><span class="tok-p">,</span>
3802+
<span class="tok-s2">&quot;bs_math.ml&quot;</span><span class="tok-p">,</span>
3803+
<span class="tok-s2">&quot;bs_array.ml&quot;</span>
3804+
<span class="tok-p">]</span>
3805+
<span class="tok-p">},</span>
3806+
<span class="tok-p">{</span> <span class="tok-s2">&quot;dir&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;test&quot;</span><span class="tok-p">,</span>
3807+
<span class="tok-s2">&quot;files&quot;</span><span class="tok-o">:</span> <span class="tok-p">[</span>
3808+
<span class="tok-s2">&quot;bs_string_test.ml&quot;</span>
3809+
<span class="tok-p">]</span>
3810+
<span class="tok-p">,</span>
3811+
<span class="tok-s2">&quot;bs-dependencies&quot;</span> <span class="tok-o">:</span> <span class="tok-p">[</span><span class="tok-s2">&quot;bs-mocha&quot;</span><span class="tok-p">]</span> <b class="conum">(3)</b>
3812+
<span class="tok-p">}</span>
3813+
<span class="tok-p">]</span>
3814+
<span class="tok-p">}</span>
3815+
<span class="tok-p">}</span></code></pre>
3816+
</div>
3817+
</div>
3818+
<div class="colist arabic">
3819+
<ol>
3820+
<li>
3821+
<p>It is an extension to JSON with comment support</p>
3822+
</li>
3823+
<li>
3824+
<p>List interfaces to be exposed to client</p>
3825+
</li>
3826+
<li>
3827+
<p>Add more dependencies for some TARGETS</p>
3828+
</li>
3829+
</ol>
3830+
</div>
3831+
<div class="paragraph">
3832+
<p>The entry point is <code>bsb.exe</code>,
3833+
it will check if there is already <code>build.ninja</code> in the build directory,
3834+
if not or need regenerated it will generate a file <code>build.ninja</code>
3835+
and delegate the hard work to <code>ninja</code>.</p>
3836+
</div>
3837+
<div class="paragraph">
3838+
<p>The directory layout (after building) would be</p>
3839+
</div>
3840+
<div class="listingblock">
3841+
<div class="content">
3842+
<pre>.
3843+
├── lib
3844+
│ ├── bs
3845+
│ │ ├── src
3846+
│ │ └── test
3847+
│ ├── js
3848+
│ │ ├── src
3849+
│ │ └── test
3850+
│ ├── amdjs <b class="conum">(1)</b>
3851+
│ │ ├── src
3852+
│ │ └── test
3853+
│ ├── goog <b class="conum">(2)</b>
3854+
│ │ ├── src
3855+
│ │ └── test
3856+
│ └── ocaml
3857+
├── scripts
3858+
├── src
3859+
└── test</pre>
3860+
</div>
3861+
</div>
3862+
<div class="colist arabic">
3863+
<ol>
3864+
<li>
3865+
<p>Will generate amdjs modules if flags are turned on</p>
3866+
</li>
3867+
<li>
3868+
<p>Will generate goog modules if flags are turned on</p>
3869+
</li>
3870+
</ol>
3871+
</div>
3872+
</div>
3873+
<div class="sect2">
3874+
<h3 id="_build_using_make"><a class="anchor" href="#_build_using_make"></a>Build using Make</h3>
37563875
<div class="paragraph">
37573876
<p>BuckleScript distribution has <code>bsdep.exe</code> which has the same interface as <code>ocamldep</code></p>
37583877
</div>
@@ -3839,6 +3958,7 @@ <h2 id="_build_system_support"><a class="anchor" href="#_build_system_support"><
38393958
</div>
38403959
</div>
38413960
</div>
3961+
</div>
38423962
<div class="sect1">
38433963
<h2 id="_faq"><a class="anchor" href="#_faq"></a>FAQ</h2>
38443964
<div class="sectionbody">

docs/docson/build-schema.json

+34-9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
]
3737

3838
},
39+
"bs-dependencies" : {
40+
"type" : "array",
41+
"items" : { "type" : "string" },
42+
"description" : "bucklescript package dependencies"
43+
},
3944
"sourceItem" : {
4045
"title" : "sourceItem",
4146
"properties": {
@@ -71,8 +76,31 @@
7176
}
7277
]
7378
},
74-
75-
79+
"bs-dependencies" : {
80+
"$ref" : "#/definitions/bs-dependencies"
81+
},
82+
"public" : {
83+
"oneOf": [
84+
{
85+
"enum":
86+
[
87+
"all"
88+
]
89+
},
90+
{
91+
"type": "array",
92+
"items" : {
93+
"type" : "string"
94+
}
95+
}
96+
]
97+
},
98+
"resources" : {
99+
"type": "array",
100+
"items": {
101+
"type" : "string"
102+
}
103+
},
76104
"subdirs" : {
77105
"type" : "array",
78106
"items" : {
@@ -130,6 +158,9 @@
130158
"ocaml-config" : {
131159
"title": "OCaml Configuration format",
132160

161+
"bs-dependencies" : {
162+
"$ref" : "#/definitions/bs-dependencies"
163+
},
133164
"properties": {
134165
"bsdep": {
135166
"type": "string",
@@ -175,13 +206,7 @@
175206
"type": "string",
176207
"description": "path to install bucklescript ocaml libs, used for its dependent compilation, default to /lib/bs "
177208
},
178-
"bs-dependencies": {
179-
"type" : "object",
180-
"additionalProperties": {
181-
"type" : "string"
182-
},
183-
"description": "the ocaml (via BuckleScript) dependencies available on npm"
184-
},
209+
185210
"bs-copy-or-symlink": {
186211
"$ref" : "#/definitions/stringArray",
187212
"description" : "the resource files, the use case is in test build, we need keep the same relative path between code and resources"

0 commit comments

Comments
 (0)