Skip to content

Commit 82fba89

Browse files
committed
improve OCaml version file error
1 parent d0ad6f2 commit 82fba89

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,6 @@ jscomp/outcome_printer/reason_syntax_util.ml
139139
jscomp/outcome_printer/reason_syntax_util.mli
140140
jscomp/bin/all_ounit_tests.ml
141141
native/
142-
vendor/ocaml
142+
vendor/ocaml
143+
OCAML_VERSION
144+
ocaml/VERSION

scripts/buildocaml.js

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function getVersionPrefix() {
2929
cached = version.substr(0, version.indexOf("+"));
3030
return cached;
3131
}
32+
33+
console.error(`cannot find '${file}'`);
34+
console.error("You should create OCAML_VERSION or ocaml/VERSION file to specify OCaml version like '4.02.3+buckle-master'");
35+
console.error("For example, run `opam switch show > OCAML_VERSION`");
3236
throw new Error("version file not found");
3337
}
3438
exports.getVersionPrefix = getVersionPrefix;

scripts/install.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ function provideCompiler() {
357357
var releaseNinja = require("./ninjaFactory.js").libNinja({
358358
ocamlopt: "ocamlopt.opt",
359359
ext: ".exe",
360-
INCL: require("./buildocaml.js").getVersionPrefix()
360+
INCL: ocamlVersion
361361
});
362362

363363
var filePath = path.join(lib_dir, "release.ninja");

scripts/prebuilt.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var root_config = { cwd: root, stdio: [0, 1, 2] }
88
process.env.BS_RELEASE_BUILD = 'true'
99

1010

11-
var version = require('./buildocaml.js').getVersionPrefix()
11+
var ocamlVersion = require('./buildocaml.js').getVersionPrefix()
1212
var fs = require('fs')
1313
var hostPlatform = 'darwin'
1414

@@ -19,9 +19,9 @@ function buildCompiler() {
1919
// delete process.env.OCAMLLIB
2020
var prebuilt = 'prebuilt.ninja'
2121
var content = require('./ninjaFactory.js').libNinja({
22-
ocamlopt : is_windows?`ocamlopt.opt.exe`:`../native/${version}/bin/ocamlopt.opt`,
22+
ocamlopt : is_windows?`ocamlopt.opt.exe`:`../native/${ocamlVersion}/bin/ocamlopt.opt`,
2323
ext : sys_extension,
24-
INCL : version
24+
INCL : ocamlVersion
2525
})
2626

2727
fs.writeFileSync(path.join(root,'lib',prebuilt),content,'ascii')

0 commit comments

Comments
 (0)