Skip to content

Commit

Permalink
Remove RCTExportModule log spam
Browse files Browse the repository at this point in the history
Summary:
The bridge complains if modules aren't exported, which isn't really helpful with lazily loaded modules and turbo modules.

I considered only turning this off when TurboModules is enabled, but figured we'd be killing this soon anyways... If anyone feels strongly I can go that approach.

Changelog: [iOS][Internal] Remove RCTExportModule log spam

Reviewed By: shergin

Differential Revision: D20629575

fbshipit-source-id: d32d9fe244c4d06acfee982fca7c7f63da294dc5
  • Loading branch information
Peter Argany authored and facebook-github-bot committed Mar 25, 2020
1 parent 56b0f5c commit 421bc5f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
5 changes: 0 additions & 5 deletions React/Base/RCTBridge+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
@protocol RCTJavaScriptExecutor;

RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);

#if RCT_DEBUG
RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules);
#endif

RCT_EXTERN void RCTRegisterModule(Class);

@interface RCTBridge ()
Expand Down
47 changes: 0 additions & 47 deletions React/Base/RCTBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,53 +113,6 @@ void RCTEnableTurboModule(BOOL enabled)
turboModuleEnabled = enabled;
}

#if RCT_DEBUG
void RCTVerifyAllModulesExported(NSArray *extraModules)
{
// Check for unexported modules
unsigned int classCount;
Class *classes = objc_copyClassList(&classCount);

NSMutableSet *moduleClasses = [NSMutableSet new];
[moduleClasses addObjectsFromArray:RCTGetModuleClasses()];
[moduleClasses addObjectsFromArray:[extraModules valueForKeyPath:@"class"]];

for (unsigned int i = 0; i < classCount; i++) {
Class cls = classes[i];
if (strncmp(class_getName(cls), "RCTCxxModule", strlen("RCTCxxModule")) == 0) {
continue;
}
Class superclass = cls;
while (superclass) {
if (class_conformsToProtocol(superclass, @protocol(RCTBridgeModule))) {
if ([moduleClasses containsObject:cls]) {
break;
}

// Verify it's not a super-class of one of our moduleClasses
BOOL isModuleSuperClass = NO;
for (Class moduleClass in moduleClasses) {
if ([moduleClass isSubclassOfClass:cls]) {
isModuleSuperClass = YES;
break;
}
}
if (isModuleSuperClass) {
break;
}

// Note: Some modules may be lazily loaded and not exported up front, so this message is no longer a warning.
RCTLogInfo(@"Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?", cls);
break;
}
superclass = class_getSuperclass(superclass);
}
}

free(classes);
}
#endif

@interface RCTBridge () <RCTReloadListener>
@end

Expand Down
7 changes: 0 additions & 7 deletions React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,6 @@ - (void)registerExtraModules

RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");

#if RCT_DEBUG
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
RCTVerifyAllModulesExported(extraModules);
});
#endif

RCT_PROFILE_BEGIN_EVENT(
RCTProfileTagAlways, @"-[RCTCxxBridge initModulesWithDispatchGroup:] preinitialized moduleData", nil);
// Set up moduleData for pre-initialized module instances
Expand Down

0 comments on commit 421bc5f

Please sign in to comment.