From c1626953459d4057cca57b2aff1a35fce311c69a Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov <654232+AlexeyTsvetkov@users.noreply.github.com> Date: Tue, 16 May 2023 01:08:09 +0300 Subject: [PATCH] Remove variant redirection from Gradle plugin (#3168) It was experimental and it is not needed since our published Gradle Metadata already has references for Android artifacts for Android variants --- .../org/jetbrains/compose/ComposePlugin.kt | 40 ------------------- .../compose/android/AndroidExtension.kt | 6 --- 2 files changed, 46 deletions(-) diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt index 7da98f98d0..3819896ab0 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt @@ -55,20 +55,6 @@ class ComposePlugin : Plugin { project.configureExperimental(composeExtension, experimentalExtension) project.checkExperimentalTargetsWithSkikoIsEnabled() - if (androidExtension.useAndroidX) { - project.logger.warn("useAndroidX is an experimental feature at the moment!") - RedirectAndroidVariants.androidxVersion = androidExtension.androidxVersion - listOf( - RedirectAndroidVariants::class.java, - ).forEach(project.dependencies.components::all) - } - - fun ComponentModuleMetadataHandler.replaceAndroidx(original: String, replacement: String) { - module(original) { - it.replacedBy(replacement, "org.jetbrains.compose isn't compatible with androidx.compose, because it is the same library published with different maven coordinates") - } - } - project.tasks.withType(KotlinCompile::class.java).configureEach { it.kotlinOptions.apply { freeCompilerArgs = freeCompilerArgs + @@ -80,32 +66,6 @@ class ComposePlugin : Plugin { } } - class RedirectAndroidVariants : ComponentMetadataRule { - override fun execute(context: ComponentMetadataContext) = with(context.details) { - if (id.group.startsWith("org.jetbrains.compose")) { - val group = id.group.replaceFirst("org.jetbrains.compose", "androidx.compose") - val newReference = "$group:${id.module.name}:$androidxVersion" - listOf( - "debugApiElements-published", - "debugRuntimeElements-published", - "releaseApiElements-published", - "releaseRuntimeElements-published" - ).forEach { variantNameToAlter -> - withVariant(variantNameToAlter) { variantMetadata -> - variantMetadata.withDependencies { dependencies -> - dependencies.removeAll { true } //there are references to org.jetbrains artifacts now - dependencies.add(newReference) - } - } - } - } - } - - companion object { - var androidxVersion: String? = null - } - } - @Suppress("DEPRECATION") class Dependencies(project: Project) { val desktop = DesktopDependencies diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/android/AndroidExtension.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/android/AndroidExtension.kt index 7b115163ce..25dfa140d8 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/android/AndroidExtension.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/android/AndroidExtension.kt @@ -7,10 +7,4 @@ import org.gradle.api.tasks.Input import javax.inject.Inject abstract class AndroidExtension @Inject constructor(private val objectFactory: ObjectFactory) : ExtensionAware { - @Input - var useAndroidX : Boolean = false - @Input - var androidxVersion: String = "1.0.1" //should be set by CI, but could be overridden in build script - @Input - var mppSolutionGroup: String = "org.jetbrains.compose" //it is added for future use by Google } \ No newline at end of file