Un-strip Compose Animation bindings (animation-android, animation-core-android)#1448
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
|
@copilot should we remove the *.Internal package/namespace? If so make sure to update namespaces file |
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Yes — those packages ( |
There was a problem hiding this comment.
Pull request overview
This PR restores usable .NET bindings for Jetpack Compose Animation by removing the prior blanket stripping of androidx.compose.animation.* and androidx.compose.animation.core.*, replacing it with targeted Metadata.xml removals for specific binder-incompatible members, and adding the missing compile-time dependencies required for referenced types to bind.
Changes:
- Replaced the blanket
<remove-node path="/api/package" />stripping foranimation-androidandanimation-core-androidwith surgicalremove-nodetransforms (including removal of internal Kotlin implementation packages). - Added
extraDependenciesto ensure second-level transitive types resolve at compile time (ui-unit-androidforanimation-android,kotlinx-coroutines-core-jvmforanimation-core-android). - Bumped NuGet versions for the two Android artifacts to
1.11.2.1and updated published namespace/version documentation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source/androidx.compose.animation/animation-core-android/Transforms/Metadata.xml | Replaces blanket stripping with targeted removals for known binding breakages and removes androidx.compose.animation.core.internal. |
| source/androidx.compose.animation/animation-core-android/PublicAPI/PublicAPI.Unshipped.txt | Reflects the newly un-stripped public API surface for Animation.Core.Android. |
| source/androidx.compose.animation/animation-android/Transforms/Metadata.xml | Stops stripping everything; removes only androidx.compose.animation.internal. |
| source/androidx.compose.animation/animation-android/PublicAPI/PublicAPI.Unshipped.txt | Reflects the newly un-stripped public API surface for Animation.Android. |
| published-namespaces.txt | Publishes the restored namespaces AndroidX.Compose.Animation and AndroidX.Compose.Animation.Core. |
| docs/artifact-list-with-versions.md | Updates the displayed NuGet versions for the two Android artifacts to 1.11.2.1. |
| config.json | Bumps nugetVersion to 1.11.2.1 and adds the required extraDependencies for both Android artifacts. |
Xamarin.AndroidX.Compose.Animation.AndroidandXamarin.AndroidX.Compose.Animation.Core.Androidshipped empty — a blanket<remove-node path="/api/package" />stripped every type inandroidx.compose.animation.*andandroidx.compose.animation.core.*, so nothing (Animatable,Transition,EnterTransition, animation specs, easing curves, …) was reachable from C#.This replaces the blanket strip with surgical transforms plus the two compile dependencies that were actually missing, so the supporting type system binds.
animation-core-android— targetedremove-nodetransformsRemoves only nodes that genuinely can't bind due to binder limitations:
vectorizemethods — Kotlin'sAnimationSpechierarchy uses covariant generic return types (AnimationSpec→VectorizedAnimationSpec,FiniteAnimationSpec→VectorizedFiniteAnimationSpec, …), inexpressible in C# (CS0738/CS0535/CS9334).VectorizedAnimationSpec.isInfinite— a Kotlin default interface property mis-marked abstract by class-parse, so concreteVectorized*classes failed to implement it.TransitionState.getCurrentState/getTargetState— generic erasure yields un-overridable abstractRaw*Statemembers on the base (CS0534).DecayAnimationctor — two constructors whose generic params (T/AnimationVector) both erase toObject(CS0111).Internal packages removed
The internal Kotlin packages
androidx.compose.animation.core.internalandandroidx.compose.animation.internalonly exposed implementation-detail facade helpers (JvmDefaultWithCompatibility_jvmAndAndroidKt,PlatformOptimizedCancellationException*), which are not useful public API. Both packages are now removed viaremove-nodetransforms, and the correspondingAndroidX.Compose.Animation.Core.Internal/AndroidX.Compose.Animation.Internalnamespaces were dropped frompublished-namespaces.txtandPublicAPI.Unshipped.txt. The public@InternalAnimationApiopt-in annotation lives in thecorepackage (notcore.internal) and is preserved.Dependency additions (preserve API instead of stripping it)
Two members referenced types only reachable as second-level transitive deps, unavailable at compile time. Added via
extraDependenciesrather than deleting the members:animation-core-android→kotlinx-coroutines-core-jvm(soDeferredTargetAnimation.updateTarget(CoroutineScope)binds).animation-android→ui-unit-android(soSharedTransitionScope : DensityandSplineBased*bind).Packaging / metadata
nugetVersionbumped1.11.2→1.11.2.1for both packages.published-namespaces.txt;docs/artifact-list-with-versions.mdupdated.PublicAPI.Unshipped.txt(core: 614 entries, animation: 227).Known limitation
Most user-facing
@Composables (AnimatedVisibility,Crossfade, …) remain stripped because their@JvmInline value classparameters block binding pending dotnet/java-interop#1440; they should reappear once it lands. The supporting types (Transition,Animatable,EnterTransition/ExitTransition, spec/easing types) and the*Ktcontainer classes now bind regardless.