Skip to content

Commit

Permalink
feat(core): refactor logger
Browse files Browse the repository at this point in the history
  • Loading branch information
churchill-zhang committed May 17, 2021
1 parent da12e1c commit d3a6f0d
Show file tree
Hide file tree
Showing 58 changed files with 1,849 additions and 647 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ build/

# core
core/ARM
.vs/
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.tencent.mtt.hippy.bridge;

import com.tencent.mtt.hippy.utils.LogUtils;

public class HippyLogger {
void Call(String str) {
LogUtils.e("HippyCore", str);
}
}
5 changes: 4 additions & 1 deletion android/sdk/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ else()
endif()
message("ABI_COMPILE_OPTIONS: ${ABI_COMPILE_OPTIONS}")

add_definitions("-DANDROID")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../../core/third_party/base out)

add_definitions("-DOS_ANDROID")
add_compile_options(${ABI_COMPILE_OPTIONS})
Expand Down Expand Up @@ -101,6 +103,7 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${CORE_SRC_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/${V8_VERSION})
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${CORE_SRC_DIR}/third_party/base/include)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${ANDROID_ABI}")

Expand All @@ -113,7 +116,7 @@ set_target_properties(libmtt_shared PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURC
set(HIPPY_TARGET_NAME "hippybridge")

add_library(${HIPPY_TARGET_NAME} SHARED ${CORE_SRC} ${URL_PARSER_SRC} ${JNI_SRC})
target_link_libraries(${HIPPY_TARGET_NAME} android log libmttv8 libmtt_shared)
target_link_libraries(${HIPPY_TARGET_NAME} android log libmttv8 libmtt_shared tdf_base)

#add_custom_command(TARGET ${HIPPY_TARGET_NAME} POST_BUILD
# COMMAND "${CMAKE_STRIP}" -g -S -d --strip-debug --verbose
Expand Down
2 changes: 2 additions & 0 deletions android/sdk/src/main/jni/include/bridge/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
namespace hippy {
namespace bridge {

void InitLogger(JNIEnv* j_env, jobject j_object, jobject j_logger);

jlong InitInstance(JNIEnv* j_env,
jobject j_object,
jbyteArray j_global_config,
Expand Down
6 changes: 3 additions & 3 deletions android/sdk/src/main/jni/include/jni/jni_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class JNIEnvironment {
public:
struct JemthodID_Wrapper {
struct JNIWrapper {
jmethodID call_natives_direct_method_id = nullptr;
jmethodID call_natives_method_id = nullptr;
jmethodID report_exception_method_id = nullptr;
Expand All @@ -45,7 +45,7 @@ class JNIEnvironment {
JNIEnvironment() = default;
~JNIEnvironment() = default;

inline JemthodID_Wrapper GetMethods() { return wrapper_; }
inline JNIWrapper GetMethods() { return wrapper_; }
void init(JavaVM* vm, JNIEnv* env);
JNIEnv* AttachCurrentThread();
void DetachCurrentThread();
Expand All @@ -55,5 +55,5 @@ class JNIEnvironment {
static std::mutex mutex_;

JavaVM* j_vm_;
JemthodID_Wrapper wrapper_;
JNIWrapper wrapper_;
};
Loading

0 comments on commit d3a6f0d

Please sign in to comment.