AArnott / CodeGeneration.Roslyn

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

Publish new version of the nuget package #191

Closed manne closed 4 years ago

manne commented 4 years ago

The nuget packages of the current version (0.6.1) have Microsoft.CodeAnalysis.CSharp in version 3.1.0. https://github.com/AArnott/CodeGeneration.Roslyn/blob/2b937a442a1380eb4c65fa7da45077ba62a10b33/src/Directory.Build.props#L22 For my SemanticType generator I want to incorporate "nullability". Similar as I implemented in #190 . In version 3.1.0 of Microsoft.CodeAnalysis.CSharp the nullability feature is not available. In version 3.4.0 the nullability feature is available. The current master branch targets this version. https://github.com/AArnott/CodeGeneration.Roslyn/blob/4bd01ce004ebca13fb2da11fc38fcf99ab2271ae/src/Directory.Build.props#L23

Can a new version be published?

How can I help?

amis92 commented 4 years ago

Well, there is a prerelease available as a hotfix.

Other than that, I was waiting for some feedback on whether the big changes I did lately are breaking or not, but I don't think a lot of people tried it out, looking at the downloads.

manne commented 4 years ago

Well, there is a prerelease available as a hotfix.

Awesome. I missed checking this.

louthy commented 4 years ago

@amis92

but I don't think a lot of people tried it out, looking at the downloads.

Some release notes would have been helpful here. I accidentally ended up including it in a rollout of language-ext, but reverted it when it was raised as an issue (the issue was purely including an alpha in the release dependencies, not bug reports of any issues). So, probably most of the downloads came from that.

I'm desperate to get the .NET Core 3 and netstandard2.1 compatibility, it's unfortunately holding back my project now. Are there any pre-release notes or plans for deploying by a particular date? (deployment-wise an idea of whether we're looking at a few months, or by the end of the year would be useful. For language-ext I may just have to look into other code-gen solutions if the deployment is likely to be toward the end of the year).

Sorry if this sounds demanding, I definitely don't want to give that impression. Obviously, as a maintainer of a popular open-source project myself I realise we're all doing this in our spare time, and very much appreciate the efforts :)

amis92 commented 4 years ago

@louthy release notes should've been included, but it seems I've used wrong property:

https://github.com/AArnott/CodeGeneration.Roslyn/blob/4bd01ce004ebca13fb2da11fc38fcf99ab2271ae/src/Directory.Build.props#L11

Anyway, they're available in changelog.md in the root of the repo :) I've made #192 to fix it.


Are there any pre-release notes or plans for deploying by a particular date?

No such plans. I wanted to wait for some feedback. If you can confirm that 0.7.5 is good for you, and works correctly, I can just push it out. Also I wanted to write up a migration guide for generator authors, and never finished it. So if you have had any experience, please share.


get the .NET Core 3 and netstandard2.1 compatibility

Is the 0.7.5.-alpha ok for you, or do you need something more to be compatible?

louthy commented 4 years ago

@amis92 Thanks for the quick response, I thought I'd do some testing to help get it moving along. I have submitted an issue

amis92 commented 4 years ago

Note: A major step forward towards stabilizing 0.7 is a refactor PR #198.

amis92 commented 4 years ago

I've published v0.7.57-alpha to nuget.org.

This is a stabilization release, if you can migrate to it successfully, I'll release it as stable/public.

This includes new set of Templates, fixes in Sdks and other bugfixes.

If you have any problems, please raise them and I'll try to help ASAP.

@louthy @garyng

manne commented 4 years ago

@amis92

This is a stabilization release, if you can migrate to it successfully, I'll release it as stable/public.

with v0.7.57-alpha it is working

garyng commented 4 years ago

Is <NoBuild>true</NoBuild> required on the metapackage project file?

The example on the readme has, but the template didnt:

https://github.com/AArnott/CodeGeneration.Roslyn/blob/12884f751c3481b4f2d71efbdd7386e25cca0440/templates/content/SourceGenerator.MetapackageProjects/SourceGenerator/SourceGenerator.csproj#L8-L11

amis92 commented 4 years ago

Yeah so it's optional - it's a standard property which is the same as if you passed --no-build to dotnet pack.

Essentially, it prevents building this project, allowing only Restore/Pack.

I'll remove it from the readme, since it causes dotnet build on solution to fail. Good catch.

garyng commented 4 years ago

Uhmmm, I can't get the generator working... The sample project is here: https://github.com/garyng/cgr-test (which is created using the cgrplugin template).

The generator simply calls Debugger.Launch(): https://github.com/garyng/cgr-test/blob/b6b208ec76e002af196c1bc1f21a7b8d7936ffba/LanguageExt.CodeGen.Generators/Generator1.cs#L18-L22

The Consumer project uses the metapacakge: https://github.com/garyng/cgr-test/blob/b6b208ec76e002af196c1bc1f21a7b8d7936ffba/Consumer/Consumer.csproj#L8-L10, but it's not working...

The ConsumerWorking project references the Attributes, Generators and the codegen tool, which works: https://github.com/garyng/cgr-test/blob/b6b208ec76e002af196c1bc1f21a7b8d7936ffba/ConsumerWorking/ConsumerWorking.csproj#L8-L18

Am I doing it right?

amis92 commented 4 years ago

@garyng the metapackage is not suitable for P2P references - it only produces a NuGet that pulls in correct dependencies - but only as NuGet.

Do you think this should be documented somewhere? If so, can you point to a good spot for it?


So, for local/P2P scenarios, you need to do it the way ConsumerWorking is set up. That, or pack your generator projects, and in a separate build step, the Consumer should have local NuGet source pointing to the output folder with nupkg files you produced, and build it after these packages are created.

I strongly recommend the first approach (ConsumerWorking as it is now), except if you're testing whether metapackage is set up correctly. In that case, refer to how the MetapackageSample here is done.

garyng commented 4 years ago

@amis92 I think the difference between P2P reference and nuget reference should be documented, maybe in the metapackage section of readme?

amis92 commented 4 years ago

I've added a note with warning sign at the end of the section: https://github.com/AArnott/CodeGeneration.Roslyn#create-the-metapackage

garyng commented 4 years ago

I didn't realize that! Was going to make a PR just now.

amis92 commented 4 years ago

Aaand the stable release is out: https://github.com/AArnott/CodeGeneration.Roslyn/releases/tag/v0.7.63