@@ -38,13 +38,15 @@ class RNTarget: BaseTarget {
3838 let dependencies : [ String ]
3939 let sources : [ String ] ?
4040 let publicHeadersPath : String ?
41+ let defines : [ CXXSetting ]
4142
42- init ( name: String , path: String , searchPaths: [ String ] = [ ] , linkedFrameworks: [ String ] = [ ] , excludedPaths: [ String ] = [ ] , dependencies: [ String ] = [ ] , sources: [ String ] ? = nil , publicHeadersPath: String ? = " . " ) {
43+ init ( name: String , path: String , searchPaths: [ String ] = [ ] , linkedFrameworks: [ String ] = [ ] , excludedPaths: [ String ] = [ ] , dependencies: [ String ] = [ ] , sources: [ String ] ? = nil , publicHeadersPath: String ? = " . " , defines : [ CXXSetting ] = [ ] ) {
4344 self . linkedFrameworks = linkedFrameworks
4445 self . excludedPaths = excludedPaths
4546 self . dependencies = dependencies
4647 self . sources = sources
4748 self . publicHeadersPath = publicHeadersPath
49+ self . defines = defines
4850
4951 super. init ( name: name, path: path, searchPaths: searchPaths)
5052 }
@@ -65,7 +67,8 @@ class RNTarget: BaseTarget {
6567 dependencies: self . dependencies,
6668 sources: self . sources,
6769 publicHeadersPath: self . publicHeadersPath,
68- linkerSettings: linkerSettings
70+ linkerSettings: linkerSettings,
71+ defines: self . defines
6972 )
7073 }
7174}
@@ -165,15 +168,23 @@ let reactJsInspectorNetwork = RNTarget(
165168 name: . reactJsInspectorNetwork,
166169 path: " ReactCommon/jsinspector-modern/network " ,
167170 searchPaths: [ " ReactCommon " , RuntimeExecutorPath] ,
168- dependencies: [ . reactNativeDependencies]
171+ dependencies: [ . reactNativeDependencies] ,
172+ defines: [
173+ CXXSetting . define ( " REACT_NATIVE_DEBUGGER_ENABLED " , to: " 1 " , . when( configuration: BuildConfiguration . debug) ) ,
174+ CXXSetting . define ( " REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY " , to: " 1 " , . when( configuration: BuildConfiguration . debug) ) ,
175+ ]
169176)
170177
171178let reactJsInspector = RNTarget (
172179 name: . reactJsInspector,
173180 path: " ReactCommon/jsinspector-modern " ,
174181 searchPaths: [ " ReactCommon " , RuntimeExecutorPath] ,
175182 excludedPaths: [ " tracing " , " network " , " tests " ] ,
176- dependencies: [ . reactNativeDependencies, . reactFeatureFlags, . jsi, . reactJsInspectorTracing, . reactJsInspectorNetwork]
183+ dependencies: [ . reactNativeDependencies, . reactFeatureFlags, . jsi, . reactJsInspectorTracing, . reactJsInspectorNetwork] ,
184+ defines: [
185+ CXXSetting . define ( " REACT_NATIVE_DEBUGGER_ENABLED " , to: " 1 " , . when( configuration: BuildConfiguration . debug) ) ,
186+ CXXSetting . define ( " REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY " , to: " 1 " , . when( configuration: BuildConfiguration . debug) ) ,
187+ ]
177188)
178189
179190let reactCxxReact = RNTarget (
@@ -203,7 +214,10 @@ let reactHermes = RNTarget(
203214 path: " ReactCommon/hermes " ,
204215 searchPaths: [ " ReactCommon " , RuntimeExecutorPath] ,
205216 excludedPaths: [ " inspector-modern/chrome/tests " ] ,
206- dependencies: [ . reactNativeDependencies, . reactCxxReact, . reactJsiExecutor, . reactJsInspector, . reactJsInspectorTracing, . reactPerfLogger, . hermesPrebuilt, . jsi]
217+ dependencies: [ . reactNativeDependencies, . reactCxxReact, . reactJsiExecutor, . reactJsInspector, . reactJsInspectorTracing, . reactPerfLogger, . hermesPrebuilt, . jsi] ,
218+ defines: [
219+ CXXSetting . define ( " HERMES_ENABLE_DEBUGGER " , to: " 1 " , . when( configuration: BuildConfiguration . debug) )
220+ ]
207221)
208222
209223let reactPerformanceTimeline = RNTarget (
@@ -331,7 +345,7 @@ let reactRuntimeApple = RNTarget(
331345 path: " ReactCommon/react/runtime/platform/ios " ,
332346 searchPaths: [ " ReactCommon " , RuntimeExecutorPath, CallInvokerPath, ReactFBReactNativeSpecPath, FBLazyVectorPath] ,
333347 excludedPaths: [ " ReactCommon/RCTJscInstance.mm " ] ,
334- dependencies: [ . reactNativeDependencies, . jsi, . reactPerfLogger, . reactCxxReact, . rctDeprecation, . yoga, . reactRuntime, . reactRCTFabric, . reactCoreModules, . reactTurboModuleCore, . hermesPrebuilt]
348+ dependencies: [ . reactNativeDependencies, . jsi, . reactPerfLogger, . reactCxxReact, . rctDeprecation, . yoga, . reactRuntime, . reactRCTFabric, . reactCoreModules, . reactTurboModuleCore, . hermesPrebuilt, . reactUtils ]
335349)
336350
337351let reactCore = RNTarget (
@@ -454,7 +468,7 @@ let reactRCTAnimation = RNTarget(
454468 name: . reactRCTAnimation,
455469 path: " Libraries/NativeAnimation " ,
456470 searchPaths: [ " ReactCommon " , ReactFBReactNativeSpecPath, FBLazyVectorPath, CallInvokerPath] ,
457- dependencies: [ . rctTypesafety, . jsi, . reactFeatureFlags, . yoga, . reactTurboModuleCore]
471+ dependencies: [ . reactNativeDependencies , . rctTypesafety, . jsi, . reactFeatureFlags, . yoga, . reactTurboModuleCore, . reactUtils ]
458472)
459473
460474let reactRCTImage = RNTarget (
@@ -648,7 +662,8 @@ extension Target {
648662 dependencies: [ String ] = [ ] ,
649663 sources: [ String ] ? = nil ,
650664 publicHeadersPath: String ? = " . " ,
651- linkerSettings: [ LinkerSetting ] = [ ]
665+ linkerSettings: [ LinkerSetting ] = [ ] ,
666+ defines: [ CXXSetting ] = [ ]
652667 ) -> Target {
653668 let dependencies = dependencies. map { Dependency . byNameItem ( name: $0, condition: nil ) }
654669 let excludes = excludedPaths
@@ -666,10 +681,9 @@ extension Target {
666681 [
667682 . unsafeFlags( [ " -std=c++20 " ] ) ,
668683 . define( " DEBUG " , . when( configuration: . debug) ) ,
684+ . define( " NDEBUG " , . when( configuration: . release) ) ,
669685 . define( " USE_HERMES " , to: " 1 " ) ,
670- // TODO: T223727527 Why doesn't it pick up this when DEBUG is set??
671- . define( " RCT_ENABLE_INSPECTOR " , to: " 1 " , . when( configuration: . debug) ) ,
672- ] + cxxCommonHeaderPaths
686+ ] + defines + cxxCommonHeaderPaths
673687
674688 return . target(
675689 name: name,
0 commit comments