Skip to content

Commit 6f75f14

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Revert ENABLE_HERMES_PROFILER flag in cocoapods (#37228)
Summary: Pull Request resolved: #37228 As discussed offline, the current approach for the Hermes profiler is not the right one. I'm partially reverting [the commit](dce9d8d) which introduced it. The commit did also a bit of refactoring to improve the quality of the cocoapods scripts we would like to keep. ## Changelog: [iOS][Removed] - Remove support of Hermes profiler as that's not the right approach. Reviewed By: cortinico Differential Revision: D45527507 fbshipit-source-id: acea5f8b610d8b67ee7a6a91993bb8e4592d093f
1 parent 1cd0f57 commit 6f75f14

File tree

3 files changed

+3
-81
lines changed

3 files changed

+3
-81
lines changed

packages/react-native/scripts/cocoapods/__tests__/utils-test.rb

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -677,74 +677,6 @@ def test_applyFlagsForFabric_whenFabricDisabled_doNothing
677677
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)")
678678
end
679679
end
680-
681-
# ============================= #
682-
# Test - Enable Hermes Profiler #
683-
# ============================= #
684-
685-
def test_enableHermesProfiler_whenEnableHermesProfileIsTrue_setsFlagsInRelease
686-
# Arrange
687-
first_target = prepare_target("FirstTarget")
688-
second_target = prepare_target("SecondTarget")
689-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
690-
user_project_mock = UserProjectMock.new("a/path", [
691-
prepare_config("Debug"),
692-
prepare_config("Release"),
693-
],
694-
:native_targets => [
695-
first_target,
696-
second_target
697-
]
698-
)
699-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
700-
installer = InstallerMock.new(pods_projects_mock, [
701-
AggregatedProjectMock.new(user_project_mock)
702-
])
703-
704-
# Act
705-
ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: true)
706-
707-
# Assert
708-
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
709-
target_installation_result.native_target.build_configurations.each do |config|
710-
if config.name != "Release"
711-
assert_nil(config.build_settings["OTHER_CFLAGS"])
712-
else
713-
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited) -DRCT_REMOTE_PROFILE=1")
714-
end
715-
end
716-
end
717-
end
718-
719-
def test_enableHermesProfiler_whenEnableHermesProfileIsFalse_doesNothing
720-
# Arrange
721-
first_target = prepare_target("FirstTarget")
722-
second_target = prepare_target("SecondTarget")
723-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
724-
user_project_mock = UserProjectMock.new("a/path", [
725-
prepare_config("Debug"),
726-
prepare_config("Release"),
727-
],
728-
:native_targets => [
729-
first_target,
730-
second_target
731-
]
732-
)
733-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
734-
installer = InstallerMock.new(pods_projects_mock, [
735-
AggregatedProjectMock.new(user_project_mock)
736-
])
737-
738-
# Act
739-
ReactNativePodsUtils.enable_hermes_profiler(installer)
740-
741-
# Assert
742-
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
743-
target_installation_result.native_target.build_configurations.each do |config|
744-
assert_nil(config.build_settings["OTHER_CFLAGS"])
745-
end
746-
end
747-
end
748680
end
749681

750682
# ===== #

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,6 @@ def self.update_search_paths(installer)
220220
end
221221
end
222222

223-
def self.enable_hermes_profiler(installer, enable_hermes_profiler: false)
224-
return if !enable_hermes_profiler
225-
226-
Pod::UI.puts "[Hermes Profiler] Enable Hermes Sample profiler"
227-
self.add_compiler_flag_to_pods(installer, "-DRCT_REMOTE_PROFILE=1", configuration: "Release")
228-
end
229-
230223
# ========= #
231224
# Utilities #
232225
# ========= #

packages/react-native/scripts/react_native_pods.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,10 @@ def use_flipper!(versions = {}, configurations: ['Debug'])
222222
# - mac_catalyst_enabled: whether we are running the Pod on a Mac Catalyst project or not.
223223
# - enable_hermes_profiler: whether the hermes profiler should be turned on in Release mode
224224
def react_native_post_install(
225-
installer, react_native_path = "../node_modules/react-native",
226-
mac_catalyst_enabled: false,
227-
enable_hermes_profiler: false
225+
installer,
226+
react_native_path = "../node_modules/react-native",
227+
mac_catalyst_enabled: false
228228
)
229-
enable_hermes_profiler = enable_hermes_profiler || ENV["ENABLE_HERMES_PROFILER"] == "1"
230229
ReactNativePodsUtils.turn_off_resource_bundle_react_core(installer)
231230

232231
ReactNativePodsUtils.apply_mac_catalyst_patches(installer) if mac_catalyst_enabled
@@ -242,13 +241,11 @@ def react_native_post_install(
242241
ReactNativePodsUtils.update_search_paths(installer)
243242
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
244243
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
245-
ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: enable_hermes_profiler)
246244

247245
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
248246
is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
249247
NewArchitectureHelper.modify_flags_for_new_architecture(installer, is_new_arch_enabled)
250248

251-
252249
Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green
253250
end
254251

0 commit comments

Comments
 (0)