Skip to content

Instantly share code, notes, and snippets.

@efemoney
Created June 5, 2025 13:03
Show Gist options
  • Select an option

  • Save efemoney/0007b9052b54ff372b0193ade3927bc2 to your computer and use it in GitHub Desktop.

Select an option

Save efemoney/0007b9052b54ff372b0193ade3927bc2 to your computer and use it in GitHub Desktop.
/**
* Original parcelize plugin only applies to KotlinJvmAndroidCompilation,
* this copy extends support to the KotlinMultiplatformAndroidCompilation.
*/
class NotParcelizeSubplugin : KotlinCompilerPluginSupportPlugin {
override fun apply(target: Project) = Unit
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>) =
kotlinCompilation is KotlinJvmAndroidCompilation || kotlinCompilation is KotlinMultiplatformAndroidCompilation
override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {
return kotlinCompilation.target.project.run {
kotlinCompilation.defaultSourceSet.dependencies {
implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:${getKotlinPluginVersion()}")
}
provider(::emptyList)
}
}
override fun getCompilerPluginId() = "org.jetbrains.kotlin.parcelize"
override fun getPluginArtifact() = JetBrainsSubpluginArtifact("kotlin-parcelize-compiler")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment