dotnet / java-interop

Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#
Other
189 stars 48 forks source link

Add Ability to write out the list of files generated. #1191

Closed dellis1972 closed 5 months ago

dellis1972 commented 5 months ago

Currently if a user removes a file for a binding the generated C# code file is NOT removed until the end of the build. This is because the Incremental Clean does not happen until the end of the build process. So we end up with old unused code in the assembly.

That this PR does is to add the ability for the generator to write a list of the files it generated during this run. This can then be compared by the calling app with the list of current files and the deleted ones can then be removed.

This will be useful for supporting incremental build support for bindings.

This never was a problem, but now with binding happening inside the application project via AndroidLibrary or AndroidJavaSource it is important to make sure we do not include code that is no longer being generated. Especially for intellisense.

The simple text file format was chosen because all we need is a list of files. This can be loaded by MSBuild and compared directly against the results of

<ItemGroup>
    <Foo Include="obj\Debug\generated\src\*.cs" />
</ItemGroup>

If we used the existing .projitems file there would be some additional work as we would need to parse the xml data.

Additional Fixes

Fixed up some of the vscode tasks which no longer worked.

dellis1972 commented 5 months ago

Closing in favour of parsing the projitems file instead.