Skip to content

Commit 35c310f

Browse files
Cagdas Bozmanfacebook-github-bot-6
Cagdas Bozman
authored and
facebook-github-bot-6
committed
Update build system and some fixes on the test-suite on Windows
Summary: This PR: - add build.ocp and 00_config.ocp to compile Flow with ocp-build. - fix in the test-suite for Windows - Fix `temp_dir` test on Windows - Socket files are not recognized as on Linux, so we cannot use '-S' option in bash file. On Windows we juste check as a regular file ('-f'). - We deactivate some tests on Windows which involve symlinks. PS: This work was done in order to make version 0.19.1 work on Windows. We couldn't rebase it as it depends on previous PR that have not been merged in master yet. Closes facebook#1187 Reviewed By: svcscm Differential Revision: D2768382 Pulled By: mroch fb-gh-sync-id: 1aa8107ede4112995fb94af8949b661416203026
1 parent dd579c6 commit 35c310f

File tree

7 files changed

+41
-20
lines changed

7 files changed

+41
-20
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*TAGS
22
_build
3-
_obuild
3+
/_obuild
4+
/.ocp
45
.DS_STORE
56
docs/_site/
67
bin

00_config.ocp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
have_lz4 = false
3+
debug = false
4+
(*
5+
ccopt += [ "-IC:\path\to\lz4\lib" ]
6+
cclib += [ "-LC:\path\to\lz4\lib" ]
7+
*)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ build-flow: build-flow-native-deps $(FLOWLIB)
117117

118118
build-flow-with-ocp: build-flow-stubs-with-ocp
119119
[ -d _obuild ] || ocp-build init
120-
ocp-build build
120+
ocp-build build flow
121121

122122
build-flow-debug: build-flow-native-deps $(FLOWLIB)
123123
ocamlbuild -lflags -custom -no-links $(INCLUDE_OPTS) $(LIB_OPTS) -lflags "$(LINKER_FLAGS)" src/flow.d.byte

README.win32

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,43 @@ generate OCaml applications with it without installing Cygwin or
1111
Windows SDK.
1212

1313
To download and install OCPWin, go to http://www.typerex.org/ocpwin.html,
14-
and choose the "full" version. OCPWin installer is known to have problems
14+
and choose the "full" version. OCPWin installer was known to have problems
1515
with PATHs exceeding 1024 characters. Be careful to save your PATH before
1616
the installation to be able to restore it in case of problem, until the
1717
problem is fixed.
1818

1919
### Configuration and Compilation
2020

21-
In the Hack root directory, edit the file `00_config.ocp`
21+
In the Flow root directory, edit the file `00_config.ocp`
2222
and adjust the two following variables:
2323

2424
has_lz4 = false (* true if lz4 is installed on your machine *)
2525
debug = false (* true if you want to activate the debug mode *)
2626

27-
NOTE: lz4 is not required to build Hack. If you want to use it, and lz4 is not
28-
installed in the default path, you have to set the
29-
`ccopt` variable correctly in the `00_config.ocp` file. For instance:
27+
NOTE: lz4 is not required to build Flow. If you want to use it, and
28+
lz4 is not installed in the default path, you have to set the
29+
`ccopt` variable correctly in the `00_config.ocp` file. For
30+
instance:
3031

3132
ccopt = [ "-I/PATH/TO/LZ4/DIRECTORY" ]
3233
cclib = [ "-L/PATH/TO/LZ4/DIRECTORY" ]
3334

3435
Then, execute the `make.bat` script:
3536

36-
./make
37+
./make.bat
3738

3839
This will call `ocp-build` and copy the generated files into the bin/
3940
sub-directory.
4041

4142
If you want to clean your project, you may use:
4243

43-
./make clean
44+
./make.bat clean
4445

45-
Optionally, to run the test-suite adjust the path to the `python.exe`
46-
in `make.bat`, and run:
46+
Optionally, to run the test-suite, install [Git for
47+
Windows](https://git-scm.com/downloads) start git bash tool and launch
48+
the testsuite:</p>
4749

48-
./make test
49-
50-
### Installing
51-
52-
Coming soon
50+
./runtest.sh ./bin/flow.exe
5351

5452
### FAQ
5553

build.ocp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,20 @@ begin library "flow-typing"
100100
"src/typing/changeset.ml"
101101
"src/typing/type.ml"
102102
"src/typing/constraint_js.ml"
103+
"src/typing/modulename.ml"
103104
"src/typing/context.ml"
104105
"src/typing/type_printer.ml"
105106
"src/typing/type_visitor.ml"
106107
"src/typing/scope.ml"
107108
"src/typing/trace.ml"
108-
"src/typing/debug.ml"
109+
"src/typing/debug_js.ml"
109110
"src/typing/flow_js.ml"
110111
"src/typing/env_js.ml"
111112
"src/typing/type_inference_hooks_js.ml"
112113
"src/typing/autocomplete_js.ml"
113114
"src/typing/module_js.ml"
115+
"src/typing/refinement.ml"
116+
"src/typing/abnormal.ml"
114117
"src/typing/type_inference_js.ml"
115118
"src/typing/comments_js.ml"
116119
"src/typing/getDef_js.ml"
@@ -130,6 +133,7 @@ begin library "flow-server"
130133
"src/server/serverPeriodical.ml"
131134
"src/server/serverFunctors.ml"
132135
"src/server/autocompleteService_js.ml"
136+
"src/services/inference/query_types.ml"
133137
"src/server/server.ml"
134138
]
135139
end

runtests.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
if [[ "$OSTYPE" == "darwin"* ]]; then
34
_canonicalize_file_path() {
45
local dir file
@@ -93,7 +94,13 @@ runtest() {
9394
cd "$dir" || exit 1
9495
name=${dir##*/}
9596
exp_file="${name}.exp"
96-
if [[ -z $filter || $name =~ $filter ]]
97+
# On Windows we skip some tests as symlinks not available
98+
if [ "$OSTYPE" = "msys" ] &&
99+
([ $name = "symlink" ] ||
100+
[ $name = "node_tests" ])
101+
then
102+
return $RUNTEST_SKIP
103+
elif [[ -z $filter || $name =~ $filter ]]
97104
then
98105
if ([ ! -e "$exp_file" ] || [ ! -e ".flowconfig" ])
99106
then
@@ -203,7 +210,7 @@ runtest() {
203210
trap - SIGINT SIGTERM
204211
fi
205212
diff_file="${name}.diff"
206-
diff -u "$exp_file" "$out_file" > "$diff_file"
213+
diff -u --strip-trailing-cr "$exp_file" "$out_file" > "$diff_file"
207214
if [ -s "$diff_file" ]
208215
then
209216
return_status=$RUNTEST_FAILURE

tests/temp_dir/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ FLOW=$1
33
$FLOW stop 2> /dev/null > /dev/null
44
mkdir -p tmp/flow
55
$FLOW start --wait --temp-dir tmp/flow
6-
[ -S tmp/flow/*.sock ] && echo "sock file exists"
6+
if [[ "$OSTYPE" == "msys"* ]]; then
7+
[ -f tmp/flow/*.sock ] && echo "sock file exists"
8+
else
9+
[ -S tmp/flow/*.sock ] && echo "sock file exists"
10+
fi
711
[ -d tmp/flow/flowlib_* ] && echo "flowlib exists"
812
[ -f tmp/flow/*.init ] && echo "init file exists"
913
[ -f tmp/flow/*.lock ] && echo "lock file exists"

0 commit comments

Comments
 (0)