diff --git a/ReactNativeNavigation.podspec b/ReactNativeNavigation.podspec index f189f90792..0443e6d002 100644 --- a/ReactNativeNavigation.podspec +++ b/ReactNativeNavigation.podspec @@ -1,19 +1,26 @@ require 'json' +require 'find' package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' # Detect if this is a Swift project by looking for user AppDelegate.swift files -dependency_paths = ['/node_modules/', '/Pods/', '/build/', '/Build/', '/DerivedData/'] -swift_project = Dir.glob('**/AppDelegate.swift') - .reject { |file| dependency_paths.any? { |path| file.include?(path) } } - .any? +start_dir = File.expand_path('../../', __dir__) +swift_delegate_path = nil +Find.find(start_dir) do |path| + if path =~ /AppDelegate\.swift$/ + swift_delegate_path = path + break + end +end + +swift_project = File.exist?(swift_delegate_path) # Debug output if swift_project puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration" -else +else puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration" end @@ -43,19 +50,19 @@ Pod::Spec.new do |s| end folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DFOLLY_CFG_NO_COROUTINES=1' - + # Base xcconfig settings xcconfig_settings = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"', "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", } - + # Only add DEFINES_MODULE for Swift projects if swift_project xcconfig_settings["DEFINES_MODULE"] = "YES" end - + s.pod_target_xcconfig = xcconfig_settings if fabric_enabled