File tree Expand file tree Collapse file tree
gradle-plugins/react/brownfield/src/main/kotlin/com/callstack/react/brownfield Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,11 +109,17 @@ object RNSourceSets {
109109
110110 project.tasks.named(" preBuild" ).configure {
111111 /* *
112- * As part of the build task, we need to make sure the auto-gen files are present.
113- * This makes sure that AutoLinking and ReactNativeEntryPoint are generated.
112+ * Ensure auto-generated sources are available before compilation.
113+ *
114+ * This hooks into the global `preBuild` task, so the dependency runs
115+ * regardless of build variant. Use this only when the generated sources
116+ * are identical for all variants (debug/release).
117+ *
118+ * If variant-specific
119+ * files are needed, prefer `preDebugBuild` / `preReleaseBuild` under
120+ * `VariantProcessor.processVariant`
114121 */
115122 it.dependsOn(" copyAutolinkingSources" )
116- it.dependsOn(" :${appProject.name} :createBundleReleaseJsAndAssets" )
117123 }
118124 }
119125}
Original file line number Diff line number Diff line change 1111package com.callstack.react.brownfield.processors
1212
1313import com.android.build.gradle.api.LibraryVariant
14+ import com.android.build.gradle.internal.tasks.factory.dependsOn
1415import com.callstack.react.brownfield.artifacts.ArtifactsResolver.Companion.ARTIFACT_TYPE_AAR
1516import com.callstack.react.brownfield.artifacts.ArtifactsResolver.Companion.ARTIFACT_TYPE_JAR
1617import com.callstack.react.brownfield.exceptions.TaskNotFound
@@ -54,6 +55,10 @@ class VariantProcessor(private val variant: LibraryVariant) : BaseProject() {
5455 throw TaskNotFound (" Can not find $preBuildTaskPath task" )
5556 }
5657
58+ if (upperCaseVariantName == " Release" ) {
59+ prepareTask.dependsOn(" :app:createBundleReleaseJsAndAssets" )
60+ }
61+
5762 val bundleTask = variantTaskProvider.bundleTaskProvider(project, variant.name)
5863 explodeArtifactFiles(artifacts, prepareTask, bundleTask)
5964 mergeClassesAndJars(bundleTask)
You can’t perform that action at this time.
0 commit comments