Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics#1438
Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics#1438Copilot wants to merge 4 commits into
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
|
@copilot do you need to update the namespaces file with cake target? Also increment version of relevant packages by 0.0.0.1 |
There was a problem hiding this comment.
Pull request overview
This pull request changes the androidx.compose.ui:ui-graphics-android binding from “Java-library-only” to shipping real C# bindings, so Compose consumers can use the graphics API surface (e.g., Brush, Path, ImageBitmap, Outline, Matrix, BlendMode, etc.) via the Xamarin.AndroidX.Compose.UI.Graphics(.Android) NuGets rather than relying on hand-rolled equivalents.
Changes:
- Enabled binding generation for
ui-graphics-androidby removing the blanket package strip and adding explicit namespace (managedName) mappings to preserveUIcasing. - Removed two known generator blockers by stripping the
androidx.compose.ui.graphics.shadowpackage and thePathIteratorinterface. - Updated packaging/template behavior and regenerated
PublicAPI.Unshipped.txtto reflect the newly surfaced API.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| source/AndroidXProject.cshtml | Marks the two UI Graphics NuGets as “real bindings” packages so the “C# bindings are not provided” note is not appended. |
| source/androidx.compose.ui/ui-graphics-android/Transforms/Metadata.xml | Stops stripping the entire API surface; enforces AndroidX.Compose.UI.Graphics* namespaces and removes specific generation blockers. |
| source/androidx.compose.ui/ui-graphics-android/PublicAPI/PublicAPI.Unshipped.txt | Regenerated unshipped public API to include the newly exposed binding surface. |
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Done in commit
|
|
@copilot list of errors: |
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Fixed in 3c3aadb. The 24 errors were all in
Verified |
Xamarin.AndroidX.Compose.UI.Graphics/.Androidshipped Java-library-only, forcing every Compose consumer to type colors as raw packedlongand re-implement Kotlin'sColorpacking by hand. This un-strips the-androidrecipe soColor,Brush,Shape,Path,ImageBitmap,Outline,Matrix,BlendMode, etc. are bindable.Changes
ui-graphics-android/Transforms/Metadata.xml<remove-node path="/api/package" />.managedNameattrs across all 9 graphics packages to forceUIcasing (androidx.compose.ui.graphics→AndroidX.Compose.UI.Graphics).<remove-node>for two generation blockers:…graphics.shadowpackage — its title-cased namespace collides with the existingShadowspec class (CS0101); kept the class.PathIteratorinterface — auto-generated Invoker can't satisfyIterator.next()'sObjectreturn (CS0738).ui-graphics-android/PublicAPI/PublicAPI.Unshipped.txt— regenerated (~1298 lines).AndroidXProject.cshtml— added both Graphics packages toComposePackagesWithBindings, removing the "C# bindings are not provided" note.published-namespaces.txt— added the 6 new namespaces exposed by the un-stripped binding:AndroidX.Compose.UI.Graphics.Colorspace,.Drawscope,.Internal,.Layer,.Layer.View, and.Painter.config.json— bumpednugetVersionfor bothXamarin.AndroidX.Compose.UI.GraphicsandXamarin.AndroidX.Compose.UI.Graphics.Androidfrom1.11.2→1.11.2.1.foundation-android/Transforms/Metadata.xml— fixed 24 build errors infoundation-androidthat only surfaced once UI.Graphics became bindable (theandroidx.compose.foundation.shapehierarchy could finally be emitted becauseIShape/CornerBasedShapeare now resolvable). This is purely additive — it surfaces the realRoundedCornerShape,CutCornerShape,AbsoluteRoundedCornerShape,AbsoluteCutCornerShape, andCornerBasedShapebindings (plus factories) that previously couldn't bind at all:Dp) factory overloads are JVM name-mangled (RoundedCornerShape-0680j_4(F)) and collapse onto the plainRoundedCornerShape(F)overload. Removed the mangled overloads inRoundedCornerShapeKt/CutCornerShapeKt/AbsoluteRoundedCornerShapeKt/AbsoluteCutCornerShapeKt, mirroring the existingCornerSizeKtrule.CornerBasedShape.copy(…)is abstract returningCornerBasedShape, but each subclass overrides it with a covariant (subclass-typed) return that the generator emits withoutoverride. PinnedmanagedReturntoAndroidX.Compose.Foundation.Shape.CornerBasedShapeon each subclass'scopy(CornerSize ×4)so the override is recognized.Notes
Inline
@JvmInline value classtypes (Color,Offset,Size,TileMode) surface as rawlong/float(issue option 3b), consistent with the existing Compose bindings; no inline-class support assumed. Example shape:No
-jvm/-androidKMP duplicate clashes surfaced, so no<AndroidIgnoredJavaDependency>entries were required.The common
ui-graphicsrecipe stays stripped — its KMP AAR has noclasses.jar— matching theui/foundationpeer precedent.foundation-android'sPublicAPI.Unshipped.txtwill gain the new shape-class entries on the next full build; it is a build-generated, non-analyzer-gated file, so CI regenerates it cleanly.