Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow all packages of "org.jetbrains" and "org.intellij" #621

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions ktlint-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,13 @@ tasks {
// Expose all ruleset implementations:
mergeServiceFiles()

// Relocate to prevent conflicts with same packages provided by Intellij IDEA as well. The embeddable Kotlin compiler in the Ktlint
// jar differs from the compiler provided in the IDEA.
// Ktlint contains the embeddable Kotlin compiler. The Kotlin compiler brings in some packages from "org.jetbrains" and
// "org.intellij" which might conflict with the same packages provided by the Intellij IDEA Runtime environment. To avoid possible
// conflicts, the packages are shadowed so that ktlint can still use the embedded compiler, independently of the compiler which is
// provided in the Intellij IDEA runtime.
// IMPORTANT: Third party suppliers of rule set need to add those relocations as well!
relocate("org.jetbrains.kotlin.psi.KtPsiFactory", "shadow.org.jetbrains.kotlin.psi.KtPsiFactory")
relocate("org.jetbrains.kotlin.psi.psiUtil", "shadow.org.jetbrains.kotlin.psi.psiUtil")

// From "compatability verification" (plugin verifier) results:
// The plugin distribution bundles IDE packages
// 'org.jetbrains.org.objectweb.asm.signature',
// 'org.jetbrains.org.objectweb.asm.commons',
// 'org.jetbrains.org.objectweb.asm',
// 'org.jetbrains.org.objectweb.asm.util',
// 'org.jetbrains.org.objectweb',
// 'org.jetbrains.org.objectweb.asm.tree.analysis',
// 'org.jetbrains.concurrency',
// 'org.jetbrains.org.objectweb.asm.tree',
// 'org.jetbrains.org'.
// Bundling IDE packages is considered bad practice and may lead to sophisticated compatibility problems. Consider excluding
// these IDE packages from the plugin distribution. If your plugin depends on classes of an IDE bundled plugin, explicitly
// specify dependency on that plugin instead of bundling it.
// IMPORTANT: Third party suppliers of rule set need to add those relocations as well!
relocate("org.jetbrains.org", "shadow.org.jetbrains.org")
relocate("org.jetbrains.concurrency", "shadow.org.jetbrains.concurrency")
relocate("org.jetbrains", "shadow.org.jetbrains")
relocate("org.intellij", "shadow.org.intellij")

// Ktlint-lib itself may not be minimized as this would result in exceptions when loading custom rulesets as the RulesetProviderV3
// can not be found
Expand Down
Loading