Skip to content

Commit

Permalink
Add REACT_NATIVE_PATH to tester build settings
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Oct 16, 2024
1 parent 47e63f1 commit addcdaa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/core/RNSentryCocoaTester/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,31 @@ target 'RNSentryCocoaTesterTests' do
)
pod 'RNSentry', :path => '../RNSentry.podspec'
pod 'OCMock', '3.9.1'

post_install do |installer|
set_react_native_path(installer)
end
end

def extract_projects(installer)
return installer.aggregate_targets
.map{ |t| t.user_project }
.uniq{ |p| p.path }
.push(installer.pods_project)
end

def set_react_native_path(installer)
# https://github.com/facebook/react-native/blob/9cc6f007ba1cf112466ccf685c0ef918bba69dd7/packages/react-native/scripts/react_native_pods.rb#L378
Pod::UI.puts("Setting REACT_NATIVE_PATH build settings")

projects = extract_projects(installer)

projects.each do |project|
project.build_configurations.each do |config|
if config_name == nil || config.name == config_name
config.build_settings["REACT_NATIVE_PATH"] = '${PODS_ROOT}/../../node_modules/react-native'
end
end
project.save()
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
};
name = Debug;
};
Expand Down Expand Up @@ -336,6 +337,7 @@
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
};
name = Release;
};
Expand Down Expand Up @@ -402,6 +404,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
};
name = Debug;
};
Expand Down Expand Up @@ -467,6 +470,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "RNSentryCocoaTesterTests/RNSentryCocoaTesterTests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
};
name = Release;
};
Expand Down

0 comments on commit addcdaa

Please sign in to comment.