From 1a961ae4a50bfb996f2f1940a061309838a892bb Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:26:45 +0200 Subject: [PATCH] feat!: drop support for Flipper BREAKING CHANGE: Dropped support for Flipper For more context, see https://github.com/react-native-community/discussions-and-proposals/pull/641. --- .github/workflows/build.yml | 2 +- android/app/build.gradle | 25 ----- .../reacttestapp/ReactNativeFlipper.kt | 61 ------------- .../react/TestAppReactNativeHost.kt | 22 ----- android/test-app-util.gradle | 28 ------ example/android/gradle.properties | 5 - example/ios/Podfile | 2 - ios/ReactTestApp/ReactInstance.swift | 13 --- .../ReactTestApp-Bridging-Header.h | 9 -- ios/test_app.rb | 32 +------ ios/use_react_native-0.64.rb | 14 +-- ios/use_react_native-0.68.rb | 11 +-- ios/use_react_native-0.70.rb | 49 ++-------- scripts/template.js | 2 - test/android-test-app/test-app-util.test.mjs | 91 ------------------- test/configure/gatherConfig.test.mjs | 10 -- test/pack.test.mjs | 1 - test/test_test_app.rb | 37 -------- 18 files changed, 14 insertions(+), 400 deletions(-) delete mode 100644 android/app/src/flipper/java/com/microsoft/reacttestapp/ReactNativeFlipper.kt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e15e42e1..cb8cb9da0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -232,7 +232,7 @@ jobs: - name: Install Pods if: ${{ steps.affected.outputs.ios != '' }} run: | - USE_FLIPPER=0 pod install --project-directory=${{ steps.configure.outputs.project-directory }} + pod install --project-directory=${{ steps.configure.outputs.project-directory }} working-directory: template-example - name: Build if: ${{ steps.affected.outputs.ios != '' }} diff --git a/android/app/build.gradle b/android/app/build.gradle index 21895ca1a..3ffa9571f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -62,7 +62,6 @@ project.ext.react = [ bundleInRelease : false, enableCamera : !getSingleAppMode(), enableFabric : isFabricEnabled(project), - enableFlipper : getFlipperVersion(rootDir), enableHermes : true, enableNewArchitecture: enableNewArchitecture, ] @@ -116,11 +115,6 @@ android { buildConfigField "String", "ReactTestApp_appManifest", "\"${appManifest}\"" buildConfigField "String", "ReactTestApp_appManifestChecksum", "\"${checksum}\"" - def recommendedFlipperVersion = getFlipperRecommendedVersion(rootDir) - buildConfigField "String", - "ReactTestApp_recommendedFlipperVersion", - recommendedFlipperVersion ? "\"${recommendedFlipperVersion}\"" : "\"0\"" - def singleApp = getSingleAppMode() buildConfigField "String", "ReactTestApp_singleApp", singleApp ? "\"${singleApp}\"" : "null" @@ -319,10 +313,6 @@ android { ? "src/reactapplication-pre-0.73/java" : "src/reactapplication-0.73/java", ] - - if (project.ext.react.enableFlipper) { - debug.java.srcDirs += "src/flipper/java" - } } splits { @@ -398,21 +388,6 @@ dependencies { implementation libraries.androidCameraMlKitVision implementation libraries.mlKitBarcodeScanning } - - if (project.ext.react.enableFlipper) { - logger.warn("\nFlipper is deprecated and is removed from react-native in 0.74") - logger.warn("\nFlipper will be removed from react-native-test-app in 3.0") - def flipperVersion = project.ext.react.enableFlipper - debugImplementation("com.facebook.flipper:flipper:${flipperVersion}") { - exclude(group: "com.facebook.fbjni") - } - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${flipperVersion}") { - exclude(group: "com.facebook.flipper") - } - debugImplementation("com.facebook.flipper:flipper-network-plugin:${flipperVersion}") { - exclude(group: "com.facebook.flipper") - } - } } if (!usePrefabs) { diff --git a/android/app/src/flipper/java/com/microsoft/reacttestapp/ReactNativeFlipper.kt b/android/app/src/flipper/java/com/microsoft/reacttestapp/ReactNativeFlipper.kt deleted file mode 100644 index 4fee281e6..000000000 --- a/android/app/src/flipper/java/com/microsoft/reacttestapp/ReactNativeFlipper.kt +++ /dev/null @@ -1,61 +0,0 @@ -package com.microsoft.reacttestapp - -import android.content.Context -import com.facebook.flipper.android.AndroidFlipperClient -import com.facebook.flipper.android.utils.FlipperUtils -import com.facebook.flipper.core.FlipperClient -import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin -import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin -import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin -import com.facebook.flipper.plugins.inspector.DescriptorMapping -import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin -import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor -import com.facebook.flipper.plugins.network.NetworkFlipperPlugin -import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin -import com.facebook.react.ReactInstanceManager -import com.facebook.react.bridge.ReactContext -import com.facebook.react.modules.network.NetworkingModule -import com.microsoft.reacttestapp.compat.ReactInstanceEventListener - -@Suppress("unused") -object ReactNativeFlipper { - @JvmStatic - fun initialize(context: Context?, reactInstanceManager: ReactInstanceManager) { - if (!FlipperUtils.shouldEnableFlipper(context)) { - return - } - - val client: FlipperClient = AndroidFlipperClient.getInstance(context) - client.addPlugin(InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())) - client.addPlugin(DatabasesFlipperPlugin(context)) - client.addPlugin(SharedPreferencesFlipperPlugin(context)) - client.addPlugin(CrashReporterPlugin.getInstance()) - - val networkFlipperPlugin = NetworkFlipperPlugin() - NetworkingModule.setCustomClientBuilder { builder -> - builder.addNetworkInterceptor(FlipperOkhttpInterceptor(networkFlipperPlugin)) - } - client.addPlugin(networkFlipperPlugin) - - client.start() - - // FrescoFlipperPlugin needs to ensure that ImagePipelineFactory is - // initialized and must therefore be run after all native modules have - // been initialized. - val reactContext = reactInstanceManager.currentReactContext - if (reactContext == null) { - reactInstanceManager.addReactInstanceEventListener( - object : ReactInstanceEventListener { - override fun onReactContextInitialized(reactContext: ReactContext) { - reactInstanceManager.removeReactInstanceEventListener(this) - reactContext.runOnNativeModulesQueueThread { - client.addPlugin(FrescoFlipperPlugin()) - } - } - } - ) - } else { - client.addPlugin(FrescoFlipperPlugin()) - } - } -} diff --git a/android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt b/android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt index ba463b5b0..6bd1a3f26 100644 --- a/android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt +++ b/android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt @@ -4,7 +4,6 @@ import android.app.Activity import android.app.Application import android.content.Context import android.net.Uri -import android.util.Log import com.facebook.hermes.reactexecutor.HermesExecutorFactory import com.facebook.react.PackageList import com.facebook.react.ReactInstanceManager @@ -13,7 +12,6 @@ import com.facebook.react.bridge.JSIModulePackage import com.facebook.react.bridge.JavaScriptExecutorFactory import com.facebook.react.bridge.ReactContext import com.facebook.react.devsupport.interfaces.DevSupportManager -import com.facebook.react.modules.systeminfo.ReactNativeVersion import com.facebook.react.packagerconnection.PackagerConnectionSettings import com.facebook.soloader.SoLoader import com.microsoft.reacttestapp.BuildConfig @@ -81,26 +79,6 @@ class TestAppReactNativeHost( beforeReactNativeInit() reactInstanceManager.createReactContextInBackground() - - if (BuildConfig.DEBUG) { - try { - Class.forName("com.microsoft.reacttestapp.ReactNativeFlipper") - .getMethod("initialize", Context::class.java, ReactInstanceManager::class.java) - .invoke(null, application, reactInstanceManager) - } catch (e: ClassNotFoundException) { - val flipperVersion = BuildConfig.ReactTestApp_recommendedFlipperVersion - if (flipperVersion != "0") { - val major = ReactNativeVersion.VERSION["major"] as Int - val minor = ReactNativeVersion.VERSION["minor"] as Int - Log.i( - "ReactTestApp", - "To use Flipper, define `FLIPPER_VERSION` in your `gradle.properties`. " + - "Since you're using React Native $major.$minor, we recommend setting " + - "`FLIPPER_VERSION=$flipperVersion`." - ) - } - } - } } fun addReactInstanceEventListener(listener: ReactInstanceEventListener) { diff --git a/android/test-app-util.gradle b/android/test-app-util.gradle index 616a457b1..8a7cc567b 100644 --- a/android/test-app-util.gradle +++ b/android/test-app-util.gradle @@ -134,34 +134,6 @@ ext.getArchitectures = { return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -// TODO: this will not work 0.74 onward. -ext.getFlipperRecommendedVersion = { baseDir -> - def reactNativePath = findNodeModulesPath("react-native", baseDir) - def props = new Properties() - file("${reactNativePath}/template/android/gradle.properties").withInputStream { - props.load(it) - } - - return props.getProperty("FLIPPER_VERSION") -} - -ext.getFlipperVersion = { baseDir -> - def recommendedFlipperVersion = getFlipperRecommendedVersion(baseDir) - if (recommendedFlipperVersion == null) { - // Current React Native version doesn't support Flipper - return null - } - - // Prefer user specified Flipper version - if (project.hasProperty("FLIPPER_VERSION")) { - def flipperVersion = project.getProperty("FLIPPER_VERSION") - return flipperVersion == "false" ? null : flipperVersion - } - - // Use the recommended Flipper version - return recommendedFlipperVersion -} - ext.getManifest = { if (manifest == null) { def manifestFile = findFile("app.json") diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 2577d9118..e6d4113a1 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -29,11 +29,6 @@ android.enableJetifier=true # Jetifier randomly fails on these libraries android.jetifier.ignorelist=hermes-android -# Version of Flipper to use with React Native. Default value is whatever React -# Native defaults to. To enable Flipper, set the value to `X.Y.Z` (version you want to use). -# To disable Flipper, set it to `false`. -FLIPPER_VERSION=false - # Use this property to specify which architecture you want to build. # You can also override it from the CLI using # ./gradlew -PreactNativeArchitectures=x86_64 diff --git a/example/ios/Podfile b/example/ios/Podfile index c203d6980..571125916 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -2,8 +2,6 @@ require_relative '../node_modules/react-native-test-app/test_app' workspace 'Example.xcworkspace' -use_flipper! false unless ENV['USE_FLIPPER'] == '1' - options = { :fabric_enabled => false, :hermes_enabled => false, diff --git a/ios/ReactTestApp/ReactInstance.swift b/ios/ReactTestApp/ReactInstance.swift index c9d9ad023..d78e0a20b 100644 --- a/ios/ReactTestApp/ReactInstance.swift +++ b/ios/ReactTestApp/ReactInstance.swift @@ -51,19 +51,6 @@ final class ReactInstance: NSObject, RNXHostConfig { andEventID: AEEventID(kAEGetURL) ) #endif - - #if USE_FLIPPER - if let flipper = FlipperClient.shared() { - flipper.add(FlipperKitLayoutPlugin( - rootNode: UIApplication.shared, - with: SKDescriptorMapper(defaults: ()) - )) - flipper.add(FKUserDefaultsPlugin(suiteName: nil)) - flipper.add(FlipperKitReactPlugin()) - flipper.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter())) - flipper.start() - } - #endif } init(forTestingPurposesOnly: Bool) { diff --git a/ios/ReactTestApp/ReactTestApp-Bridging-Header.h b/ios/ReactTestApp/ReactTestApp-Bridging-Header.h index 8ebe42b2b..5d9d92c76 100644 --- a/ios/ReactTestApp/ReactTestApp-Bridging-Header.h +++ b/ios/ReactTestApp/ReactTestApp-Bridging-Header.h @@ -16,15 +16,6 @@ @import ReactTestApp_DevSupport; -#if USE_FLIPPER -#import -#import -#import -#import -#import -#import -#endif // USE_FLIPPER - #import "React+Compatibility.h" #import "UIViewController+ReactTestApp.h" diff --git a/ios/test_app.rb b/ios/test_app.rb index fba0e93e9..ee5233bec 100644 --- a/ios/test_app.rb +++ b/ios/test_app.rb @@ -51,14 +51,6 @@ def platform_config(key, project_root, target_platform) config[key] if !config.nil? && !config.empty? end -def flipper_enabled? - @flipper_versions != false -end - -def flipper_versions - @flipper_versions != false && (@flipper_versions || {}) -end - def nearest_node_modules(project_root) path = find_file('node_modules', project_root) assert(!path.nil?, "Could not find 'node_modules'") @@ -194,10 +186,6 @@ def resources_pod(project_root, target_platform, platforms) Pathname.new(app_dir).relative_path_from(project_root).to_s end -def use_flipper!(versions = {}) - @flipper_versions = versions -end - def use_react_native!(project_root, target_platform, options) react_native = react_native_path(project_root, target_platform) version = package_version(react_native.to_s).segments @@ -208,9 +196,7 @@ def use_react_native!(project_root, target_platform, options) include_react_native!(**options, app_path: find_file('package.json', project_root).parent.to_s, path: react_native.relative_path_from(project_root).to_s, - rta_flipper_versions: flipper_versions, - rta_project_root: project_root, - rta_target_platform: target_platform) + rta_project_root: project_root) end def make_project!(xcodeproj, project_root, target_platform, options) @@ -315,7 +301,6 @@ def make_project!(xcodeproj, project_root, target_platform, options) build_number = platform_config('buildNumber', project_root, target_platform) build_settings['PRODUCT_BUILD_NUMBER'] = build_number || '1' - supports_flipper = target_platform == :ios && flipper_enabled? use_fabric = fabric_enabled?(options, rn_version) use_turbomodule = new_architecture_enabled?(options, rn_version) @@ -332,8 +317,6 @@ def make_project!(xcodeproj, project_root, target_platform, options) (rn_version >= v(0, 71, 0) && rn_version < v(0, 71, 4)) || (rn_version.positive? && rn_version < v(0, 70, 14)) target.build_configurations.each do |config| - use_flipper = config.name == 'Debug' && supports_flipper - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)'] config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << version_macro config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'USE_FABRIC=1' if use_fabric @@ -341,10 +324,6 @@ def make_project!(xcodeproj, project_root, target_platform, options) config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1' end - if use_flipper - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'FB_SONARKIT_ENABLED=1' - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'USE_FLIPPER=1' - end if use_turbomodule config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'FOLLY_NO_CONFIG=1' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_NEW_ARCH_ENABLED=1' @@ -357,10 +336,6 @@ def make_project!(xcodeproj, project_root, target_platform, options) config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)'] config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_FABRIC' if use_fabric - if use_flipper - config.build_settings['OTHER_SWIFT_FLAGS'] << '-DFB_SONARKIT_ENABLED' - config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_FLIPPER' - end config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_TURBOMODULE' if use_turbomodule if single_app.is_a? String config.build_settings['OTHER_SWIFT_FLAGS'] << '-DENABLE_SINGLE_APP_MODE' @@ -455,11 +430,6 @@ def use_test_app_internal!(target_platform, options) installer.pods_project.targets.each do |target| case target.name - when /\AFlipper/, 'libevent' - target.build_configurations.each do |config| - # Flipper and its dependencies log too many warnings - config.build_settings['WARNING_CFLAGS'] = ['-w'] - end when /\AReact/ target.build_configurations.each do |config| # Xcode 10.2 requires suppression of nullability for React diff --git a/ios/use_react_native-0.64.rb b/ios/use_react_native-0.64.rb index 57a9ab218..77289e0c9 100644 --- a/ios/use_react_native-0.64.rb +++ b/ios/use_react_native-0.64.rb @@ -1,20 +1,10 @@ -# rubocop:disable Metrics/CyclomaticComplexity - require 'open3' def include_react_native!(options) - react_native, flipper_versions, project_root, target_platform = options.values_at( - :path, :rta_flipper_versions, :rta_project_root, :rta_target_platform - ) + react_native, project_root = options.values_at(:path, :rta_project_root) require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods')) - if target_platform == :ios && flipper_versions - Pod::UI.warn('Flipper is deprecated and is removed from react-native in 0.74') - Pod::UI.warn('Flipper will be removed from react-native-test-app in 3.0') - end - - use_flipper!(flipper_versions) if target_platform == :ios && flipper_versions use_react_native!(options) # If we're using react-native@main, we'll also need to prepare @@ -37,5 +27,3 @@ def include_react_native!(options) end } end - -# rubocop:enable Metrics/CyclomaticComplexity diff --git a/ios/use_react_native-0.68.rb b/ios/use_react_native-0.68.rb index 305296366..4a324aa57 100644 --- a/ios/use_react_native-0.68.rb +++ b/ios/use_react_native-0.68.rb @@ -3,20 +3,11 @@ require_relative('pod_helpers') def include_react_native!(options) - react_native = options[:path] - flipper_versions = options[:rta_flipper_versions] - project_root = options[:rta_project_root] - target_platform = options[:rta_target_platform] + react_native, project_root = options.values_at(:path, :rta_project_root) require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods')) - if target_platform == :ios && flipper_versions - Pod::UI.warn('Flipper is deprecated and is removed from react-native in 0.74') - Pod::UI.warn('Flipper will be removed from react-native-test-app in 3.0') - end - use_new_architecture!(options) - use_flipper!(flipper_versions) if target_platform == :ios && flipper_versions use_react_native!(options) # If we're using react-native@main, we'll also need to prepare diff --git a/ios/use_react_native-0.70.rb b/ios/use_react_native-0.70.rb index 4ac6ec6aa..065061864 100644 --- a/ios/use_react_native-0.70.rb +++ b/ios/use_react_native-0.70.rb @@ -1,49 +1,22 @@ -# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity - require 'open3' require_relative('pod_helpers') def include_react_native!(options) - react_native = options[:path] - flipper_versions = options[:rta_flipper_versions] - project_root = options[:rta_project_root] - target_platform = options[:rta_target_platform] + react_native, project_root = options.values_at(:path, :rta_project_root) require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods')) - if target_platform == :ios && (flipper_versions || options.key?(:flipper_configuration)) - Pod::UI.warn('Flipper is deprecated and is removed from react-native in 0.74') - Pod::UI.warn('Flipper will be removed from react-native-test-app in 3.0') - if flipper_versions && defined?(FlipperConfiguration) - options[:flipper_configuration] = FlipperConfiguration.enabled(['Debug'], flipper_versions) - end - end - use_new_architecture!(options) - if defined?(FlipperConfiguration) - # TODO: Remove this branch in 3.0 - use_react_native!( - path: react_native, - fabric_enabled: options[:fabric_enabled] == true, - new_arch_enabled: options[:new_arch_enabled] == true, - production: options.key?(:production) ? options[:production] : ENV['PRODUCTION'] == '1', - hermes_enabled: options[:hermes_enabled] == true, - flipper_configuration: options[:flipper_configuration] || FlipperConfiguration.disabled, - app_path: options[:app_path] || '..', - config_file_dir: options[:config_file_dir] || '' - ) - else - use_react_native!( - path: react_native, - fabric_enabled: options[:fabric_enabled] == true, - new_arch_enabled: options[:new_arch_enabled] == true, - production: options.key?(:production) ? options[:production] : ENV['PRODUCTION'] == '1', - hermes_enabled: options[:hermes_enabled] == true, - app_path: options[:app_path] || '..', - config_file_dir: options[:config_file_dir] || '' - ) - end + use_react_native!( + path: react_native, + fabric_enabled: options[:fabric_enabled] == true, + new_arch_enabled: options[:new_arch_enabled] == true, + production: options.key?(:production) ? options[:production] : ENV['PRODUCTION'] == '1', + hermes_enabled: options[:hermes_enabled] == true, + app_path: options[:app_path] || '..', + config_file_dir: options[:config_file_dir] || '' + ) # If we're using react-native@main, we'll also need to prepare # `react-native-codegen`. @@ -57,5 +30,3 @@ def include_react_native!(options) end } end - -# rubocop:enable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity diff --git a/scripts/template.js b/scripts/template.js index 5f5e17dac..740f43278 100644 --- a/scripts/template.js +++ b/scripts/template.js @@ -87,8 +87,6 @@ function podfileIOS(name, testAppRelPath) { return join( `require_relative '${testAppRelPath}/test_app'`, "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", `workspace '${name}.xcworkspace'`, "", `use_test_app!`, diff --git a/test/android-test-app/test-app-util.test.mjs b/test/android-test-app/test-app-util.test.mjs index dd564c855..00f51698f 100644 --- a/test/android-test-app/test-app-util.test.mjs +++ b/test/android-test-app/test-app-util.test.mjs @@ -95,97 +95,6 @@ describe("test-app-util.gradle", () => { match(stdout, /getApplicationId\(\) = com.contoso.application.id/); }); - it("getFlipperRecommendedVersion() returns `null` if unsupported", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperRecommendedVersion() = " + ext.getFlipperRecommendedVersion(file("${rootDir}/no-flipper")))', - ], - "no-flipper/node_modules/react-native/template/android/gradle.properties": - "", - }); - - equal(status, 0); - match(stdout, /getFlipperRecommendedVersion\(\) = null/); - }); - - it("getFlipperRecommendedVersion() returns version number if supported", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperRecommendedVersion() = " + ext.getFlipperRecommendedVersion(rootDir))', - ], - }); - - equal(status, 0); - match(stdout, /getFlipperRecommendedVersion\(\) = \d+\.\d+\.\d+/); - }); - - it("getFlipperVersion() returns `null` if unsupported", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperVersion() = " + ext.getFlipperVersion(file("${rootDir}/no-flipper")))', - ], - "no-flipper/node_modules/react-native/template/android/gradle.properties": - "", - }); - - equal(status, 0); - match(stdout, /getFlipperVersion\(\) = null/); - }); - - it("getFlipperVersion() returns recommended version if unset", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperVersion() = " + ext.getFlipperVersion(rootDir))', - ], - "gradle.properties": [ - "android.useAndroidX=true", - "android.enableJetifier=true", - "#FLIPPER_VERSION=0.0.0-test", - ], - }); - - equal(status, 0); - match(stdout, /getFlipperVersion\(\) = \d+\.\d+\.\d+/); - }); - - it("getFlipperVersion() returns user set version", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperVersion() = " + ext.getFlipperVersion(rootDir))', - ], - "gradle.properties": [ - "android.useAndroidX=true", - "android.enableJetifier=true", - "FLIPPER_VERSION=0.0.0-test", - ], - }); - - equal(status, 0); - match(stdout, /getFlipperVersion\(\) = 0.0.0-test/); - }); - - it("getFlipperVersion() returns null if disabled", async () => { - const { status, stdout } = await runGradle({ - "build.gradle": [ - ...buildGradle, - 'println("getFlipperVersion() = " + ext.getFlipperVersion(rootDir))', - ], - "gradle.properties": [ - "android.useAndroidX=true", - "android.enableJetifier=true", - "FLIPPER_VERSION=false", - ], - }); - - equal(status, 0); - match(stdout, /getFlipperVersion\(\) = null/); - }); - it("getPackageVersionNumber() returns `react-native` version as a number", async () => { const { status, stdout } = await runGradle({ "build.gradle": [ diff --git a/test/configure/gatherConfig.test.mjs b/test/configure/gatherConfig.test.mjs index db7a1ad92..451c4c1c9 100644 --- a/test/configure/gatherConfig.test.mjs +++ b/test/configure/gatherConfig.test.mjs @@ -111,8 +111,6 @@ describe("gatherConfig()", () => { "ios/Podfile": join( "require_relative '../../test_app'", "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", "workspace 'Test.xcworkspace'", "", "use_test_app!", @@ -296,8 +294,6 @@ describe("gatherConfig()", () => { "ios/Podfile": join( "require_relative '../../test_app'", "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", "workspace 'Test.xcworkspace'", "", "use_test_app!", @@ -424,8 +420,6 @@ describe("gatherConfig()", () => { "ios/Podfile": join( "require_relative '../../test_app'", "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", "workspace 'Test.xcworkspace'", "", "use_test_app!", @@ -493,8 +487,6 @@ describe("gatherConfig()", () => { Podfile: join( "require_relative '../test_app'", "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", "workspace 'Test.xcworkspace'", "", "use_test_app!", @@ -610,8 +602,6 @@ describe("gatherConfig()", () => { "ios/Podfile": join( "require_relative '../../test_app'", "", - "use_flipper! false unless ENV['USE_FLIPPER'] == '1'", - "", "workspace 'Test.xcworkspace'", "", "use_test_app!", diff --git a/test/pack.test.mjs b/test/pack.test.mjs index 1695f73a1..3d88bf065 100644 --- a/test/pack.test.mjs +++ b/test/pack.test.mjs @@ -34,7 +34,6 @@ describe("npm pack", () => { "android/app/src/devserverhelper-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", "android/app/src/devserverhelper-pre-0.73/java/com/microsoft/reacttestapp/react/DevServerHelperCompat.kt", "android/app/src/fabric/java/com/microsoft/reacttestapp/fabric/FabricJSIModulePackage.kt", - "android/app/src/flipper/java/com/microsoft/reacttestapp/ReactNativeFlipper.kt", "android/app/src/main/AndroidManifest.xml", "android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt", "android/app/src/main/java/com/microsoft/reacttestapp/Session.kt", diff --git a/test/test_test_app.rb b/test/test_test_app.rb index 4a6915a95..644911483 100644 --- a/test/test_test_app.rb +++ b/test/test_test_app.rb @@ -42,43 +42,6 @@ def test_autolink_script_path end end - def test_flipper_enabled? - assert_predicate(self, :flipper_enabled?) - - use_flipper!(false) - - refute_predicate(self, :flipper_enabled?) - - use_flipper! - - assert_predicate(self, :flipper_enabled?) - ensure - use_flipper!(nil) - end - - def test_flipper_versions - assert_empty(flipper_versions) - - use_flipper!(false) - - refute(flipper_versions) - - versions = { 'Flipper' => '~> 0.41.1' } - use_flipper!(versions) - - assert_equal(versions, flipper_versions) - - use_flipper! - - assert_empty(flipper_versions) - - use_flipper!(false) - - refute(flipper_versions) - ensure - use_flipper!(nil) - end - def test_nearest_node_modules expected = fixture_path('test_app', 'node_modules')