<commit_before>/**
 * @license
 * Copyright 2018 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.swift',
  name: 'GenSwift',
  requires: [
    'foam.core.Model',
    'foam.swift.Enum',
    'foam.swift.EnumValue',
    'foam.swift.SwiftClass',
    'foam.swift.EmptyClass',
    'foam.swift.Field',
    'foam.swift.Method',
  ],
  imports: [
    'classloader',
  ],
  properties: [
    {
      class: 'StringArray',
      name: 'models',
    },
    {
      name: 'coreModels',
      value: [
        'foam.core.Detachable',
        'foam.core.EventProxy',
        'foam.mlang.order.Comparator',
        'foam.mlang.predicate.Predicate',
        'foam.swift.core.ConstantSlot',
        'foam.swift.core.ExpressionSlot',
        'foam.swift.core.PropertySlot',
        'foam.swift.core.Slot',
        'foam.swift.core.SubSlot',
        'foam.swift.parse.PStream',
        'foam.swift.parse.json.AnyKeyParser',
        'foam.swift.parse.json.AnyParser',
        'foam.swift.parse.json.ArrayParser',
        'foam.swift.parse.json.BooleanParser',
        'foam.swift.parse.json.DateParser',
        'foam.swift.parse.json.ExprParser',
        'foam.swift.parse.json.FObjectArrayParser',
        'foam.swift.parse.json.FObjectParser',
        'foam.swift.parse.json.FloatParser',
        'foam.swift.parse.json.IntParser',
        'foam.swift.parse.json.LongParser',
        'foam.swift.parse.json.MapParser',
        'foam.swift.parse.json.NullParser',
        'foam.swift.parse.json.PropertyParser',
        'foam.swift.parse.json.UnknownPropertyParser',
        'foam.swift.parse.json.output.Outputter',
        'foam.json2.PrettyOutputterOutput',
        'foam.swift.parse.parser.Alt',
        'foam.swift.parse.parser.AnyChar',
        'foam.swift.parse.parser.Chars',
        'foam.swift.parse.parser.Fail',
        'foam.swift.parse.parser.Not',
        'foam.swift.parse.parser.NotChar',
        'foam.swift.parse.parser.NotChars',
        'foam.swift.parse.parser.Parser',
        'foam.swift.parse.parser.Repeat',
        'foam.swift.parse.parser.Repeat0',
        'foam.swift.parse.parser.Seq',
        'foam.swift.parse.parser.Seq0',
        'foam.swift.parse.parser.Seq2',
        'foam.swift.parse.parser.Substring',
      ],
    },
    {
      name: 'blacklist',
      value: [
        'FObject',
        'foam.core.AbstractInterface',
        'foam.swift.ui.AbstractGenIBOutletDetailView',
        'foam.core.Property',
        'foam.dao.index.TreeIndex',
        'foam.swift.SwiftClass',
        'foam.swift.Method',
        'foam.swift.Field',
      ],
    },
    {
      class: 'String',
      name: 'outdir',
    },
    {
      name: 'fs',
      factory: function() { return require('fs'); }
    },
  ],
  methods: [
    function execute() {
      var self = this;

      var axiomFilter = foam.util.flagFilter(['swift']);

      if ( !this.outdir ) {
        console.log('ERROR: outdir not specified');
        process.exit(1);
      }
      self.fs.mkdirSync(this.outdir);
      var promises = [];
      this.coreModels.concat(this.models).forEach(function(m) {
        promises.push(self.classloader.load(m));
      })
      return Promise.all(promises).then(function() {<commit_msg>Make GenSwift classload in sequence rather than in parallel.<commit_after>/**
 * @license
 * Copyright 2018 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.swift',
  name: 'GenSwift',
  requires: [
    'foam.core.Model',
    'foam.swift.Enum',
    'foam.swift.EnumValue',
    'foam.swift.SwiftClass',
    'foam.swift.EmptyClass',
    'foam.swift.Field',
    'foam.swift.Method',
  ],
  imports: [
    'classloader',
  ],
  properties: [
    {
      class: 'StringArray',
      name: 'models',
    },
    {
      name: 'coreModels',
      value: [
        'foam.core.Detachable',
        'foam.core.EventProxy',
        'foam.mlang.order.Comparator',
        'foam.mlang.predicate.Predicate',
        'foam.swift.core.ConstantSlot',
        'foam.swift.core.ExpressionSlot',
        'foam.swift.core.PropertySlot',
        'foam.swift.core.Slot',
        'foam.swift.core.SubSlot',
        'foam.swift.parse.PStream',
        'foam.swift.parse.json.AnyKeyParser',
        'foam.swift.parse.json.AnyParser',
        'foam.swift.parse.json.ArrayParser',
        'foam.swift.parse.json.BooleanParser',
        'foam.swift.parse.json.DateParser',
        'foam.swift.parse.json.ExprParser',
        'foam.swift.parse.json.FObjectArrayParser',
        'foam.swift.parse.json.FObjectParser',
        'foam.swift.parse.json.FloatParser',
        'foam.swift.parse.json.IntParser',
        'foam.swift.parse.json.LongParser',
        'foam.swift.parse.json.MapParser',
        'foam.swift.parse.json.NullParser',
        'foam.swift.parse.json.PropertyParser',
        'foam.swift.parse.json.UnknownPropertyParser',
        'foam.swift.parse.json.output.Outputter',
        'foam.json2.PrettyOutputterOutput',
        'foam.swift.parse.parser.Alt',
        'foam.swift.parse.parser.AnyChar',
        'foam.swift.parse.parser.Chars',
        'foam.swift.parse.parser.Fail',
        'foam.swift.parse.parser.Not',
        'foam.swift.parse.parser.NotChar',
        'foam.swift.parse.parser.NotChars',
        'foam.swift.parse.parser.Parser',
        'foam.swift.parse.parser.Repeat',
        'foam.swift.parse.parser.Repeat0',
        'foam.swift.parse.parser.Seq',
        'foam.swift.parse.parser.Seq0',
        'foam.swift.parse.parser.Seq2',
        'foam.swift.parse.parser.Substring',
      ],
    },
    {
      name: 'blacklist',
      value: [
        'FObject',
        'foam.core.AbstractInterface',
        'foam.swift.ui.AbstractGenIBOutletDetailView',
        'foam.core.Property',
        'foam.dao.index.TreeIndex',
        'foam.swift.SwiftClass',
        'foam.swift.Method',
        'foam.swift.Field',
      ],
    },
    {
      class: 'String',
      name: 'outdir',
    },
    {
      name: 'fs',
      factory: function() { return require('fs'); }
    },
  ],
  methods: [
    function execute() {
      var self = this;

      var axiomFilter = foam.util.flagFilter(['swift']);

      if ( !this.outdir ) {
        console.log('ERROR: outdir not specified');
        process.exit(1);
      }
      self.fs.mkdirSync(this.outdir);

      with ( foam.cps ) {
        var p = new Promise(
          compose(
            map(awrap(self.classloader.load.bind(self.classloader))),
            value(self.coreModels.concat(self.models))
          )
        )
      }

      return p.then(function() {
{'fraction_non_alphanumeric': 0.16032486088133555, 'fraction_numerical': 0.003308768235824936, 'mean_word_length': 2.1818181818181817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4908346', 'n_tokens_mistral': 2378, 'n_tokens_neox': 2257, 'n_words': 251}