@@ -179,4 +179,54 @@ tasks.configureEach { task ->
179179 if (task. name. contains(" clean" )) {
180180 task. dependsOn(deleteCmakeCache)
181181 }
182+
183+ // Make sure that we generate our prefab publication file only after having built the native library
184+ // so that not a header publication file, but a full configuration publication will be generated, which
185+ // will include the .so file
186+
187+ // TODO: this needs to be fixed to work dynamically on the variant name
188+ if (task. name. contains(" prefabDebugConfigurePackage" )) {
189+ task. outputs. upToDateWhen { false }
190+ task. dependsOn(" externalNativeBuildDebug" )
191+ }
192+ if (task. name. contains(" prefabReleaseConfigurePackage" )) {
193+ task. outputs. upToDateWhen { false }
194+ task. dependsOn(" externalNativeBuildRelease" )
195+ }
182196}
197+
198+ afterEvaluate {
199+ def abis = reactNativeArchitectures()
200+ rootProject. allprojects. each { proj ->
201+ if (proj === rootProject) return // skip RNWC and app project
202+
203+
204+ def dependsOnWorklets = proj. configurations. findAll { it. canBeResolved }. any { config ->
205+ config. dependencies. any { dep ->
206+ dep. group == project. group && dep. name == project. name
207+ }
208+ }
209+ if (! dependsOnWorklets && proj != project) return // skip if not dependent
210+ println (" Project ${ proj.path} depends on react-native-worklets-core" )
211+
212+ if (proj. plugins. hasPlugin(' com.android.application' ) || proj. plugins. hasPlugin(' com.android.library' )) {
213+ def variants = proj. android. hasProperty(' applicationVariants' ) ? proj. android. applicationVariants : proj. android. libraryVariants
214+ variants. all { variant ->
215+ def variantName = variant. name
216+ abis. each { abi ->
217+ def searchDir = new File (proj. projectDir, " .cxx/${ variantName} " )
218+ if (! searchDir. exists()) return
219+ def matches = []
220+ searchDir. eachDir { randomDir ->
221+ def prefabFile = new File (randomDir, " ${ abi} /prefab_config.json" )
222+ if (prefabFile. exists()) matches << prefabFile
223+ }
224+ matches. each { prefabConfig ->
225+ prefabConfig. setLastModified(System . currentTimeMillis())
226+ println (" Touched: ${ prefabConfig} " )
227+ }
228+ }
229+ }
230+ }
231+ }
232+ }
0 commit comments