From ed2aa917eee3c164cecd38c29c79f45a0a874240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Wed, 29 Apr 2026 16:29:01 +0200 Subject: [PATCH 1/5] Apply rnrepo to FabricExample --- FabricExample/android/app/build.gradle | 5 +++++ FabricExample/android/build.gradle | 8 ++++++++ FabricExample/ios/Podfile | 12 ++++++++++++ FabricExample/package.json | 1 + FabricExample/yarn.lock | 8 ++++++++ 5 files changed, 34 insertions(+) diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index 5dc0395169..f0205ac200 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle @@ -2,6 +2,11 @@ apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" +// Use RNRepo in CI builds +if (System.getenv("CI") == "true") { + apply plugin: "org.rnrepo.tools.prebuilds-plugin" +} + /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. diff --git a/FabricExample/android/build.gradle b/FabricExample/android/build.gradle index 63fb1d1a3f..863b168641 100644 --- a/FabricExample/android/build.gradle +++ b/FabricExample/android/build.gradle @@ -15,6 +15,14 @@ buildscript { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + // RNRepo plugin in CI builds (plugin applied in app/build.gradle) + def rnrepoDir = new File( + providers.exec { + workingDir(rootDir) + commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')") + }.standardOutput.asText.get().trim() + ).getParentFile().absolutePath + classpath fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"]) } } diff --git a/FabricExample/ios/Podfile b/FabricExample/ios/Podfile index 5406549ce6..097e8fe444 100644 --- a/FabricExample/ios/Podfile +++ b/FabricExample/ios/Podfile @@ -5,6 +5,15 @@ require Pod::Executable.execute_command('node', ['-p', {paths: [process.argv[1]]}, )', __dir__]).strip +# Use RNRepo in CI builds +if ENV['CI'] == 'true' + require Pod::Executable.execute_command('node', ['-p', + 'require.resolve( + "@rnrepo/build-tools/cocoapods-plugin/lib/plugin.rb", + {paths: [process.argv[1]]}, + )', __dir__]).strip +end + require_relative '../../scripts/ios/rns_update_info_plist' require_relative '../../scripts/ios/rns_set_swift_compilation_flags' @@ -30,6 +39,9 @@ target 'FabricExample' do ) post_install do |installer| + if ENV['CI'] == 'true' + rnrepo_post_install(installer) + end react_native_post_install( installer, config[:reactNativePath], diff --git a/FabricExample/package.json b/FabricExample/package.json index c3ede48e92..1370983326 100644 --- a/FabricExample/package.json +++ b/FabricExample/package.json @@ -48,6 +48,7 @@ "@react-native/jest-preset": "0.85.0", "@react-native/metro-config": "0.85.0", "@react-native/typescript-config": "0.85.0", + "@rnrepo/build-tools": "~0.1.3-beta.0", "@types/jest": "^29.5.13", "@types/react": "^19.2.0", "@types/react-test-renderer": "^19.1.0", diff --git a/FabricExample/yarn.lock b/FabricExample/yarn.lock index e395912991..c8f6c1144b 100644 --- a/FabricExample/yarn.lock +++ b/FabricExample/yarn.lock @@ -3101,6 +3101,13 @@ __metadata: languageName: node linkType: soft +"@rnrepo/build-tools@npm:~0.1.3-beta.0": + version: 0.1.3-beta.0 + resolution: "@rnrepo/build-tools@npm:0.1.3-beta.0" + checksum: 10c0/83d2c2b05d87ab038d139c56b2e8ea1df071c41a51094a6464d9c7bc5794f25eb289b8b9298418e829d9ebfe723a77d5556fb1eaf69d87b25dda1f7d19d2d5fb + languageName: node + linkType: hard + "@sideway/address@npm:^4.1.5": version: 4.1.5 resolution: "@sideway/address@npm:4.1.5" @@ -3515,6 +3522,7 @@ __metadata: "@react-navigation/native-stack": "link:../react-navigation/packages/native-stack/" "@react-navigation/routers": "link:../react-navigation/packages/routers/" "@react-navigation/stack": "link:../react-navigation/packages/stack/" + "@rnrepo/build-tools": "npm:~0.1.3-beta.0" "@types/jest": "npm:^29.5.13" "@types/react": "npm:^19.2.0" "@types/react-test-renderer": "npm:^19.1.0" From 9030fa9f889eff2ab263c372219c6aaf65e64a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Mon, 4 May 2026 10:51:29 +0200 Subject: [PATCH 2/5] ci: update Android build task to target app module --- .github/workflows/android-build-test-fabric.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android-build-test-fabric.yml b/.github/workflows/android-build-test-fabric.yml index 97c30b8b90..f39607a197 100644 --- a/.github/workflows/android-build-test-fabric.yml +++ b/.github/workflows/android-build-test-fabric.yml @@ -46,4 +46,4 @@ jobs: run: yarn - name: Build app working-directory: ${{ env.WORKING_DIRECTORY }}/android - run: ./gradlew assembleDebug --console=plain -PreactNativeArchitectures=arm64-v8a + run: ./gradlew :app:assembleDebug --console=plain -PreactNativeArchitectures=arm64-v8a From 11d2460dfc0c086e5393a611c0d3673e1b0526dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Mon, 4 May 2026 11:03:27 +0200 Subject: [PATCH 3/5] better handling of ci env flag --- FabricExample/android/app/build.gradle | 2 +- FabricExample/ios/Podfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index f0205ac200..508d75e43a 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle @@ -3,7 +3,7 @@ apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" // Use RNRepo in CI builds -if (System.getenv("CI") == "true") { +if (["1", "true"].contains(System.getenv("CI"))) { apply plugin: "org.rnrepo.tools.prebuilds-plugin" } diff --git a/FabricExample/ios/Podfile b/FabricExample/ios/Podfile index 097e8fe444..c48f180d20 100644 --- a/FabricExample/ios/Podfile +++ b/FabricExample/ios/Podfile @@ -6,7 +6,7 @@ require Pod::Executable.execute_command('node', ['-p', )', __dir__]).strip # Use RNRepo in CI builds -if ENV['CI'] == 'true' +if %w[1 true].include?(ENV['CI'].to_s.downcase) require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "@rnrepo/build-tools/cocoapods-plugin/lib/plugin.rb", @@ -39,7 +39,7 @@ target 'FabricExample' do ) post_install do |installer| - if ENV['CI'] == 'true' + if %w[1 true].include?(ENV['CI'].to_s.downcase) rnrepo_post_install(installer) end react_native_post_install( From 8063ab9e8ba47cc6a1848f5a753217a23157e2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Mon, 4 May 2026 11:37:05 +0200 Subject: [PATCH 4/5] chore: add DISABLE_RNREPO support to CI build configurations in Podfile and Gradle files --- FabricExample/android/app/build.gradle | 16 +++++++++++++--- FabricExample/android/build.gradle | 21 +++++++++++++-------- FabricExample/ios/Podfile | 15 ++++++++++++--- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index 508d75e43a..5a8fe99262 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle @@ -2,9 +2,19 @@ apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" -// Use RNRepo in CI builds -if (["1", "true"].contains(System.getenv("CI"))) { - apply plugin: "org.rnrepo.tools.prebuilds-plugin" +def isCIEnabled() { + return ["1", "true"].contains(System.getenv("CI")?.toLowerCase()) +} + +// System.setProperty("DISABLE_RNREPO", "1") // Uncomment to disable RNRepo even in CI +def isRNRepoEnabled() { + return System.getenv("DISABLE_RNREPO") == null +} + +// Use RNRepo in CI builds. +// Set DISABLE_RNREPO to any value to disable RNRepo. +if (isCIEnabled() && isRNRepoEnabled()) { + apply plugin: "org.rnrepo.tools.prebuilds-plugin" } /** diff --git a/FabricExample/android/build.gradle b/FabricExample/android/build.gradle index 863b168641..3c98113de0 100644 --- a/FabricExample/android/build.gradle +++ b/FabricExample/android/build.gradle @@ -1,3 +1,15 @@ +// RNRepo plugin classpath for CI builds (plugin applied in app/build.gradle). +// To disable RNRepo support, set DISABLE_RNREPO environment variable to ANY value. +def rnrepoClasspath() { + def rnrepoDir = new File( + providers.exec { + workingDir(rootDir) + commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')") + }.standardOutput.asText.get().trim() + ).getParentFile().absolutePath + return fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"]) +} + buildscript { ext { buildToolsVersion = "36.0.0" @@ -15,14 +27,7 @@ buildscript { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") - // RNRepo plugin in CI builds (plugin applied in app/build.gradle) - def rnrepoDir = new File( - providers.exec { - workingDir(rootDir) - commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')") - }.standardOutput.asText.get().trim() - ).getParentFile().absolutePath - classpath fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"]) + classpath rnrepoClasspath() } } diff --git a/FabricExample/ios/Podfile b/FabricExample/ios/Podfile index c48f180d20..d59cc14e2e 100644 --- a/FabricExample/ios/Podfile +++ b/FabricExample/ios/Podfile @@ -5,8 +5,17 @@ require Pod::Executable.execute_command('node', ['-p', {paths: [process.argv[1]]}, )', __dir__]).strip -# Use RNRepo in CI builds -if %w[1 true].include?(ENV['CI'].to_s.downcase) +def is_ci_enabled? + %w[1 true].include?(ENV['CI'].to_s.downcase) +end + +# ENV['DISABLE_RNREPO'] = "1" # Uncomment to disable RNRepo even in CI +def is_rnrepo_enabled? + ENV['DISABLE_RNREPO'].nil? +end + +# Use RNRepo in CI builds. Set DISABLE_RNREPO to any value to disable RNRepo. +if is_ci_enabled? && is_rnrepo_enabled? require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "@rnrepo/build-tools/cocoapods-plugin/lib/plugin.rb", @@ -39,7 +48,7 @@ target 'FabricExample' do ) post_install do |installer| - if %w[1 true].include?(ENV['CI'].to_s.downcase) + if is_ci_enabled? && is_rnrepo_enabled? rnrepo_post_install(installer) end react_native_post_install( From 4f8292834471be836a03ef00f6d086ffb12b13d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Mon, 4 May 2026 12:34:09 +0200 Subject: [PATCH 5/5] move rnrepo function inside buildscript buildscript is resolved as first, so it has to be inside, or imported from another gradle file --- FabricExample/android/build.gradle | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/FabricExample/android/build.gradle b/FabricExample/android/build.gradle index 3c98113de0..70a2429dbc 100644 --- a/FabricExample/android/build.gradle +++ b/FabricExample/android/build.gradle @@ -1,15 +1,3 @@ -// RNRepo plugin classpath for CI builds (plugin applied in app/build.gradle). -// To disable RNRepo support, set DISABLE_RNREPO environment variable to ANY value. -def rnrepoClasspath() { - def rnrepoDir = new File( - providers.exec { - workingDir(rootDir) - commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')") - }.standardOutput.asText.get().trim() - ).getParentFile().absolutePath - return fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"]) -} - buildscript { ext { buildToolsVersion = "36.0.0" @@ -23,6 +11,17 @@ buildscript { google() mavenCentral() } + // RNRepo plugin classpath for CI builds (plugin applied in app/build.gradle). + // To disable RNRepo support, set DISABLE_RNREPO environment variable to ANY value. + def rnrepoClasspath = { + def rnrepoDir = new File( + providers.exec { + workingDir(rootDir) + commandLine("node", "--print", "require.resolve('@rnrepo/build-tools/package.json')") + }.standardOutput.asText.get().trim() + ).getParentFile().absolutePath + return fileTree(dir: "${rnrepoDir}/gradle-plugin/build/libs", include: ["prebuilds-plugin.jar"]) + } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin")