Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Oct 31, 2024

Fixes: #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.

@jpobst jpobst changed the title [XABT] Add ArtifactFilename metadata for AndroidMavenLibrary item. [XABT] Add ArtifactFilename metadata for @(AndroidMavenLibrary) item. Oct 31, 2024
Comment on lines +145 to +146
files_to_check.Add (Path.Combine (output_directory, $"{artifact.Id}-{artifact.Version}.jar"));
files_to_check.Add (Path.Combine (output_directory, $"{artifact.Id}-{artifact.Version}.aar"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to do this here, but is there some manifest file that we can download to know the exact file name? It seems odd they can choose random names. How does Java tooling know which file to download?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good question. There doesn't appear to be anything in the .pom that gives the file name: https://repo1.maven.org/maven2/com/facebook/react/react-android/0.76.0/react-android-0.76.0.pom

It looks like React has its own Gradle plugin you need to use, perhaps it knows how to resolve their files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<AndroidMavenLibrary> support for nonstandard artifact filenames
2 participants