Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

CodeGeneration.Roslyn doesn't respect CustomAdditionalCompileInputs #127

Open
Pzixel opened this issue Apr 16, 2019 · 4 comments
Open

CodeGeneration.Roslyn doesn't respect CustomAdditionalCompileInputs #127

Pzixel opened this issue Apr 16, 2019 · 4 comments
Milestone

Comments

@Pzixel
Copy link
Contributor

Pzixel commented Apr 16, 2019

My code generator has addiitonal inputs beside C# files. So I add

<ItemGroup>
    <CustomAdditionalCompileInputs Include="**\*.sol" />
</ItemGroup>

to the project. VS correctly starts build when file gets edited, but CodeGenerator.Roslyn doesn't regenerate files. I only see

1>------ Build started: Project: Solidity.Roslyn.Example, Configuration: Debug Any CPU ------
1>Build started 16.04.2019 14:58:55.
1>Target _GetProjectReferenceTargetFrameworkProperties:
1>Target ResolveProjectReferences:
1>  Target GetNativeManifest:
1>Target PrepareGenerateCodeFromAttributes:
1>  Deleting file "obj\Debug\netstandard2.0\Solidity.Roslyn.Example.csproj.dotnet-codegen.GeneratedFileList.txt".
1>  0.4.88+g3109bcd51d
1>  Running CodeGeneration.Roslyn.Tool v0.4.88+g3109bcd51d
1>Target GenerateCodeFromAttributesCore:
1>  File "Solidity.cs" hashed to L4PwaM+L
1>  obj\Debug\netstandard2.0\Solidity.L4PwaM+L.generated.cs

But resulting C# code doesn't reflect actual changes. Only when I rebuild the whole project I get correct results.

@AArnott
Copy link
Owner

AArnott commented Apr 18, 2019

Do the CustomAdditionalCompileInputs items get fed into the compiler, or simply trigger msbuild's incremental build to run the CoreCompile target? I'm trying to understand why changing the .sol file would lead to a different result in the code generation result.

@Pzixel
Copy link
Contributor Author

Pzixel commented Apr 18, 2019

@AArnott no, they aren't fed to the compiler directly, I rather use them in my generator. I was author of the assembly-level generators if you recall. Here is an example https://github.com/Pzixel/Solidity.Roslyn

This one generates C# classes from sol file. Thus when you change sol you indeed change generator input and it has to regenerate stuff.

@AArnott
Copy link
Owner

AArnott commented Apr 19, 2019

OK, that makes sense. I won't get time for much or any OSS work over the next couple weeks, so if this is urgent, or if you just feel like contributing, I'd welcome a PR.

@Pzixel
Copy link
Contributor Author

Pzixel commented Nov 21, 2019

I tried to fix this with VS guys but it seems that it's only related to the CodeGeneration.Roslyn. See dotnet/project-system#5621 (comment) for details.

I think I'l try to manage to get some time in near future but I wonder what changes could be done without being rejected (e.g. because I invalidate caches too much).

@amis92 amis92 modified the milestones: 0.7, Backlog Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants