Skip to content

fix(plugin): stop creating every task to find buildNative tasks - #904

Open
sproctor wants to merge 1 commit into
NucleusFramework:nucleus-3.0from
sproctor:fix/graalvm-lazy-native-tasks
Open

sproctor wants to merge 1 commit into
NucleusFramework:nucleus-3.0from
sproctor:fix/graalvm-lazy-native-tasks

Conversation

@sproctor

@sproctor sproctor commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Description

Native-image packaging fails on Linux arm64 for a Kotlin Multiplatform app whose modules also have iOS targets. generateGraalvmProjectResourceMetadata creates every task in those modules, and the Kotlin plugin refuses to create iOS tasks on that host. This change selects the buildNative tasks by name, so unrelated tasks stay uncreated. JVM packaging of the same app doesn't hit this.

Minimal reproduction

A Linux arm64 host and a GraalVM app that depends on a KMP module with an iOS target:

./gradlew :desktopApp:packageGraalvmDeb

Setup: ubuntu-22.04-arm, Nucleus 3.0.0-dev-202611011507, Warlock's release run.

Actual result:

Could not determine the dependencies of task ':desktopApp:generateGraalvmProjectResourceMetadata'.
> Could not create task ':core:kspKotlinIosArm64'.
   > Unknown host target: linux aarch64

Root cause and fix

collectNativeBuildTasks used p.tasks.matching { it.name.startsWith("buildNative") } in a dependsOn. Resolving that collection creates every registered task so the predicate can read its name.

buildNativeTasksOf now filters p.tasks.names and returns providers from named, which creates nothing that doesn't match. It still runs inside the existing Callable, so modules configured after the app are covered as before.

Testing

  • New BuildNativeTasksOfTest: registers a buildNative task plus a task whose configuration throws, and asserts that only the first is selected.
  • Warlock on Linux x64, using this branch as an included build with an init script counting realized iOS tasks in a dry run of generateGraalvmProjectResourceMetadata: 262 before, 0 after.
  • ./gradlew preMerge --continue passes on Ubuntu Linux.

Not tested: a real Linux arm64 build with this change. I can't run one locally, and the x64 count stands in for it. I also didn't run the included build through a full native image.

Checklist

  • Targets nucleus-3.0
  • Feature: discussed first in a GitHub discussion (linked above)
  • One change, no unrelated reformatting
  • ./gradlew preMerge passes
  • Public API has KDoc, apiDump committed if the API changed
  • I understand every line of this change and can answer review questions about it, whether or not AI tools were used
  • Breaking change (explain above)

🤖 Generated with Claude Code

The GraalVM resource metadata task found the buildNative tasks with tasks.matching,
which creates every task registered in each module to test its name. A KMP app module
with iOS targets then fails on a Linux arm64 host, where the Kotlin plugin refuses to
create them. Select the tasks by name instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sproctor added a commit to sproctor/warlock3 that referenced this pull request Nov 3, 2026
* Fix the arm64 release build and a racy routing test

v3.2.0-beta.2 failed on Linux arm64: Nucleus's native-image resource task creates the
iOS tasks of the app's modules, and the Kotlin plugin refuses to create those there.
Pass iosSkip, as CI and the Android job already do. NucleusFramework/Nucleus#904 fixes
the cause.

WraythStreamRoutingTests cancelled its collectors as soon as the client disconnected,
which could drop lines they hadn't reached yet and failed CI on main. Wait for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Collect routing test events on the client's own thread

Waiting for main to go quiet for 50 ms still loses events if the collector stalls for
longer. Unconfined collectors take each line inside the client's send, so nothing is
buffered at disconnect and the test needs no wait at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant