@@ -9,9 +9,40 @@ var root_config = { cwd: root, stdio: [0, 1, 2], encoding: "utf8" };
9
9
10
10
var ocamlVersion = require ( "./buildocaml.js" ) . getVersionPrefix ( ) ;
11
11
var fs = require ( "fs" ) ;
12
+ var package_config = require ( path . join ( __dirname , ".." , "package.json" ) ) ;
13
+ var bsVersion = fs . readFileSync (
14
+ path . join ( __dirname , ".." , "jscomp" , "common" , "bs_version.ml" ) ,
15
+ "utf-8"
16
+ ) ;
17
+ /**
18
+ *
19
+ * @param {string } bsVersion
20
+ * @param {string } version
21
+ */
22
+ function verifyVersion ( bsVersion , version ) {
23
+ try {
24
+ let [ major , minor ] = bsVersion
25
+ . split ( "\n" )
26
+ . find ( ( x ) => x . startsWith ( "let version = " ) )
27
+ . split ( "=" ) [ 1 ]
28
+ . trim ( )
29
+ . slice ( 1 , - 1 )
30
+ . split ( "." ) ;
31
+ let [ specifiedMajor , specifiedMinor ] = version . split ( "." ) ;
32
+ console . log (
33
+ `package.json ${ specifiedMajor } .${ specifiedMinor } vs ABI : ${ major } .${ minor } `
34
+ ) ;
35
+ return major === specifiedMajor && minor === specifiedMinor ;
36
+ } catch ( e ) {
37
+ return false ;
38
+ }
39
+ }
40
+ var assert = require ( "assert" ) ;
41
+
42
+ assert ( verifyVersion ( bsVersion , package_config . version ) ) ;
12
43
13
- function isHostPlatform ( ) {
14
- return process . platform === "darwin" || process . platform === "linux"
44
+ function isHostPlatform ( ) {
45
+ return process . platform === "darwin" || process . platform === "linux" ;
15
46
}
16
47
function rebuild ( ) {
17
48
cp . execSync ( `node ${ path . join ( __dirname , "ninja.js" ) } cleanbuild` , {
@@ -53,7 +84,7 @@ if (!is_windows) {
53
84
}
54
85
55
86
function createOCamlTar ( ) {
56
- if ( isHostPlatform ( ) ) {
87
+ if ( isHostPlatform ( ) ) {
57
88
require ( "./installUtils.js" ) . install ( ) ;
58
89
console . log ( `status in ocaml submodule:` ) ;
59
90
cp . execSync ( `git -C ocaml status -uno` , { cwd : root , stdio : [ 0 , 1 , 2 ] } ) ;
0 commit comments