Skip to content

Commit

Permalink
Remove ReanimatedHiddenHeaders, LoggerInterface and SpeedChecker (
Browse files Browse the repository at this point in the history
#6363)

## Summary

This PR removes some rusty and unused parts of the code like
`SpeedChecker` as well as removes `Logger` and `LoggerInterface` in
favor of static `PlatformLogger` which also enables us to finally get
rid of `ReanimatedHiddenHeaders` and `hidden_headers` along with its
configuration in `CMakeLists.txt` and `RNReanimated.podspec`.

## Test plan

---------

Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
  • Loading branch information
tomekzaw and tjzel committed Aug 1, 2024
1 parent 594479e commit f26aebb
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 198 deletions.
4 changes: 2 additions & 2 deletions apps/paper-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1614,11 +1614,11 @@ SPEC CHECKSUMS:
RNCPicker: 3e2c37a8328f368ce14da050cdc8231deb5fc9f9
RNFlashList: e9b57a5553639f9b528cc50ab53f25831722ed62
RNGestureHandler: 2282cfbcf86c360d29f44ace393203afd5c6cff7
RNReanimated: 771c92dd6787dd6f18889dea61ff423694bff638
RNReanimated: 82f65dd7f62b2ff629221e1887cd85b082dbe5a0
RNScreens: 52f2565581af64b1b410d49784cf8342ed94ca28
RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 56f906bf6c11c931588191dde1229fd3e4e3d557
Yoga: ff1d575b119f510a5de23c22a794872562078ccf

PODFILE CHECKSUM: 746b518f69244f6a3f6b04dabf476339073cb5fe

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "CollectionUtils.h"
#include "EventHandlerRegistry.h"
#include "FeaturesConfig.h"
#include "ReanimatedHiddenHeaders.h"
#include "Shareables.h"
#include "UIRuntimeDecorator.h"
#include "WorkletEventHandler.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <string>

namespace reanimated {

class PlatformLogger {
public:
static void log(const char *str);
static void log(const std::string &str);
static void log(const double d);
static void log(const int i);
static void log(const bool b);
};

} // namespace reanimated

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#include "WorkletRuntimeDecorator.h"
#include "JSISerializer.h"
#include "PlatformLogger.h"
#include "ReanimatedJSIUtils.h"
#include "Shareables.h"
#include "WorkletRuntime.h"

#include <vector>

#ifdef ANDROID
#include "Logger.h"
#else
#include "Common/cpp/Worklets/hidden_headers/Logger.h"
#endif

namespace reanimated {

static inline double performanceNow() {
Expand Down Expand Up @@ -73,7 +68,7 @@ void WorkletRuntimeDecorator::decorate(

jsi_utils::installJsiFunction(
rt, "_log", [](jsi::Runtime &rt, const jsi::Value &value) {
Logger::log(stringifyJSIValue(rt, value));
PlatformLogger::log(stringifyJSIValue(rt, value));
});

jsi_utils::installJsiFunction(
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions packages/react-native-reanimated/RNReanimated.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ Pod::Spec.new do |s|
ss.source_files = [
"Common/cpp/worklets/**/*.{cpp,h}",
]
ss.preserve_paths = [
"Common/cpp/worklets/hidden_headers/**"
]
end

gcc_debug_definitions = "$(inherited)"
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "LayoutAnimations.h"
#include <vector>
#include "FeaturesConfig.h"
#include "Logger.h"

namespace reanimated {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "AndroidUIScheduler.h"
#include "LayoutAnimations.h"
#include "Logger.h"
#include "NativeProxy.h"

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <android/log.h>

#include "PlatformLogger.h"

constexpr const auto tag = "Reanimated";

namespace reanimated {

void PlatformLogger::log(const char *str) {
__android_log_print(ANDROID_LOG_VERBOSE, tag, "%s", str);
}

void PlatformLogger::log(const std::string &str) {
log(str.c_str());
}

void PlatformLogger::log(const double d) {
__android_log_print(ANDROID_LOG_VERBOSE, tag, "%f", d);
}

void PlatformLogger::log(const int i) {
__android_log_print(ANDROID_LOG_VERBOSE, tag, "%d", i);
}

void PlatformLogger::log(const bool b) {
log(b ? "true" : "false");
}

} // namespace reanimated
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ add_library(
worklets
SHARED
${WORKLETS_COMMON_SOURCES}
"${ANDROID_SRC_DIR}/main/cpp/AndroidLogger.cpp"
"${ANDROID_SRC_DIR}/main/cpp/PlatformLogger.cpp"
)

# includes
target_include_directories(
worklets
PUBLIC
"${WORKLETS_COMMON_DIR}/hidden_headers"
"${WORKLETS_COMMON_DIR}/Registries"
"${WORKLETS_COMMON_DIR}/SharedItems"
"${WORKLETS_COMMON_DIR}/Tools"
Expand Down
31 changes: 31 additions & 0 deletions packages/react-native-reanimated/apple/native/PlatformLogger.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#import <Foundation/Foundation.h>
#import <RNReanimated/PlatformLogger.h>

namespace reanimated {

void PlatformLogger::log(const char *str)
{
NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]);
}

void PlatformLogger::log(const std::string &str)
{
log(str.c_str());
}

void PlatformLogger::log(const double d)
{
NSLog(@"%lf", d);
}

void PlatformLogger::log(const int i)
{
NSLog(@"%i", i);
}

void PlatformLogger::log(const bool b)
{
log(b ? "true" : "false");
}

} // namespace reanimated
15 changes: 0 additions & 15 deletions packages/react-native-reanimated/apple/native/REAIOSLogger.h

This file was deleted.

33 changes: 0 additions & 33 deletions packages/react-native-reanimated/apple/native/REAIOSLogger.mm

This file was deleted.

0 comments on commit f26aebb

Please sign in to comment.