<commit_before>MEFBuild
=========

MEFBuild is a lightweight framework for implementing complex, multi-step build processes using .NET code.
MEFBuild mimics MSBuild and relies on the Microsoft Extensibility Framework to make builds loosely-coupled and extensible.
      
Getting Started
---------------

* Install the [MefBuild NuGet package](https://www.nuget.org/packages/MefBuild).
* Define a class that inherits from *Command* and mark it with MEF's *Export* attribute.

```C#
using System;
using System.Composition;
using MefBuild;

[Export]
public class HelloWorld : Command
{
    public override void Execute()
    {
        Console.WriteLine("Hello, World!");
    }
}
```

* Create an *Engine* instance with a MEF *CompositionContext* that contains your command and call the *Execute* method with its type.

```C#
using System.Composition;
using System.Composition.Hosting;
using MefBuild;

class Program
{
    static void Main(string[] args)
    {
        CompositionContext context = new ContainerConfiguration()
            .WithAssembly(typeof(Program).Assembly)
            .CreateContainer();
        var engine = new Engine(context);
        engine.Execute<HelloWorld>();
    }
}
``` 

Defining Build Structure
------------------------

MEFBuild includes *Command*, an abstract base class for implementing the concrete types that represent individual steps in your build process. 
Commands are similar to MSBuild tasks in this regard. For an old-fashioned C/C++ build process that has separate steps for compiler and linker, 
you might have the following two commands defined.


```C#
[Export]
public class Compile : Command
{
    public override void Execute()
    {
        Console.WriteLine("Compiling...");
    }
}

[Export]
public class Link : Command
{
    public override void Execute()
    {
        Console.WriteLine("Linking...");
    }
}
```

To define correct order for executing these commands, you can define a Build command and list Compile and Link in its *DependsOn* attribute. 
This is similar to defining MSBuild targets with DependsOnTargets attribute. In this regard, MEFBuild commands are similar to 
MSBuild targets too.

```C#
[Export, DependsOn(typeof(Compile), typeof(Link))]
public class Build : Command
{
    public override void Execute()
    {
        Console.WriteLine("Done.");
    }
}
```

With these definitions, executing the *Build* command produces the following output.

> Compiling...
> Linking...
> Done.<commit_msg>- Fixed block quote formatting.<commit_after>MEFBuild
=========

MEFBuild is a lightweight framework for implementing complex, multi-step build processes using .NET code.
MEFBuild mimics MSBuild and relies on the Microsoft Extensibility Framework to make builds loosely-coupled and extensible.
      
Getting Started
---------------

* Install the [MefBuild NuGet package](https://www.nuget.org/packages/MefBuild).
* Define a class that inherits from *Command* and mark it with MEF's *Export* attribute.

```C#
using System;
using System.Composition;
using MefBuild;

[Export]
public class HelloWorld : Command
{
    public override void Execute()
    {
        Console.WriteLine("Hello, World!");
    }
}
```

* Create an *Engine* instance with a MEF *CompositionContext* that contains your command and call the *Execute* method with its type.

```C#
using System.Composition;
using System.Composition.Hosting;
using MefBuild;

class Program
{
    static void Main(string[] args)
    {
        CompositionContext context = new ContainerConfiguration()
            .WithAssembly(typeof(Program).Assembly)
            .CreateContainer();
        var engine = new Engine(context);
        engine.Execute<HelloWorld>();
    }
}
``` 

Defining Build Structure
------------------------

MEFBuild includes *Command*, an abstract base class for implementing the concrete types that represent individual steps in your build process. 
Commands are similar to MSBuild tasks in this regard. For an old-fashioned C/C++ build process that has separate steps for compiler and linker, 
you might have the following two commands defined.


```C#
[Export]
public class Compile : Command
{
    public override void Execute()
    {
        Console.WriteLine("Compiling...");
    }
}

[Export]
public class Link : Command
{
    public override void Execute()
    {
        Console.WriteLine("Linking...");
    }
}
```

To define correct order for executing these commands, you can define a Build command and list Compile and Link in its *DependsOn* attribute. 
This is similar to defining MSBuild targets with DependsOnTargets attribute. In this regard, MEFBuild commands are similar to 
MSBuild targets too.

```C#
[Export, DependsOn(typeof(Compile), typeof(Link))]
public class Build : Command
{
    public override void Execute()
    {
        Console.WriteLine("Done.");
    }
}
```

With these definitions, executing the *Build* command produces the following output.

> Compiling...
> 
> Linking...
> 
> Done.
{'fraction_non_alphanumeric': 0.10672573499798631, 'fraction_numerical': 0.0, 'mean_word_length': 3.4387846291331545, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '1905749', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1292, 'n_words': 523}