From 69bd1727295ac1cc8bebfd7b06d12d5b948639ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Tue, 5 May 2026 12:17:20 +0200 Subject: [PATCH 1/2] chore: add RNRepo to CI builds --- apps/example/android/app/build.gradle | 15 +++++++++++++++ apps/example/android/build.gradle | 12 ++++++++++++ apps/example/ios/Podfile | 21 +++++++++++++++++++++ apps/example/package.json | 1 + yarn.lock | 8 ++++++++ 5 files changed, 57 insertions(+) diff --git a/apps/example/android/app/build.gradle b/apps/example/android/app/build.gradle index eac458cb..0552b96b 100644 --- a/apps/example/android/app/build.gradle +++ b/apps/example/android/app/build.gradle @@ -2,6 +2,21 @@ apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" +def isCIEnabled() { + return ["1", "true"].contains(System.getenv("CI")?.toLowerCase()) +} + +def isRNRepoEnabled() { + // return false // Uncomment to disable RNRepo locally + 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" +} + /** * 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/apps/example/android/build.gradle b/apps/example/android/build.gradle index f17a39e8..18fc14c3 100644 --- a/apps/example/android/build.gradle +++ b/apps/example/android/build.gradle @@ -11,10 +11,22 @@ 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") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + classpath rnrepoClasspath() } } diff --git a/apps/example/ios/Podfile b/apps/example/ios/Podfile index 68227da3..f74ecc7a 100644 --- a/apps/example/ios/Podfile +++ b/apps/example/ios/Podfile @@ -10,6 +10,24 @@ require Pod::Executable.execute_command('node', ['-p', {paths: [process.argv[1]]}, )', __dir__]).strip +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", + {paths: [process.argv[1]]}, + )', __dir__]).strip +end + platform :ios, min_ios_version_supported prepare_react_native_project! @@ -29,6 +47,9 @@ target 'EnrichedMarkdownExample' do ) post_install do |installer| + if is_ci_enabled? && is_rnrepo_enabled? + rnrepo_post_install(installer) + end react_native_post_install( installer, config[:reactNativePath], diff --git a/apps/example/package.json b/apps/example/package.json index 15a1c160..38ff87f1 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -29,6 +29,7 @@ "@react-native/babel-preset": "0.84.1", "@react-native/metro-config": "0.84.1", "@react-native/typescript-config": "0.84.1", + "@rnrepo/build-tools": "~0.1.3-beta.0", "@types/react": "^19.2.0", "react-native-builder-bob": "^0.40.18", "react-native-monorepo-config": "^0.3.3", diff --git a/yarn.lock b/yarn.lock index d48f1c39..0fc74be7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4846,6 +4846,13 @@ __metadata: languageName: node linkType: hard +"@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" @@ -13434,6 +13441,7 @@ __metadata: "@react-native/typescript-config": "npm:0.84.1" "@react-navigation/native": "npm:^7.2.2" "@react-navigation/native-stack": "npm:^7.14.12" + "@rnrepo/build-tools": "npm:~0.1.3-beta.0" "@types/react": "npm:^19.2.0" react: "npm:19.2.3" react-native: "npm:0.84.1" From 13110d953fa48430af920dd9021c7e56773631bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Rolka?= Date: Thu, 7 May 2026 11:19:55 +0200 Subject: [PATCH 2/2] chore: ignore react-native-enriched-markdown in RNRepo in case we will start supporting prebuilding this package, it have to be denied from prebuilding so ci will test the local implementation --- apps/example/rnrepo.config.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 apps/example/rnrepo.config.json diff --git a/apps/example/rnrepo.config.json b/apps/example/rnrepo.config.json new file mode 100644 index 00000000..65da6c44 --- /dev/null +++ b/apps/example/rnrepo.config.json @@ -0,0 +1,6 @@ +{ + "denyList": { + "android": ["react-native-enriched-markdown"], + "ios": ["react-native-enriched-markdown"] + } +} \ No newline at end of file