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.93k stars 532 forks source link

[XABT] Add `ArtifactFilename` metadata for `@(AndroidMavenLibrary)` item. #9479

Open jpobst opened 3 weeks ago

jpobst commented 3 weeks ago

Fixes: https://github.com/dotnet/android/issues/9465

In all of the examples we used when developing and testing @(AndroidMavenLibrary) the Maven artifact filename followed the pattern {artifact.Id}-{artifact.Version}.[jar|aar], so this is the default filename we construct for the user.

However, there exists some packages like React that do not follow this pattern and instead do eg: react-android-0.76.0-release.aar. Attempting to use @(AndroidMavenLibrary) for React produces the following error:

error XA4236: Cannot download Maven artifact 'com.facebook.react:react-android'.
error XA4236: - react-android-0.76.0.jar: Response status code does not indicate success: 404 (Not Found).
error XA4236: - react-android-0.76.0.aar: Response status code does not indicate success: 404 (Not Found).

To support these cases, add a new optional metadata ArtifactFilename that can be specified to override the Maven filename of the artifact.

<AndroidMavenLibrary Include="com.facebook.react:react-android" Version="0.76.0" ArtifactFilename="react-android-0.76.0-release.aar" />

This allows our tasks to properly download the artifact and avoid the error.