Skip to content

Un-strip Compose Animation bindings (animation-android, animation-core-android)#1448

Merged
jonathanpeppers merged 3 commits into
mainfrom
copilot/compose-animation-fix
Jun 6, 2026
Merged

Un-strip Compose Animation bindings (animation-android, animation-core-android)#1448
jonathanpeppers merged 3 commits into
mainfrom
copilot/compose-animation-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

Xamarin.AndroidX.Compose.Animation.Android and Xamarin.AndroidX.Compose.Animation.Core.Android shipped empty — a blanket <remove-node path="/api/package" /> stripped every type in androidx.compose.animation.* and androidx.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 — targeted remove-node transforms

Removes only nodes that genuinely can't bind due to binder limitations:

  • vectorize methods — Kotlin's AnimationSpec hierarchy uses covariant generic return types (AnimationSpecVectorizedAnimationSpec, FiniteAnimationSpecVectorizedFiniteAnimationSpec, …), inexpressible in C# (CS0738/CS0535/CS9334).
  • VectorizedAnimationSpec.isInfinite — a Kotlin default interface property mis-marked abstract by class-parse, so concrete Vectorized* classes failed to implement it.
  • TransitionState.getCurrentState/getTargetState — generic erasure yields un-overridable abstract Raw*State members on the base (CS0534).
  • Colliding DecayAnimation ctor — two constructors whose generic params (T / AnimationVector) both erase to Object (CS0111).

Internal packages removed

The internal Kotlin packages androidx.compose.animation.core.internal and androidx.compose.animation.internal only exposed implementation-detail facade helpers (JvmDefaultWithCompatibility_jvmAndAndroidKt, PlatformOptimizedCancellationException*), which are not useful public API. Both packages are now removed via remove-node transforms, and the corresponding AndroidX.Compose.Animation.Core.Internal / AndroidX.Compose.Animation.Internal namespaces were dropped from published-namespaces.txt and PublicAPI.Unshipped.txt. The public @InternalAnimationApi opt-in annotation lives in the core package (not core.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 extraDependencies rather than deleting the members:

  • animation-core-androidkotlinx-coroutines-core-jvm (so DeferredTargetAnimation.updateTarget(CoroutineScope) binds).
  • animation-androidui-unit-android (so SharedTransitionScope : Density and SplineBased* bind).

Packaging / metadata

  • nugetVersion bumped 1.11.21.11.2.1 for both packages.
  • New namespaces added to published-namespaces.txt; docs/artifact-list-with-versions.md updated.
  • Regenerated PublicAPI.Unshipped.txt (core: 614 entries, animation: 227).

Known limitation

Most user-facing @Composables (AnimatedVisibility, Crossfade, …) remain stripped because their @JvmInline value class parameters 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 *Kt container classes now bind regardless.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix blank removal of Compose Animation bindings for Android Un-strip Compose Animation bindings (animation-android, animation-core-android) Jun 5, 2026
Copilot AI requested a review from jonathanpeppers June 5, 2026 23:24
@jonathanpeppers
Copy link
Copy Markdown
Member

@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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 6, 2026

@copilot should we remove the *.Internal package/namespace? If so make sure to update namespaces file

Yes — those packages (androidx.compose.animation.internal, androidx.compose.animation.core.internal) only contain internal Kotlin facade helpers (JvmDefaultWithCompatibility_jvmAndAndroidKt, PlatformOptimizedCancellationException*), so they're not useful public API. In e1c4717 I added remove-node transforms for both packages and dropped AndroidX.Compose.Animation.Internal / AndroidX.Compose.Animation.Core.Internal from published-namespaces.txt (and the matching PublicAPI.Unshipped.txt entries). The public @InternalAnimationApi opt-in annotation lives in the core package, not the core.internal package, so it's kept.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 6, 2026 18:33
Copilot AI review requested due to automatic review settings June 6, 2026 18:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 for animation-android and animation-core-android with surgical remove-node transforms (including removal of internal Kotlin implementation packages).
  • Added extraDependencies to ensure second-level transitive types resolve at compile time (ui-unit-android for animation-android, kotlinx-coroutines-core-jvm for animation-core-android).
  • Bumped NuGet versions for the two Android artifacts to 1.11.2.1 and 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.

@jonathanpeppers jonathanpeppers disabled auto-merge June 6, 2026 20:24
@jonathanpeppers jonathanpeppers merged commit f0ae2b1 into main Jun 6, 2026
3 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/compose-animation-fix branch June 6, 2026 20:25
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.

Compose Animation: animation-android and animation-core-android are fully blanket-stripped (<remove-node path="/api/package"/>)

3 participants