Files
react-native/scripts/cocoapods/__tests__/test_utils/FileUtilsMock.rb
T
Riccardo Cipolleschi 1b7127bb05 Improve Codegen Cleanup (#35642)
Summary:
This PR adds a safety check in case the Cocoapod build script is not able to clean the build folder.
We had evidences where this process failed, and in this way the user has a clear and actionable message to fix its situation.

## Changelog

[iOS][Added] - Add message with instructions about what to do if the cleanup of the build folder fails.

Pull Request resolved: https://github.com/facebook/react-native/pull/35642

Test Plan:
I was not able to reproduce the issue locally.
The fix is not destructive, let's see if the amount of issues decreases.

Reviewed By: dmytrorykun

Differential Revision: D42067939

Pulled By: cipolleschi

fbshipit-source-id: 433dbfaec42a1bf460dc9a48051aa51ec6e12d16
2022-12-16 04:47:01 -08:00

41 lines
970 B
Ruby

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require_relative './DirMock.rb'
module FileUtils
class FileUtilsStorage
@@RMRF_INVOCATION_COUNT = 0
@@RMRF_PATHS = []
def self.rmrf_invocation_count
return @@RMRF_INVOCATION_COUNT
end
def self.increase_rmrfi_invocation_count
@@RMRF_INVOCATION_COUNT += 1
end
def self.rmrf_paths
return @@RMRF_PATHS
end
def self.push_rmrf_path(path)
@@RMRF_PATHS.push(path)
end
def self.reset
@@RMRF_INVOCATION_COUNT = 0
@@RMRF_PATHS = []
end
end
def self.rm_rf(path)
FileUtilsStorage.push_rmrf_path(path)
FileUtilsStorage.increase_rmrfi_invocation_count
Dir.remove_mocked_paths(path)
end
end