<commit_before>'use babel';

import fs from 'fs';
import path from 'path';
import os from 'os';
import { exec } from 'child_process';
import voucher from 'voucher';
import { EventEmitter } from 'events';

export const config = {
  jobs: {
    title: 'Simultaneous jobs',
    description: 'Limits how many jobs waf will run simultaneously. Defaults to number of processors. Set to 1 for default behavior of waf.',
    type: 'number',
    default: os.cpus().length,
    minimum: 1,
    maximum: os.cpus().length,
    order: 1
  }
};

export function provideBuilder() {
  const gccErrorMatch = '(?<file>([A-Za-z]:[\\/])?[^:\\n]+):(?<line>\\d+):(?<col>\\d+):\\s*(fatal error|error):\\s*(?<message>.+)';
  const ocamlErrorMatch = '(?<file>[\\/0-9a-zA-Z\\._\\-]+)", line (?<line>\\d+), characters (?<col>\\d+)-(?<col_end>\\d+):\\n(?<message>.+)';
  const errorMatch = [
    gccErrorMatch, ocamlErrorMatch
  ];

  const gccWarningMatch = '(?<file>([A-Za-z]:[\\/])?[^:\\n]+):(?<line>\\d+):(?<col>\\d+):\\s*(warning):\\s*(?<message>.+)';
  const warningMatch = [
    gccWarningMatch
  ];

  return class WafBuildProvider extends EventEmitter {
    constructor(cwd) {
      super();
      this.cwd = cwd;
      atom.config.observe('build-waf.jobs', () => this.emit('refresh'));
    }

    getNiceName() {
      return 'WAF';
    }

    isEligible() {
      this.files = [ 'wscript', 'wscript_build' ]
        .map(f => path.join(this.cwd, f))
        .filter(fs.existsSync);
      return this.files.length > 0;
    }

    settings() {
      //const args = [ `-j${atom.config.get('build-waf.jobs')}` ];
      const args = [ `-j8` ];

      const defaultTarget = {
        exec: 'waf',
        name: 'Waf: default (no target)',
        args: args,
        sh: false,
        errorMatch: errorMatch,
        warningMatch: warningMatch
      };

      return [ defaultTarget ];
    }
  };
}<commit_msg>Added 'clean' and 'configure' targets.<commit_after>'use babel';

import fs from 'fs';
import path from 'path';
import os from 'os';
import { exec } from 'child_process';
import voucher from 'voucher';
import { EventEmitter } from 'events';

export const config = {
  jobs: {
    title: 'Simultaneous jobs',
    description: 'Limits how many jobs waf will run simultaneously. Defaults to number of processors. Set to 1 for default behavior of waf.',
    type: 'number',
    default: os.cpus().length,
    minimum: 1,
    maximum: os.cpus().length,
    order: 1
  }
};

export function provideBuilder() {
  const gccErrorMatch = '(?<file>([A-Za-z]:[\\/])?[^:\\n]+):(?<line>\\d+):(?<col>\\d+):\\s*(fatal error|error):\\s*(?<message>.+)';
  const ocamlErrorMatch = '(?<file>[\\/0-9a-zA-Z\\._\\-]+)", line (?<line>\\d+), characters (?<col>\\d+)-(?<col_end>\\d+):\\n(?<message>.+)';
  const errorMatch = [
    gccErrorMatch, ocamlErrorMatch
  ];

  const gccWarningMatch = '(?<file>([A-Za-z]:[\\/])?[^:\\n]+):(?<line>\\d+):(?<col>\\d+):\\s*(warning):\\s*(?<message>.+)';
  const warningMatch = [
    gccWarningMatch
  ];

  return class WafBuildProvider extends EventEmitter {
    constructor(cwd) {
      super();
      this.cwd = cwd;
      atom.config.observe('build-waf.jobs', () => this.emit('refresh'));
    }

    getNiceName() {
      return 'WAF';
    }

    isEligible() {
      this.files = [ 'wscript', 'wscript_build' ]
        .map(f => path.join(this.cwd, f))
        .filter(fs.existsSync);
      return this.files.length > 0;
    }

    settings() {
      //const args = [ `-j${atom.config.get('build-waf.jobs')}` ];
      const args = [ `-j8` ];

      const defaultTarget = {
        exec: 'waf',
        name: 'Waf: default (no target)',
        args: args,
        sh: false,
        errorMatch: errorMatch,
        warningMatch: warningMatch
      };

      const configTarget = {
        exec: 'waf',
        name: 'Waf: configure',
        args: ['configure'],
        sh: false,
        errorMatch: errorMatch,
        warningMatch: warningMatch
      };

      const cleanTarget = {
        exec: 'waf',
        name: 'Waf: clean',
        args: ['clean'],
        sh: false,
        errorMatch: errorMatch,
        warningMatch: warningMatch
      };

      return [ defaultTarget, configTarget, cleanTarget ];
    }
  };
}
{'fraction_non_alphanumeric': 0.20009449562957712, 'fraction_numerical': 0.003307347035199622, 'mean_word_length': 2.625, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, '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': '5285901', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1457, 'n_words': 316}