AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

Codegen seems a bit over zealous #78

Closed mwpowellhtx closed 6 years ago

mwpowellhtx commented 6 years ago

Is it me or does the Code Generation seem a bit over zealous? What do I mean by that. Correctly so, I observe that code is being generated for my target scenario. However, I am also observing generated files, albeit empty, but for perhaps using statements, and that's it, that are also generated. Presumably, this is probably fairly benign in nature, but I just wanted to clarify that issue. This is how it should operate? Or is it potentially a problem with the generator itself?

mwpowellhtx commented 6 years ago

In particular, see my unit tests for clarification; specifically the in situational unit tests. These are all passing, and I have also reviewed the generated output.

// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

namespace Kingdom.Collections
{
    public partial class CardinalDirection
    {
        private CardinalDirection(byte[] bytes): base (bytes)
        {
        }

        public static CardinalDirection operator ~(CardinalDirection other) => other?.BitwiseNot();
        public static CardinalDirection operator &(CardinalDirection a, CardinalDirection b) => a?.BitwiseAnd(b);
        public static CardinalDirection operator |(CardinalDirection a, CardinalDirection b) => a?.BitwiseOr(b);
        public static CardinalDirection operator ^(CardinalDirection a, CardinalDirection b) => a?.BitwiseXor(b);
    }
}
amis92 commented 6 years ago

It's correct by current design. This issue is a duplicate of #33, in essence. It's an enhancement to be made. :)

mwpowellhtx commented 6 years ago

@amis92 Is it in the pipeline, to your knowledge?

amis92 commented 6 years ago

No, development is in the open, and aside from accepting PRs, the author doesn't actively develop this project currently.

AArnott commented 6 years ago

I absolutely appreciate PRs. But it's not quite true that I'm not actively developing. I'm just stuck. I haven't been able to get this to work on the latest VS 2017 for a while and I have a branch where I've made some changes but haven't got it all working. It's really hard to get roslyn, msbuild, VS and msbuild tasks to all work together to get a reliable code generation system working that also makes VS intellisense happy, works xplat on "dotnet build", etc.

I'm closing this as a dupe of #33

mwpowellhtx commented 6 years ago

@AArnott No worries, thank you! As long as the issue is known and is (at least somewhat) on the radar, even though a workable solution is somewhat evasive.