Skip to content

Commit b013a9d

Browse files
committed
fix build error
1 parent d7e1735 commit b013a9d

File tree

7 files changed

+44
-38
lines changed

7 files changed

+44
-38
lines changed

jscomp/bin/bsb.ml

+10-9
Original file line numberDiff line numberDiff line change
@@ -6459,12 +6459,12 @@ let root = OCamlRes.Res.([
64596459
\ \"sources\": [\n\
64606460
\ \"src\"\n\
64616461
\ ],\n\
6462-
\ \"package-specs\": [\n\
6462+
\ \"package-specs\":\n\
64636463
\ {\n\
64646464
\ \"module\": \"commonjs\",\n\
64656465
\ \"in-source\": true\n\
64666466
\ }\n\
6467-
\ ],\n\
6467+
\ ,\n\
64686468
\ \"bs-dependencies\" : [\n\
64696469
\ // add your bs-dependencies here \n\
64706470
\ ]\n\
@@ -6668,7 +6668,8 @@ let root = OCamlRes.Res.([
66686668
\ \"scripts\": {\n\
66696669
\ \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n\
66706670
\ \"start\": \"bsb -make-world -w\",\n\
6671-
\ \"build\": \"webpack -w\",\n\
6671+
\ \"build\": \"bsb -make-world\" ,\n\
6672+
\ \"webpack\": \"webpack -w\",\n\
66726673
\ \"clean\": \"bsb -clean-world\"\n\
66736674
\ },\n\
66746675
\ \"keywords\": [],\n\
@@ -6697,9 +6698,9 @@ let root = OCamlRes.Res.([
66976698
\ \"sources\": [\n\
66986699
\ {\n\
66996700
\ \"dir\": \"src\",\n\
6700-
\ \"subdirs\": [\"interop\", \"simple\"],\n\
6701+
\ \"subdirs\": [\"interop\", \"simple\"]\n\
67016702
\ }\n\
6702-
\ ],\n\
6703+
\ ]\n\
67036704
}\n\
67046705
") ;
67056706
File (".gitignore",
@@ -11525,14 +11526,14 @@ let define
1152511526
} in self
1152611527

1152711528

11528-
(** We don't need set [-o $out] when building ast
11529-
since the default is already good *)
11529+
(** FIXME: We don't need set [-o ${out}] when building ast
11530+
since the default is already good -- it does not*)
1153011531
let build_ast_and_module_sets =
1153111532
define
11532-
~command:"${bsc} ${pp_flags} ${ppx_flags} ${bsc_flags} -c -bs-syntax-only -bs-binary-ast ${in}"
11533+
~command:"${bsc} ${pp_flags} ${ppx_flags} ${bsc_flags} -c -o ${out} -bs-syntax-only -bs-binary-ast ${in}"
1153311534
"build_ast_and_module_sets"
1153411535

11535-
(** TODO: [-o $out] should not be needed here either *)
11536+
1153611537
let build_ast_and_module_sets_from_re =
1153711538
define
1153811539
~command:"${bsc} -pp \"${refmt} ${refmt_flags}\" ${reason_react_jsx} ${ppx_flags} ${bsc_flags} -c -o ${out} -bs-syntax-only -bs-binary-ast -impl ${in}"

jscomp/bsb/bsb_rule.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ let define
9494
} in self
9595

9696

97-
(** We don't need set [-o $out] when building ast
98-
since the default is already good *)
97+
(** FIXME: We don't need set [-o ${out}] when building ast
98+
since the default is already good -- it does not*)
9999
let build_ast_and_module_sets =
100100
define
101-
~command:"${bsc} ${pp_flags} ${ppx_flags} ${bsc_flags} -c -bs-syntax-only -bs-binary-ast ${in}"
101+
~command:"${bsc} ${pp_flags} ${ppx_flags} ${bsc_flags} -c -o ${out} -bs-syntax-only -bs-binary-ast ${in}"
102102
"build_ast_and_module_sets"
103103

104-
(** TODO: [-o $out] should not be needed here either *)
104+
105105
let build_ast_and_module_sets_from_re =
106106
define
107107
~command:"${bsc} -pp \"${refmt} ${refmt_flags}\" ${reason_react_jsx} ${ppx_flags} ${bsc_flags} -c -o ${out} -bs-syntax-only -bs-binary-ast -impl ${in}"

jscomp/bsb/bsb_templates.ml

+6-5
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,12 @@ let root = OCamlRes.Res.([
420420
\ \"sources\": [\n\
421421
\ \"src\"\n\
422422
\ ],\n\
423-
\ \"package-specs\": [\n\
423+
\ \"package-specs\":\n\
424424
\ {\n\
425425
\ \"module\": \"commonjs\",\n\
426426
\ \"in-source\": true\n\
427427
\ }\n\
428-
\ ],\n\
428+
\ ,\n\
429429
\ \"bs-dependencies\" : [\n\
430430
\ // add your bs-dependencies here \n\
431431
\ ]\n\
@@ -629,7 +629,8 @@ let root = OCamlRes.Res.([
629629
\ \"scripts\": {\n\
630630
\ \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n\
631631
\ \"start\": \"bsb -make-world -w\",\n\
632-
\ \"build\": \"webpack -w\",\n\
632+
\ \"build\": \"bsb -make-world\" ,\n\
633+
\ \"webpack\": \"webpack -w\",\n\
633634
\ \"clean\": \"bsb -clean-world\"\n\
634635
\ },\n\
635636
\ \"keywords\": [],\n\
@@ -658,9 +659,9 @@ let root = OCamlRes.Res.([
658659
\ \"sources\": [\n\
659660
\ {\n\
660661
\ \"dir\": \"src\",\n\
661-
\ \"subdirs\": [\"interop\", \"simple\"],\n\
662+
\ \"subdirs\": [\"interop\", \"simple\"]\n\
662663
\ }\n\
663-
\ ],\n\
664+
\ ]\n\
664665
}\n\
665666
") ;
666667
File (".gitignore",

jscomp/bsb/templates/react/bsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"sources": [
1010
{
1111
"dir": "src",
12-
"subdirs": ["interop", "simple"],
12+
"subdirs": ["interop", "simple"]
1313
}
14-
],
14+
]
1515
}

jscomp/bsb/templates/react/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": {
88
"test": "echo \"Error: no test specified\" && exit 1",
99
"start": "bsb -make-world -w",
10-
"build": "webpack -w",
10+
"build": "bsb -make-world" ,
11+
"webpack": "webpack -w",
1112
"clean": "bsb -clean-world"
1213
},
1314
"keywords": [],

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"scripts": {
3232
"test": "go build -o test.exe scripts/test.go && ./test.exe",
33+
"test-theme" : "go run scripts/test.go -no-install-global -no-ounit -no-mocha -no-bsb",
3334
"wtest": "mocha './jscomp/test/**/*test.js' -R spec -w",
3435
"cover": "istanbul cover --report html ./node_modules/.bin/_mocha -- ./jscomp/test/**/*test.js && open coverage/index.html",
3536
"coverage": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- './jscomp/test/*test.js' -R spec",

scripts/test.go

+19-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"flag"
55
"fmt"
6+
"io/ioutil"
67
"log"
78
"os"
89
"os/exec"
@@ -11,7 +12,6 @@ import (
1112
"strings"
1213
"sync"
1314
"time"
14-
"io/ioutil"
1515
)
1616

1717
type command struct {
@@ -94,9 +94,9 @@ func commandString(name string) command {
9494
return makeCommand(name, xs[0], xs[1:]...)
9595

9696
}
97-
func checkError(err error) {
97+
func checkError( err error, theme ... string) {
9898
if err != nil {
99-
log.Fatalf("Error: %s", err.Error())
99+
log.Fatalf("Error:%v\n====\n%s\n====\n", theme,err.Error())
100100
}
101101
}
102102

@@ -107,15 +107,16 @@ func testTheme(theme string) {
107107
output, err := cmd.CombinedOutput()
108108

109109
fmt.Println(string(output))
110-
checkError(err)
110+
checkError(err, theme)
111111

112-
fmt.Println("Started to build ")
112+
fmt.Println("Started to build ", theme)
113113
cmd2 := exec.Command("npm", "run", "build")
114114
cmd2.Dir = theme
115115
output2, err := cmd2.CombinedOutput()
116116
fmt.Println(string(output2))
117-
checkError(err)
117+
checkError(err, theme)
118118
os.RemoveAll(theme)
119+
fmt.Println("Finish building",theme)
119120
}
120121

121122
func runMoCha(wg *sync.WaitGroup) {
@@ -153,20 +154,20 @@ func init() {
153154
os.Setenv("PATH",
154155
vendorOCamlPath+string(os.PathListSeparator)+os.Getenv("PATH"))
155156
}
156-
func fatalError(err error){
157-
if err!= nil {
158-
panic (err)
157+
func fatalError(err error) {
158+
if err != nil {
159+
panic(err)
159160
}
160161
}
161162
func bsbInDir(dir string) {
162-
163+
163164
destDir := filepath.Join("jscomp", "build_tests", dir)
164-
pattern, err := ioutil.ReadFile(filepath.Join(destDir,"output.ref"))
165-
fatalError(err)
166-
argsB, err := ioutil.ReadFile(filepath.Join(destDir,"input.sh"))
165+
pattern, err := ioutil.ReadFile(filepath.Join(destDir, "output.ref"))
166+
fatalError(err)
167+
argsB, err := ioutil.ReadFile(filepath.Join(destDir, "input.sh"))
167168
fatalError(err)
168169
args := strings.Fields(strings.TrimSpace(string(argsB)))
169-
170+
170171
patternS := string(pattern)
171172
c := cmd(args[0], args[1:]...)
172173
c.Dir = destDir
@@ -193,7 +194,7 @@ func main() {
193194
noOunitTest := flag.Bool("no-ounit", false, "don't do ounit test")
194195
noMochaTest := flag.Bool("no-mocha", false, "don't run mocha")
195196
noThemeTest := flag.Bool("no-theme", false, "no bsb theme test")
196-
197+
noBsbTest := flag.Bool("no-bsb", false, "no bsb test")
197198
// disableAll := flag.Bool("disable-all", false, "disable all tets")
198199
flag.Parse()
199200

@@ -240,6 +241,7 @@ func main() {
240241
}
241242
wg.Wait()
242243
}
243-
244-
bsbInDir("in_source")
244+
if !*noBsbTest {
245+
bsbInDir("in_source")
246+
}
245247
}

0 commit comments

Comments
 (0)