From 05d218b7181de2f7d9d2e2b84eb7a8fb7592b84e Mon Sep 17 00:00:00 2001 From: akurasov <86794754+akurasov@users.noreply.github.com> Date: Thu, 21 Oct 2021 12:31:39 +0300 Subject: [PATCH] Support OEL publication in gradle plugin (#1285) * switching to oel compose branch * Implementation of OEL publishing * Changed based on Code Review * Revert `support` folder Co-authored-by: Igor Demin --- gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt | 4 ++++ gradle-plugins/compose/build.gradle.kts | 2 ++ .../src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt b/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt index b9bdc8fee7..6138aad246 100644 --- a/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt +++ b/gradle-plugins/buildSrc/src/main/kotlin/BuildProperties.kt @@ -19,4 +19,8 @@ object BuildProperties { ?: project.findProperty("deploy.version") as String fun isComposeWithWeb(project: Project): Boolean = project.findProperty("compose.with.web") == "true" + fun experimentalOELPublication(project: Project): Boolean = + project.findProperty("oel.publication") == "true" + fun oelAndroidXVersion(project: Project): String? = + project.findProperty("oel.androidx.version") as String? } diff --git a/gradle-plugins/compose/build.gradle.kts b/gradle-plugins/compose/build.gradle.kts index c413c9a685..6754ffdab1 100644 --- a/gradle-plugins/compose/build.gradle.kts +++ b/gradle-plugins/compose/build.gradle.kts @@ -28,6 +28,8 @@ val buildConfig = tasks.register("buildConfig", GenerateBuildConfig::class.java) generatedOutputDir.set(buildConfigDir) fieldsToGenerate.put("composeVersion", BuildProperties.composeVersion(project)) fieldsToGenerate.put("isComposeWithWeb", BuildProperties.isComposeWithWeb(project)) + fieldsToGenerate.put("experimentalOELPublication", BuildProperties.experimentalOELPublication(project)) + fieldsToGenerate.put("oelAndroidXVersion", BuildProperties.oelAndroidXVersion(project).orEmpty()) } tasks.named("compileKotlin") { dependsOn(buildConfig) 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 ded17cb2cd..2d1b618bc4 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 @@ -71,7 +71,7 @@ class ComposePlugin : Plugin { //redirecting all android artifacts to androidx.compose project.dependencies.modules { - if (!androidExtension.useAndroidX) { + if (!androidExtension.useAndroidX && !ComposeBuildConfig.experimentalOELPublication) { // Replace 'androidx.compose' artifacts by 'org.jetbrains.compose' artifacts. // It is needed, because 'org.jetbrains.compose' artifacts are the same artifacts as 'androidx.compose' // (but with different version).