<commit_before>/**
 * Build system.
 */

(function() {
  var fs = require("fs");
  var path = require("path");
  var execFile = require("child_process").execFileSync;
  
  // Platform
  var platform = process.platform;
  
  // All sources
  var sources = (function(srcs) {
    var res = [];
    for (var key in srcs) res.push(path.join("src", srcs[key]));
    return res;
  })(fs.readdirSync("src"));
  
  // Provided: path to `mosmlc`
  // TODO: var compilerPath = process.env.pathToCompiler;
  var compilerPath = path.join("C:", "Program Files (x86)", "mosml", "bin");
  var compiler = "mosmlc.exe";
  
  // Tasks
  desc("Compiles all source files.");
  task("default", function() {
    if (!compilerPath) fail("Invalid path!");
    fs.accessSync(compilerPath, fs.F_OK);
    
    console.log("Compiling files:", (function(s) {
      var out = [];
      for (var key in s) out.push(path.basename(s[key]));
      return out;
    })(sources));
    
    var output = execFile(path.join(compilerPath, compiler), sources);
    console.log("Terminated:");
    console.log(output.toString());
  });
  
  desc("Removes output files from source locations and cleans up folders");
  task("cleanup", function() {
    console.log("Cleaning up source locations from output files...");
  });
  
  // Listeners
  jake.addListener("error", function() {
    
  });
})();<commit_msg>Advances in build<commit_after>/**
 * Build system.
 */

(function() {
  var fs = require("fs");
  var path = require("path");
  var glob = require("glob").sync;
  var execFile = require("child_process").execFileSync;
  
  // Platform
  var platform = process.platform;
  
  // All sources
  var sources = (function(srcs) {
    var res = [];
    for (var key in srcs) res.push(path.resolve(srcs[key]));
    return res;
  })(glob("src/*.sml").concat(glob("src/*.sig")));
  
  // Provided: path to `mosmlc`
  // TODO: var compilerPath = process.env.pathToCompiler;
  var compilerPath = path.join("C:", "Program Files (x86)", "mosml", "bin");
  var compiler = "mosmlc.exe";
  
  // Tasks
  desc("Compiles all source files.");
  task("default", function() {
    if (!compilerPath) fail("Invalid path!");
    fs.accessSync(compilerPath, fs.F_OK);
    
    console.log("Compiling files:", (function(s) {
      var out = [];
      for (var key in s) out.push(path.basename(s[key]));
      return out;
    })(sources));
    
    try {
      var output = execFile(path.join(compilerPath, compiler), 
        ["-structure"].concat(sources));
    } catch(e) {
      console.log("Error when compiling!")
      console.log(e.output.toString());
      fail("Compilation failed!");
    }
    
    console.log("Terminated:");
    console.log(output.toString());
  });
  
  desc("Removes output files from source locations and cleans up folders");
  task("cleanup", function() {
    var files = [];
    files = files.concat(glob("src/*.ui"));
    files = files.concat(glob("src/*.uo"));
    
    console.log("Cleaning up source locations from output files:", files);
    
    for (var key in files) fs.unlinkSync(files[key]);
    
    console.log("Cleanup done!");
  });
  
  // Listeners
  jake.addListener("complete", function() {
    jake.Task["cleanup"].invoke();
  });
  
  jake.addListener("error", function() {
    jake.Task["cleanup"].invoke();
  });
})();
{'fraction_non_alphanumeric': 0.18140658013884697, 'fraction_numerical': 0.0012073649260488982, 'mean_word_length': 3.1580928481806776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2423943', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1058, 'n_words': 249}