Prevent duplicate ML Kit barcode-scanning AAR packaging - #1520
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates the Xamarin Build Download (XBD) packaging flow for Xamarin.Google.MLKit.BarcodeScanning to avoid embedding the same ML Kit barcode-scanning AAR that is also restored via build-transitive download targets, eliminating duplicated-native-library (XA4301) warnings for consumers.
Changes:
- Prevent packing of local XBD AAR inputs by marking the
AndroidLibraryitem asPack="false"in the XBD project template. - Remove a duplicate
XamarinBuildDownloadAndroidAarLibraryitem emission in the XBD targets template so the downloaded AAR is only included once. - Bump
Xamarin.Google.MLKit.BarcodeScanningNuGet version from117.3.0.8to117.3.0.9.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| source/XamarinBuildDownloadTargets.cshtml | Adjusts generated build-transitive targets to avoid duplicating the downloaded AAR library item. |
| source/_XBDProjectType.cshtml | Ensures local AAR inputs don’t get packed into the NuGet, avoiding embedding + download duplication. |
| config.json | Version bump for Xamarin.Google.MLKit.BarcodeScanning to ship the packaging fix. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
The local licensed AAR remains available for binding but is excluded from the package, the XBD-downloaded AAR is registered exactly once, and package 117.3.0.9 builds and validates without duplicate XA4301 warnings.
Fixes #1519.
Xamarin.Google.MLKit.BarcodeScanningmust continue usingXamarin.Build.Downloadbecause the ML Kit AAR is distributed under license terms that prevent embedding it directly in the NuGet package.The generated package currently exposes the same
barcode-scanningAAR through three registrations:lib/by the binding project.Xamarin.Build.Downloaddownloads the licensed AAR once at build time.XamarinBuildDownloadAndroidAarLibraryby the targets template.The duplicate XBD items do not download the AAR twice; they add the same downloaded file to
AndroidAarLibrarytwice. Together with the embedded copy, this produces duplicateXA4301native-library warnings for consumers.This change:
Pack="false"on the local XBDAndroidLibrary, keeping it available for binding generation without embedding it in the NuGet package.XamarinBuildDownloadAndroidAarLibrarydeclaration while retaining one required declaration, so the licensed AAR is still downloaded and included exactly once for consumers.Xamarin.Google.MLKit.BarcodeScanningfrom117.3.0.8to117.3.0.9.The resulting package preserves the license-driven XBD flow and eliminates both sources of duplicate AAR inclusion.