Skip to content

Commit

Permalink
feat(android): modify the V8 inspector macro definition (#1889)
Browse files Browse the repository at this point in the history
* feat(android): remove unused visual studio project

* feat(android): modify the V8 inspector macro definition
  • Loading branch information
medns authored May 23, 2022
1 parent d629605 commit f78f2ca
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 558 deletions.
14 changes: 5 additions & 9 deletions driver/js/android/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ set(INFA_PACKAGES_URL "https://hippy-packages-1258344701.cos.accelerate.myqcloud
set(INFA_PACKAGES_DOMAIN "hippy")

# region v8
set(ENABLE_INSPECTOR true)
if (${JS_ENGINE} STREQUAL "V8")
get_filename_component(V8_COMPONENT_PATH ${V8_COMPONENT} ABSOLUTE)
if (EXISTS "${V8_COMPONENT_PATH}/CMakeLists.txt")
Expand All @@ -123,20 +122,12 @@ add_subdirectory(${RENDER_DIR}/native/android/src/main/jni ${CMAKE_CURRENT_BINAR


# region global definitions
if (${ENABLE_INSPECTOR} STREQUAL "true")
add_definitions("-DENABLE_INSPECTOR")
endif()
add_definitions("-DOS_ANDROID")
add_definitions("-DANDROID_NATIVE_RENDER")
# endregion

# region source
file(GLOB_RECURSE CORE_SRC ${CORE_SRC_DIR}/src/*.cc)
file(GLOB_RECURSE JNI_SRC ${PROJECT_SOURCE_DIR}/src/*.cc)
if (${ENABLE_INSPECTOR} STREQUAL "false")
file(GLOB_RECURSE INSPECTOR_SRC ${CORE_SRC_DIR}/src/runtime/v8/inspector/*)
list(REMOVE_ITEM CORE_SRC ${INSPECTOR_SRC})
endif()

message("CORE_SRC_DIR: ${CORE_SRC_DIR}")
message("CORE_SRC: ${CORE_SRC}")
Expand All @@ -148,6 +139,11 @@ set(HIPPY_DEPS android log tdf_base tdf_base_common native_render dom)
message("JS_ENGINE:" ${JS_ENGINE})
if (${JS_ENGINE} STREQUAL "V8")
add_definitions("-DJS_V8")
if (DEFINED V8_WITHOUT_INSPECTOR)
add_definitions("-DV8_WITHOUT_INSPECTOR")
file(GLOB_RECURSE INSPECTOR_SRC ${CORE_SRC_DIR}/src/runtime/v8/inspector/*)
list(REMOVE_ITEM CORE_SRC ${INSPECTOR_SRC})
endif()
# region remove jsc code
file(GLOB_RECURSE JSC_SRC ${CORE_SRC_DIR}/src/napi/jsc/*)
message("JSC_SRC: ${JSC_SRC}")
Expand Down
59 changes: 0 additions & 59 deletions driver/js/android/src/main/jni/HippyAndroidSdk.sln

This file was deleted.

224 changes: 0 additions & 224 deletions driver/js/android/src/main/jni/HippyAndroidSdk.vcxproj

This file was deleted.

15 changes: 0 additions & 15 deletions driver/js/android/src/main/jni/HippyAndroidSdk.vcxproj.user

This file was deleted.

2 changes: 1 addition & 1 deletion driver/js/android/src/main/jni/include/bridge/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace hippy {
public:
ADRBridge(JNIEnv* j_env, jobject j_obj): ref_(std::make_shared<JavaRef>(j_env, j_obj)){}
virtual ~ADRBridge() = default;
#ifdef ENABLE_INSPECTOR
#ifndef V8_WITHOUT_INSPECTOR
virtual void SendResponse(std::unique_ptr<v8_inspector::StringBuffer> message) override;
virtual void SendNotification(std::unique_ptr<v8_inspector::StringBuffer> message) override;
#endif
Expand Down
2 changes: 1 addition & 1 deletion driver/js/android/src/main/jni/include/hippy.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "jni/jni_utils.h"
#include "jni/scoped_java_ref.h"
#include "loader/adr_loader.h"
#ifdef ENABLE_INSPECTOR
#ifndef V8_WITHOUT_INSPECTOR
#include "core/runtime/v8/inspector/v8_channel_impl.h"
#include "core/runtime/v8/inspector/v8_inspector_client_impl.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion driver/js/android/src/main/jni/src/bridge/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace hippy {

#ifdef ENABLE_INSPECTOR
#ifndef V8_WITHOUT_INSPECTOR
void ADRBridge::SendResponse(std::unique_ptr<v8_inspector::StringBuffer> message) {
if (message->string().is8Bit()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion driver/js/android/src/main/jni/src/bridge/java2js.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

namespace hippy::runtime {

#ifdef ENABLE_INSPECTOR
#ifndef V8_WITHOUT_INSPECTOR
using V8InspectorClientImpl = hippy::inspector::V8InspectorClientImpl;
extern std::shared_ptr<V8InspectorClientImpl> global_inspector;
#endif
Expand Down
Loading

0 comments on commit f78f2ca

Please sign in to comment.