Add an MSBuild task #12

Closed
JayBazuzi opened this Issue Dec 22, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@JayBazuzi

An MSBuild task would make it easy to add IronMeta to the build process, including understanding dependencies between .ironmeta and generated .cs.

This would avoid the problem where someone changes (for example) the name of an AST node class, but forgets to rerun ironmeta.

Here's a first stab at an MSBuild Task:

using IronMeta.Generator;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

public class IronMetaTask : Task
{
    public override bool Execute()
    {
        var result = CSharpShell.Process(Input, Output, Namespace, Force);

        if (result.Success)
        {
            return true;
        }
        else
        {
            Log.LogError(result.Error);

            return false;
        }
    }

    public bool Force { get; set; }

    public string Namespace { get; set; }

    public string Output { get; set; }

    [Required]
    public string Input { get; set; }
}
@JayBazuzi

This comment has been minimized.

Show comment
Hide comment
@kulibali

This comment has been minimized.

Show comment
Hide comment
@kulibali

kulibali Jan 8, 2016

Owner

I'll look into this. Sorry it took so long . . . turns out I had turned off emails from github, so i didn't see this until just now.

Owner

kulibali commented Jan 8, 2016

I'll look into this. Sorry it took so long . . . turns out I had turned off emails from github, so i didn't see this until just now.

@kulibali kulibali self-assigned this Jan 8, 2016

@kulibali

This comment has been minimized.

Show comment
Hide comment
@kulibali

kulibali Jan 8, 2016

Owner

Are you running from the command-line? If you are in Visual Studio, there is already an extension (https://visualstudiogallery.msdn.microsoft.com/73263c7c-319f-4f9e-a05a-b493094a4eb0) that provides a generator. Install this and set the "Custom Tool" property of your .ironmeta file to "IronMetaGenerator".

Owner

kulibali commented Jan 8, 2016

Are you running from the command-line? If you are in Visual Studio, there is already an extension (https://visualstudiogallery.msdn.microsoft.com/73263c7c-319f-4f9e-a05a-b493094a4eb0) that provides a generator. Install this and set the "Custom Tool" property of your .ironmeta file to "IronMetaGenerator".

@JayBazuzi

This comment has been minimized.

Show comment
Hide comment
@JayBazuzi

JayBazuzi Jan 8, 2016

Yes command line; specifically in AppVeyor.

We had a problem where we moved a class to a different namespace, but didn't update the .ironmeta file to match. We didn't notice until the next time we edited the .ironmeta file.

Regenerating on build would have caught that in CI.

Yes command line; specifically in AppVeyor.

We had a problem where we moved a class to a different namespace, but didn't update the .ironmeta file to match. We didn't notice until the next time we edited the .ironmeta file.

Regenerating on build would have caught that in CI.

@kulibali kulibali closed this in 056bd8b Jan 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment