dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.89k stars 523 forks source link

Make sure `_GenerateJavaStubs` always generates native assembly files #9001

Open grendello opened 3 weeks ago

grendello commented 3 weeks ago

Fixes: https://github.com/xamarin/xamarin-android/issues/8967

For some reason, sometimes the typemap*.ll files are sometimes removed from the obj/ directory which leads to build errors similar to:

typemaps.x86_64.ll: error: Could not open input file: no such file or directory

Files are generated by the GenerateJavaStubs tasks, which is invoked by the _GenerateJavaStubs target. However, the target doesn't specify the *.ll files in its Outputs parameter and, therefore, whenever the files are removed but the _GenerateJavaStubs.stamp file is newer than the items/files specified in the target's Inputs parameter, the native assembly files aren't regenerated leading to the above error.

To fix this, we need to add the typemap*.ll files to the target's Outputs set, thus forcing their regeneration should they be no longer where they are expected to be.

grendello commented 3 weeks ago

@jonathanpeppers yep, it uses Files.CopyIfStreamChanged