<commit_before>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using static System.IO.Directory;
using static System.IO.Path;
using static Bud.FileUtils;

namespace Bud {
  /// <summary>
  ///   This build engine tries to isolate tasks by creating a signed output directory for each task.
  /// </summary>
  /// <remarks>
  ///   Here's how this engine processes a build task:
  ///
  ///   <ul>
  ///     <li>Execute all direct dependencies of task A.</li>
  ///
  ///     <li>Retrieve the signature of task A.</li>
  ///
  ///     <li>Check that no other task has the same signature.</li>
  ///
  ///     <li>Check if an output directory with same signature already exists.</li>
  ///
  ///     <li>If the directory exists, go to the last step, if not, continue with the next step.</li>
  ///
  ///     <li>Create a temporary directory and ask the task to place its output into this directory.</li>
  ///
  ///     <li>Abort the build if the task threw an exception. If not, rename the temporary directory to the
  ///     signature of the task.</li>
  ///
  ///     <li>Store the output directory in a list.</li>
  ///   </ul>
  ///
  ///   The end result is a list of all output directories. The engine now copies the contents of all output directories
  ///   into the output directory.
  /// </remarks>
  public class BuildEngine {
    /// <summary>
    ///   The directory where all sources of the build are located.
    /// </summary>
    public string SourceDir { get; }

    /// <summary>
    ///   The directory where all output files should end up.
    /// </summary>
    public string OutputDir { get; }

    /// <summary>
    ///   The directory where this engine will place its build meta files, cached etc.
    /// </summary>
    public string MetaDir { get; }

    /// <summary>
    ///   The directory inside <see cref="MetaDir"/> where finished output directories are located.
    /// </summary>
    public string DoneOutputsDir { get; }

    /// <summary>
    ///   The directory inside <see cref="MetaDir"/> where unfinished output directories are located.
    /// </summary>
    public string PartialOutputsDir { get; }

    /// <summary>
    ///   Task graphs are built up in a single thread. This is why this can be a normal dictionary.
    /// </summary>
    private readonly Dictionary<IBuildTask, TaskGraph> buildTaskToTaskGraph = new Dictionary<IBuildTask, TaskGraph>();
<commit_msg>Clarifies xmldocs of BuildEngine.MetaDir.<commit_after>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using static System.IO.Directory;
using static System.IO.Path;
using static Bud.FileUtils;

namespace Bud {
  /// <summary>
  ///   This build engine tries to isolate tasks by creating a signed output directory for each task.
  /// </summary>
  /// <remarks>
  ///   Here's how this engine processes a build task:
  ///
  ///   <ul>
  ///     <li>Execute all direct dependencies of task A.</li>
  ///
  ///     <li>Retrieve the signature of task A.</li>
  ///
  ///     <li>Check that no other task has the same signature.</li>
  ///
  ///     <li>Check if an output directory with same signature already exists.</li>
  ///
  ///     <li>If the directory exists, go to the last step, if not, continue with the next step.</li>
  ///
  ///     <li>Create a temporary directory and ask the task to place its output into this directory.</li>
  ///
  ///     <li>Abort the build if the task threw an exception. If not, rename the temporary directory to the
  ///     signature of the task.</li>
  ///
  ///     <li>Store the output directory in a list.</li>
  ///   </ul>
  ///
  ///   The end result is a list of all output directories. The engine now copies the contents of all output directories
  ///   into the output directory.
  /// </remarks>
  public class BuildEngine {
    /// <summary>
    ///   The directory where all sources of the build are located.
    /// </summary>
    public string SourceDir { get; }

    /// <summary>
    ///   The directory where all output files should end up.
    /// </summary>
    public string OutputDir { get; }

    /// <summary>
    ///   The directory where this engine will place its build meta files, caches, and other internal files.
    /// </summary>
    public string MetaDir { get; }

    /// <summary>
    ///   The directory inside <see cref="MetaDir"/> where finished output directories are located.
    /// </summary>
    public string DoneOutputsDir { get; }

    /// <summary>
    ///   The directory inside <see cref="MetaDir"/> where unfinished output directories are located.
    /// </summary>
    public string PartialOutputsDir { get; }

    /// <summary>
    ///   Task graphs are built up in a single thread. This is why this can be a normal dictionary.
    /// </summary>
    private readonly Dictionary<IBuildTask, TaskGraph> buildTaskToTaskGraph = new Dictionary<IBuildTask, TaskGraph>();

{'fraction_non_alphanumeric': 0.1239620403321471, 'fraction_numerical': 0.0, 'mean_word_length': 2.3614617940199336, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '5874932', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1359, 'n_words': 568}