fix(plugin): allow applying org.jetbrains.compose alongside Nucleus#331
Merged
Conversation
Nucleus forks the Compose Desktop packaging and duplicated two of the Compose plugin's registrations, causing order-dependent conflicts when both plugins are applied to the same module: - The Groovy-DSL setup guard used File.endsWith(String), which matches by path components (never a suffix), so it ran for Kotlin DSL projects too and registered a 'jetbrainsCompose' repositories extension that clashes with the Compose plugin. - propagateMainClassToComposeApplication called the lazy getApplication getter, initializing compose.desktop.application and making the Compose plugin register its own packaging tasks, which collide with Nucleus's identically-named ones (unpackDefaultComposeDesktopJvmApplicationResources, createDistributable, packageDmg, ...). Fixes: - Detect Kotlin DSL via buildFile.name so the Groovy setup only runs for Groovy build files. - Only forward mainClass when Compose's application is already initialized, read via the internal _isJvmApplicationInitialized flag without triggering initialization. Nucleus therefore never causes Compose to register its packaging tasks; only Nucleus's forked tasks exist. - Fail fast with an actionable message when both nucleus.application and compose.desktop.application are configured.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #284.
Summary
Nucleus forks the Compose Desktop packaging and duplicated two of the Compose plugin's registrations, causing order-dependent conflicts when both
org.jetbrains.composeand the Nucleus plugin are applied to the same module (commonly surfaced during IntelliJ Gradle sync).Two distinct bugs, both fixed:
Duplicate
jetbrainsComposeextension (nucleus-before-compose order) — the Groovy-DSL setup was gated behind!project.buildFile.endsWith(".gradle.kts").File.endsWith(String)matches by path components, not by string suffix, soFile("build.gradle.kts").endsWith(".gradle.kts")is alwaysfalse→ the Groovy setup ran for Kotlin DSL projects too and registered ajetbrainsComposerepositories extension, which the Compose plugin then fails to add.Task-name collision (compose-before-nucleus order +
mainClassset) —propagateMainClassToComposeApplicationcalled the lazygetApplicationgetter, which initializescompose.desktop.applicationas a side effect, making the Compose plugin register its own packaging tasks that collide with Nucleus's identically-named ones (unpackDefaultComposeDesktopJvmApplicationResources,createDistributable,packageDmg, …).Changes
buildFile.name.endsWith(".gradle.kts")so the Groovy setup only runs for Groovy build files.mainClassonly when Compose's application is already initialized (explicit block or Hot Reload plugin), read via the internal_isJvmApplicationInitializedflag without triggering initialization. Nucleus therefore never causes Compose to register packaging tasks — only Nucleus's forked, modified tasks exist.nucleus.application { }andcompose.desktop.application { }are configured (the Compose plugin can stay applied for Hot Reload / IDE integration).Test plan
2.0.1)nucleus-before-composeorder: no longer crashes onjetbrainsComposecompose-before-nucleusorder (no compose block)::desktopApp:runsucceedsdev.nucleusframework.*even withorg.jetbrains.composeapplied (no Compose Desktop tasks used)runHot) still starts:plugin:test, ktlint and detekt pass