Skip to content

Commit

Permalink
add a script to automate napkin integration
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Jul 6, 2020
1 parent a7f9785 commit cfccd2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jscomp/compiler.ninja
jscomp/runtime/build.ninja
jscomp/others/build.ninja
jscomp/stdlib-406/build.ninja

jscomp/napkin.ninja
jscomp/compilerEnv.ninja
env.ninja
jscomp/cppoVendor.ninja
Expand Down
10 changes: 10 additions & 0 deletions scripts/ninja.js
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,12 @@ function getPreprocessorFileName() {
*/
function preprocessorNinjaSync() {
var refmtMainPath = version6() ? "../lib/4.06.1" : "../lib/4.02.3";
var napkinFiles = fs
.readdirSync(path.join(jscompDir, "..", "syntax", "src"), "ascii")
.filter((x) => x.endsWith(".ml") || x.endsWith(".mli"));
var buildNapkinFiles = napkinFiles
.map((file) => `build napkin/${file} : copy ../syntax/src/${file}`)
.join("\n");
var cppoNative = `
${useEnv ? getEnnvConfigNinja() : getVendorConfigNinja()}
rule link
Expand Down Expand Up @@ -1561,6 +1567,10 @@ build ../${
libs = ocamlcommon.cmxa
flags = -I ${refmtMainPath} -I +compiler-libs -w -40-30-3 -no-alias-deps
generator = true
rule copy
command = cp $in $out
description = $in -> $out
${buildNapkinFiles}
`;
var cppoNinjaFile = getPreprocessorFileName();
writeFileSync(path.join(jscompDir, cppoNinjaFile), cppoNative);
Expand Down

0 comments on commit cfccd2f

Please sign in to comment.