Removed static bool from +[FBWeakFrameworkLoader loadPrivateFrameworks:...]
Summary:This method is used by FBSimulatorControl and XCTestBoostrap so we can't used static BOOL inside it to prevent multiple loads. Added dispatch_once in FBSimulatorControl when calling it instead. Reviewed By: nqmtuan Differential Revision: D3144331 fb-gh-sync-id: 0822386d20a0fa9d0c4fd23e220d86d6e4369ee3 fbshipit-source-id: 0822386d20a0fa9d0c4fd23e220d86d6e4369ee3
This commit is contained in:
Родитель
8c2c26504b
Коммит
6b21c8e8c5
|
@ -26,11 +26,6 @@
|
|||
// 5) Provide a sanity check that any preloaded Private Frameworks match the current xcode-select version
|
||||
+ (BOOL)loadPrivateFrameworks:(NSArray<FBWeakFramework *> *)weakFrameworks logger:(id<FBControlCoreLogger>)logger error:(NSError **)error
|
||||
{
|
||||
static BOOL hasLoaded = NO;
|
||||
if (hasLoaded) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// This will assert if the directory could not be found.
|
||||
NSString *developerDirectory = FBControlCoreGlobalConfiguration.developerDirectory;
|
||||
[logger logFormat:@"Using Developer Directory %@", developerDirectory];
|
||||
|
@ -49,7 +44,6 @@
|
|||
}
|
||||
|
||||
// We're done with loading Frameworks.
|
||||
hasLoaded = YES;
|
||||
[logger logFormat:@"Loaded All Private Frameworks %@", [FBCollectionInformation oneLineDescriptionFromArray:[weakFrameworks valueForKeyPath:@"@unionOfObjects.name"] atKeyPath:@"lastPathComponent"]];
|
||||
|
||||
return YES;
|
||||
|
|
|
@ -66,14 +66,17 @@
|
|||
|
||||
+ (void)loadPrivateFrameworksOrAbort
|
||||
{
|
||||
id<FBControlCoreLogger> logger = FBControlCoreGlobalConfiguration.defaultLogger;
|
||||
NSError *error = nil;
|
||||
BOOL success = [FBSimulatorControl loadPrivateFrameworks:logger.debug error:&error];
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
[logger.error logFormat:@"Failed to private frameworks for FBSimulatorControl with error %@", error];
|
||||
abort();
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
id<FBControlCoreLogger> logger = FBControlCoreGlobalConfiguration.defaultLogger;
|
||||
NSError *error = nil;
|
||||
BOOL success = [FBSimulatorControl loadPrivateFrameworks:logger.debug error:&error];
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
[logger.error logFormat:@"Failed to private frameworks for FBSimulatorControl with error %@", error];
|
||||
abort();
|
||||
});
|
||||
}
|
||||
|
||||
+ (BOOL)loadPrivateFrameworks:(id<FBControlCoreLogger>)logger error:(NSError **)error
|
||||
|
|
Загрузка…
Ссылка в новой задаче