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 diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index 5dc0395169..5a8fe99262 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/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()) +} + +// 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" +} + /** * 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..70a2429dbc 100644 --- a/FabricExample/android/build.gradle +++ b/FabricExample/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/FabricExample/ios/Podfile b/FabricExample/ios/Podfile index 5406549ce6..d59cc14e2e 100644 --- a/FabricExample/ios/Podfile +++ b/FabricExample/ios/Podfile @@ -5,6 +5,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 + require_relative '../../scripts/ios/rns_update_info_plist' require_relative '../../scripts/ios/rns_set_swift_compilation_flags' @@ -30,6 +48,9 @@ target 'FabricExample' 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/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"