diff --git a/WORKSPACE b/WORKSPACE index bb4f5fae..80f95136 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -27,7 +27,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "grab_bazel_common", - commit = "092435fb286705c4dcd845c93c9d84e94a4088d9", + commit = "7ce14f2063b19b1e700bb9fa51cc944626545450", remote = "https://github.com/grab/grab-bazel-common.git", ) diff --git a/build.gradle b/build.gradle index c8cb8889..90378d10 100644 --- a/build.gradle +++ b/build.gradle @@ -98,7 +98,7 @@ grazel { rules { bazelCommon { gitRepository { - commit = "092435fb286705c4dcd845c93c9d84e94a4088d9" + commit = "7ce14f2063b19b1e700bb9fa51cc944626545450" remote = "https://github.com/grab/grab-bazel-common.git" } toolchains { diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/rules/AndroidRules.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/rules/AndroidRules.kt index 5a0d26b7..470dc9f5 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/rules/AndroidRules.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/bazel/rules/AndroidRules.kt @@ -336,6 +336,7 @@ fun StatementsBuilder.androidInstrumentationBinary( resourceStripPrefix: String? = null, resourceFiles: List = emptyList(), testInstrumentationRunner: String? = null, + enableCompose: Boolean = false, ) { load( "@$GRAB_BAZEL_COMMON//rules:defs.bzl", @@ -377,5 +378,9 @@ fun StatementsBuilder.androidInstrumentationBinary( testInstrumentationRunner?.let { "test_instrumentation_runner" `=` it.quote } + + if (enableCompose) { + "enable_compose" `=` enableCompose.toString().capitalize() + } } } diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryData.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryData.kt index 1ab18aa5..f7b5a07f 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryData.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryData.kt @@ -32,4 +32,5 @@ internal data class AndroidInstrumentationBinaryData( val resourceStripPrefix: String? = null, val srcs: List, val testInstrumentationRunner: String? = null, + val compose: Boolean = false, ) diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractor.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractor.kt index a5dc4875..415d8b53 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractor.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractor.kt @@ -24,6 +24,7 @@ import com.grab.grazel.gradle.dependencies.BuildGraphType import com.grab.grazel.gradle.dependencies.DependenciesDataSource import com.grab.grazel.gradle.dependencies.DependencyGraphs import com.grab.grazel.gradle.dependencies.GradleDependencyToBazelDependency +import com.grab.grazel.gradle.hasCompose import com.grab.grazel.gradle.variant.AndroidVariantDataSource import com.grab.grazel.gradle.variant.MatchedVariant import com.grab.grazel.gradle.variant.getMigratableBuildVariants @@ -144,6 +145,7 @@ internal class DefaultAndroidInstrumentationBinaryDataExtractor srcs = srcs, testInstrumentationRunner = testInstrumentationRunner, manifestValues = manifestValues, + compose = hasCompose, ) } } diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryTarget.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryTarget.kt index 98b2797c..5791a34b 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryTarget.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryTarget.kt @@ -39,6 +39,7 @@ internal data class AndroidInstrumentationBinaryTarget( val resourceStripPrefix: String? = null, val resourceFiles: List, val testInstrumentationRunner: String? = null, + val compose: Boolean, ) : BazelBuildTarget { override fun statements(builder: StatementsBuilder) = builder { @@ -56,6 +57,7 @@ internal data class AndroidInstrumentationBinaryTarget( resourceStripPrefix = resourceStripPrefix, resourceFiles = buildResFiles(resourceFiles), testInstrumentationRunner = testInstrumentationRunner, + enableCompose = compose, ) } } diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/target/AndroidInstrumentationBinaryTargetBuilder.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/target/AndroidInstrumentationBinaryTargetBuilder.kt index 97cce02e..6dec1d26 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/target/AndroidInstrumentationBinaryTargetBuilder.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/target/AndroidInstrumentationBinaryTargetBuilder.kt @@ -82,6 +82,7 @@ internal class AndroidInstrumentationBinaryTargetBuilder resourceFiles = resourceFiles, srcs = srcs, testInstrumentationRunner = testInstrumentationRunner, + compose = compose, ) } diff --git a/sample-android/BUILD.bazel b/sample-android/BUILD.bazel index 935b7677..89cfb0a8 100644 --- a/sample-android/BUILD.bazel +++ b/sample-android/BUILD.bazel @@ -417,6 +417,7 @@ android_instrumentation_binary( ], custom_package = "com.grab.grazel.android.sample", debug_key = "//buildsystem:debug-keystore", + enable_compose = True, instruments = ":sample-android-flavor1-free-debug", manifest_values = { "versionCode": "1", @@ -472,6 +473,7 @@ android_instrumentation_binary( ], custom_package = "com.grab.grazel.android.sample", debug_key = "//buildsystem:debug-keystore", + enable_compose = True, instruments = ":sample-android-flavor1-paid-debug", manifest_values = { "versionCode": "1", @@ -527,6 +529,7 @@ android_instrumentation_binary( ], custom_package = "com.grab.grazel.android.sample", debug_key = "//buildsystem:debug-keystore", + enable_compose = True, instruments = ":sample-android-flavor2-free-debug", manifest_values = { "versionCode": "1", @@ -582,6 +585,7 @@ android_instrumentation_binary( ], custom_package = "com.grab.grazel.android.sample", debug_key = "//buildsystem:debug-keystore", + enable_compose = True, instruments = ":sample-android-flavor2-paid-debug", manifest_values = { "versionCode": "1",