Skip to content

Commit b9c5baa

Browse files
committed
bsb with glob support
todo: 1. support `bsb -C _build` reason: avoiding caching issues and concurrent issues - it may also make sense for each build directory we have package.json and release it At least for now, we can hide it ? the issue is that how much do you need change output directory 2. change our own bucklescript to use ninja too
1 parent d5730de commit b9c5baa

Some content is hidden

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

59 files changed

+6775
-5978
lines changed

.gitignore

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ocaml_src
5959
*.exe
6060

6161
# for npm publish
62-
!bin/bsc
62+
!bin/bsc.exe
6363
!bin/bsppx
6464
!bin/ocaml
6565
!bin/ocamldep
@@ -79,5 +79,9 @@ ocaml_src
7979
#ninja
8080
.ninja_log
8181
.ninja_deps
82+
.bsdeps
83+
.bs_dir_cache
8284
*.d
83-
.bsbuild
85+
.bsbuild
86+
jscomp/bin/bsb
87+
jscomp/bin/bsc

bsconfig.json

+426-4
Large diffs are not rendered by default.

build.ninja

-1,277
This file was deleted.

docs/docson/build-schema.json

+96-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,108 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"definitions" : {
4+
"module-format" : {
5+
"enum": [
6+
"commonjs",
7+
"amdjs",
8+
"goog"
9+
]
10+
},
11+
"module-output" : {
12+
"type": "array",
13+
"items": [
14+
{ "$ref" : "#/definitions/module-format"},
15+
{
16+
"type" : "string",
17+
"description": "output path, if not set, it will be `lib/js/commonjs`, `lib/js/amdjs` or `lib/js/goog` "
18+
}
19+
]
20+
},
21+
"package-spec" : {
22+
"oneOf": [
23+
{
24+
"type": "array",
25+
"items": {
26+
"$ref": "#/definitions/module-output"
27+
},
28+
"description": "package output"
29+
},
30+
{
31+
"enum": [
32+
"all"
33+
],
34+
"description": "All supported format with default output"
35+
}
36+
]
37+
38+
},
439
"sourceItem" : {
540
"title" : "sourceItem",
641
"properties": {
742
"dir" : {
843
"type" : "string"
944
},
10-
"files" : {
45+
"files" :
46+
{
47+
"oneOf": [
48+
{
49+
"type": "array",
50+
"items": {
51+
"type": "string"
52+
},
53+
"description": "if files are empty, the build tool will populate it automatically, this is useful for initial adoption"
54+
},
55+
{
56+
"type" : "object",
57+
"properties" : {
58+
"slow-re" : {
59+
"type" : "string",
60+
"description": "Regex to glob the patterns, syntax is documented here: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Str.html, if users want to have better performance for incremental build, we would suggest list it explicitly"
61+
},
62+
"excludes" : {
63+
"type": "array",
64+
"items": {
65+
"type" : "string"
66+
},
67+
"description": "A list of strings to be excluded "
68+
}
69+
},
70+
"required": ["slow-re"]
71+
}
72+
]
73+
},
74+
75+
76+
"subdirs" : {
1177
"type" : "array",
1278
"items" : {
13-
"type" : "string"
79+
"$ref" : "#/definitions/sourceItem"
80+
}
81+
},
82+
"group" : {
83+
"oneOf": [
84+
{
85+
"type" : "string",
86+
"description": "A _unique_ name for each directory to refer as an internal dependency later"
1487
},
15-
"description": "if files are empty, the build tool will populate it automatically, this is useful for initial adoption"
88+
{
89+
"properties": {
90+
"name" : {
91+
"type" : "string"
92+
},
93+
"hierachy" : {
94+
"type" : "boolean",
95+
"description": "When true, all subdirs are considered as a whole as dependency"
96+
}
97+
}
98+
}
99+
]
16100
},
17-
"subdirs" : {
101+
"internal-depends" : {
18102
"type" : "array",
19-
"items" : {
20-
"$ref" : "#/definitions/sourceItem"
103+
"items": {
104+
"type": "string",
105+
"description": "internal dependencies, if unspecified, all existing listed source files are considered potential dependencies"
21106
}
22107
}
23108
},
@@ -31,6 +116,7 @@
31116
}
32117
},
33118
"title": "BuckleScript build configuration",
119+
"description": "All paths are required for Unix format, the build tool will do conversion internally",
34120
"type": "object",
35121
"properties" : {
36122
"version" : {
@@ -43,6 +129,7 @@
43129
},
44130
"ocaml-config" : {
45131
"title": "OCaml Configuration format",
132+
46133
"properties": {
47134
"bsdep": {
48135
"type": "string",
@@ -55,6 +142,9 @@
55142
"bsc-flags" : {
56143
"$ref" : "#/definitions/stringArray"
57144
},
145+
"package-spec" : {
146+
"$ref" : "#/definitions/package-spec"
147+
},
58148
"bsbuild": {
59149
"type": "string",
60150
"description": "the path to bsbuild"

jscomp/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ js_fold.ml:js_fold.mlp j.ml
2323
sexp_lexer.ml: sexp_lexer.gen.mll
2424
@echo "Regenerating sexp_lexer.ml"
2525
$(OCAMLLEX) $< -o $@
26-
json_lexer.ml: json_lexer.gen.mll
26+
bs_json.ml: bs_json.gen.mll
2727
@echo "Regenerating sexp_lexer.ml"
2828
$(OCAMLLEX) $< -o $@ || (rm $@ && exit 2)
2929

@@ -69,7 +69,7 @@ snapshot3:./bin/bspack.exe
6969
snapshot4:./bin/bspack.exe
7070
BS_OCAMLDEP=true $< -bs-log-mllib bin/bsdep.mllib -prelude-str 'module Config = Config_bsdep' -bs-exclude-I config -I ../ocaml/utils/ -I ../ocaml/parsing/ -I ../ocaml/driver -I common -I ext -I syntax -I depends -I . -bs-main ../ocaml/tools/ocamldep.ml -o bin/bsdep.ml
7171
snapshot5:./bin/bspack.exe
72-
$< -bs-log-mllib bin/bsbuild.mllib -I common -I ext -I syntax -I depends -bs-main ./bsbuild_main.ml -o bin/bsbuild.ml
72+
$< -bs-log-mllib bin/bsb.mllib -I common -I ext -I syntax -I depends -bs-main ./bsb_main.ml -o bin/bsb.ml
7373
snapshot6:./bin/bspack.exe
7474
BS_MIN_LEX_DEPS=true $< -bs-log-mllib bin/bspp.mllib -bs-exclude-I config -I ../ocaml/utils/ -I ../ocaml/parsing?parser -I common -I ext -I syntax -I depends -I bspp -bs-main bspp_main.ml -o bin/bspp.ml
7575

@@ -155,7 +155,7 @@ DEST_BIN=../bin
155155
install:
156156
@echo "copy exe"
157157
mkdir -p $(DEST_BIN) $(DEST)
158-
cp ./bin/bsc.exe ./bin/bsppx.exe ./bin/bspack.exe ./bin/bsdep.exe ./bin/bspp.exe ./bin/bsbuild.exe $(DEST_BIN)
158+
cp ./bin/bsc.exe ./bin/bsppx.exe ./bin/bspack.exe ./bin/bsdep.exe ./bin/bspp.exe ./bin/bsb $(DEST_BIN)
159159
@echo "copy stdlib"
160160
cp ./runtime/*.cmt* ./runtime/*.cmj* ./stdlib/*.cm* ./others/*.ml ./others/*.mli ./others/*.cm* \
161161
./runtime/js.ml ./runtime/js.cmi ./runtime/js_unsafe.cmi ./runtime/js_null.ml ./runtime/js_null.cmi \

jscomp/bin/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ bspp.exe: bspp.mli bspp.ml
1515
bsdep.exe: config_bsdep.mli config_bsdep.ml bsdep.mli bsdep.ml
1616
$(NATIVE) -g -inline 1000 -linkall -w -a $^ -o $@
1717

18-
bsbuild.exe: bsbuild.mli bsbuild.ml
19-
$(NATIVE) -g -inline 1000 -linkall unix.cmxa -w -a $^ -o $@
18+
bsb: bsb.mli bsb.ml
19+
$(NATIVE) -g -inline 1000 -linkall unix.cmxa str.cmxa -w -a $^ -o $@
2020

2121
bsc.exe: config_whole_compiler.mli config_whole_compiler.ml whole_compiler.mli whole_compiler.ml
2222
$(NATIVE) -w -a $^ -o $@
@@ -25,4 +25,4 @@ bspack.exe: config_bspack.mli config_bspack.ml bspack.mli bspack.ml
2525
$(NATIVE) -w -a unix.cmxa $^ -o $@
2626

2727

28-
all: bsppx.exe bspp.exe bsdep.exe bsc.exe bspack.exe bsbuild.exe
28+
all: bsppx.exe bspp.exe bsdep.exe bsc.exe bspack.exe bsb

0 commit comments

Comments
 (0)