Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previously discussed, I would keep the old flags for previous versions, and only change them for the newer ones.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, we don't set this flags in any other podspec on the SDK. I also ran the E2E suite against this PR and it builds properly even on RN 0.65.


Pod::Spec.new do |s|
s.name = "DatadogSDKReactNativeSessionReplay"
Expand Down Expand Up @@ -49,17 +48,22 @@ Pod::Spec.new do |s|
}

if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.compiler_flags = "-DRCT_NEW_ARCH_ENABLED=1"

xcconfig.merge!({
"DEFINES_MODULE" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
})
end

s.pod_target_xcconfig = xcconfig
s.pod_target_xcconfig = xcconfig

if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
# install_modules_dependencies is only available on RN >= 0.71
if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
else
Pod::UI.warn "Using Datadog React Native Session Replay with new architecture on RN < 0.71 is discouraged and not officially supported."
end
else
s.pod_target_xcconfig = xcconfig
end
end
15 changes: 11 additions & 4 deletions packages/react-native-session-replay/src/metro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import path from 'path';
import { mergeSvgAssets } from './processing';
import { debounce } from './utils';

let watching = false;
let watcher: ReturnType<typeof chokidar.watch> | null = null;

const MERGE_DEBOUNCE_MS = 300;
const WATCH_STABILITY_THRESHOLD_MS = 200;
Expand All @@ -38,9 +38,8 @@ export function withSessionReplayAssetBundler(metroConfig: any): any {
}, MERGE_DEBOUNCE_MS);

// Prevent potential multiple watchers if metro loads the config multiple times
if (!watching) {
watching = true;
chokidar
if (!watcher) {
watcher = chokidar
.watch(assetsDir, {
// Skip events for files that already exist
ignoreInitial: true,
Expand Down Expand Up @@ -75,6 +74,14 @@ export function withSessionReplayAssetBundler(metroConfig: any): any {
event.type === 'transformer_load_done'
) {
mergeSvgAssets(assetsDir);

// Close the file watcher after bundling completes
// This prevents the chokidar watcher from keeping the
// Node process alive during release/CI builds
if (watcher) {
watcher.close();
watcher = null;
Comment thread
sbarrio marked this conversation as resolved.
}
}
}
}
Expand Down
Loading