-
Notifications
You must be signed in to change notification settings - Fork 533
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
Conversation
ArtifactFilename
metadata for AndroidMavenLibrary
item.ArtifactFilename
metadata for @(AndroidMavenLibrary)
item.
dda9800
to
6481997
Compare
6481997
to
bbb48c5
Compare
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")); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of react-android, there appears to be a react-android-0.76.0.module
file, which is a JSON file which mentions the "real" filenames:
{
…
"component": {
"group": "com.facebook.react",
"module": "react-android",
"version": "0.76.0",
"attributes": {
"org.gradle.status": "release"
}
},
…
"variants": [
{
"name": "debugVariantDefaultApiPublication",
"attributes": {
"com.android.build.api.attributes.BuildTypeAttr": "debug",
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-api"
},
…
"files": [
{
"name": "react-android-0.76.0-debug.aar",
"url": "react-android-0.76.0-debug.aar",
"size": 204696650,
"sha512": "736141a49db0dbadf34379b832ea858642be172d0d302edca7edc76ae34c93846b98167989854cc3da954b4ac32946f0ca3fc55bd5f7b6b8df17483e04eb342e",
"sha256": "a131374a0e4aea0bf131746d615c8ba5fcafedf79e809d864d2b2a619714c205",
"sha1": "a78b8bb37b808263e6757f99ef82f3d75823af0f",
"md5": "70afd54443016d5b9c2c5d1c7ac9342b"
}
]
},
…
{
"name": "releaseVariantDefaultRuntimePublication",
"attributes": {
"com.android.build.api.attributes.BuildTypeAttr": "release",
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.libraryelements": "aar",
"org.gradle.usage": "java-runtime"
},
…
"files": [
{
"name": "react-android-0.76.0-release.aar",
"url": "react-android-0.76.0-release.aar",
"size": 128739900,
"sha512": "bbd62ba818768ab4ef05cdbb463a63cf208933c23419b44f692284f30dc5af5acfa4bb50eb48015b77132c7cb81c33793d3d706dafb30820d9b478ce1d0d18d4",
"sha256": "ce57d01ab360711f768a2aa46a86f153e3edaf8cf20da25237861bef21c41173",
"sha1": "f766f97dec77212133f8b3a1b4615d9b5d41ffe5",
"md5": "7cbeccd4a237fae95035f1bcc2f25f0f"
}
]
},
…
Which certainly looks interesting! The problems include:
- What is a
.module
file? Documentation? - How widespread is this construct used?
- What (and how) should this info be used or surfaced? A
%(BuildTypeAttr)
metadata which is used to key off ofcom.android.build.api.attributes.BuildTypeAttr
? - Is this something we want to support?
%(ArtifactFilename)
is a good workaround for now.
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:To support these cases, add a new optional metadata
ArtifactFilename
that can be specified to override the Maven filename of the artifact.This allows our tasks to properly download the artifact and avoid the error.