Skip to content

Commit

Permalink
version agnostic for jscomp/release.ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Mar 25, 2019
1 parent e057bad commit 4a575e9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -86,6 +86,7 @@ odoc_gen/*.cmxs
.bs_dir_cache

.bsbuild
jscomp/release.ninja
jscomp/build.ninja
jscomp/compiler.ninja
jscomp/runtime/build.ninja
Expand Down
7 changes: 0 additions & 7 deletions jscomp/release.ninja

This file was deleted.

3 changes: 0 additions & 3 deletions jscomp/test/polyvar_test.ml
Expand Up @@ -15,6 +15,3 @@ let ff =
else "A"
let () = Js.log (f `A,ff, f1 `A)

(* local variables: *)
(* compile-command: "bsc.exe -I ../runtime -I ../stdlib-402 -bs-main polyvar_test.ml" *)
(* end: *)
17 changes: 14 additions & 3 deletions scripts/install.js
Expand Up @@ -178,17 +178,20 @@ function install(){
return y.ext === '.ml' || y.ext === '.mli' || y.ext.includes('cm')
})
}

var ocamlVersion = require('./vendored_ocaml_version.js').getVersionPrefix()

/**
* raise an exception if not matched
*/
function matchedCompilerExn() {
var output = cp.execSync('ocamlc.opt -v', { encoding: 'ascii' })
var neededVersion = require('./vendored_ocaml_version.js').getVersionPrefix()
if (output.indexOf(neededVersion) >= 0) {

if (output.indexOf(ocamlVersion) >= 0) {
console.log(output)
console.log("Use the compiler above")
} else {
console.log('version', output, 'needed version', neededVersion, "No matched compiler found, may re-try")
console.log('version', output, 'needed version', ocamlVersion, "No matched compiler found, may re-try")
throw ""
}
}
Expand Down Expand Up @@ -237,6 +240,14 @@ function checkPrebuiltBscCompiler() {
}

function buildLibs(){
var releaseNinja = `
stdlib = ${ocamlVersion.includes('4.06')? 'stdlib-406' : 'stdlib-402'}
subninja runtime/release.ninja
subninja others/release.ninja
subninja $stdlib/release.ninja
build all: phony runtime others $stdlib
`
fs.writeFileSync(path.join(jscomp_dir,'release.ninja'),releaseNinja,'ascii')
cp.execFileSync(ninja_bin_output, [ "-f", "release.ninja", "-t", "clean"], { cwd: jscomp_dir, stdio: [0, 1, 2] , shell: false})
cp.execFileSync(ninja_bin_output, [ "-f", "release.ninja"], { cwd: jscomp_dir, stdio: [0, 1, 2] , shell: false})
console.log('Build finished')
Expand Down

0 comments on commit 4a575e9

Please sign in to comment.