Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): solve some problems of podspec #3789

Merged
merged 3 commits into from
Mar 26, 2024
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
7 changes: 0 additions & 7 deletions devtools/devtools-backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ GlobalPackages_Add(footstone)
target_link_libraries(${PROJECT_NAME} PRIVATE footstone)
# endregion

# region base64
InfraPackage_Add(base64
REMOTE "global_packages/base64/v0.5.0/git-repo.tgz"
LOCAL "third_party/base64")
target_link_libraries(${PROJECT_NAME} PRIVATE base64)
# endregion

# region asio
InfraPackage_Add(asio
REMOTE "devtools/backend/third_party/asio/1.22.1/asio.tar.gz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wextra"
#define ASIO_STANDALONE
#include "asio.hpp"
#include "websocketpp/client.hpp"
#include "websocketpp/config/asio_no_tls_client.hpp"
#pragma clang diagnostic pop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "footstone/logging.h"
#include "module/domain_register.h"
#include "nlohmann/json.hpp"
#include "libbase64.h"
#include "websocketpp/base64/base64.hpp"

namespace hippy::devtools {
constexpr char kResponseBody[] = "body";
Expand Down Expand Up @@ -53,9 +53,7 @@ void NetworkDomain::GetResponseBody(const NetworkResponseBodyRequest& request) {
auto body_data = response.GetBodyData();
response_json[kResponseBase64Encoded] = is_encode_base64;
if (is_encode_base64) {
size_t out_len = 4 * ((body_data.length() + 2) / 3);
std::string encode_body(out_len, '\0');
base64_encode(body_data.c_str(), body_data.length(), encode_body.data(), &out_len, 0);
std::string encode_body = websocketpp::base64_encode(body_data);
response_json[kResponseBody] = encode_body;
} else {
response_json[kResponseBody] = body_data;
Expand Down
2 changes: 1 addition & 1 deletion framework/examples/ios-demo/podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ENV["js_engine"] = "v8"

install! 'cocoapods',
:deterministic_uuids => false,
:deterministic_uuids => true,
:generate_multiple_pod_projects => true

use_frameworks! :linkage => :static # 静态库framework格式
Expand Down
73 changes: 34 additions & 39 deletions hippy.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,31 @@ Pod::Spec.new do |s|
puts 'hippy subspec \'yoga\' read end'
end
end



# Dependencies of devtools
devtools_deps_path = 'devtools/devtools-integration/ios/DevtoolsBackend/_deps'
s.subspec 'AsioForDevTools' do |ss|
ss.libraries = 'c++'
ss.public_header_files = ["#{devtools_deps_path}/asio-src/asio/include/**/*.{hpp,ipp}",]
ss.source_files = ["#{devtools_deps_path}/asio-src/asio/include/**/*.{hpp,ipp}",]
ss.header_mappings_dir = "#{devtools_deps_path}/asio-src/asio/include/"
end

s.subspec 'JsonForDevTools' do |ss|
ss.libraries = 'c++'
ss.public_header_files = ["#{devtools_deps_path}/json-src/single_include/**/*.{hpp}",]
ss.source_files = ["#{devtools_deps_path}/json-src/single_include/**/*.{hpp}",]
ss.header_mappings_dir = "#{devtools_deps_path}/json-src/single_include/"
end

s.subspec 'WebsocketForDevTools' do |ss|
ss.libraries = 'c++'
ss.public_header_files = ["#{devtools_deps_path}/websocketpp-src/websocketpp/**/*.{hpp}",]
ss.source_files = ["#{devtools_deps_path}/websocketpp-src/websocketpp/**/*.{hpp,ipp}",]
ss.header_mappings_dir = "#{devtools_deps_path}/websocketpp-src/"
end

#devtools subspec
s.subspec 'DevTools' do |devtools|
puts 'hippy subspec \'devtools\' read begin'
Expand All @@ -355,61 +379,29 @@ Pod::Spec.new do |s|
else
devtools_exclude_files += ['devtools/devtools-integration/native/include/devtools/v8', 'devtools/devtools-integration/native/src/v8']
end
devtools.exclude_files = [
#test files
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/**/*test*/**/*',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/**/*test*',
#benchmark files
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/**/benchmark/**',
#js files
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/**/javascript/**',
#Dom includes all taitank or yoga files, and Devtools dependends on Dom, so let Dom does the including work, otherwise, 'duplicated symbols' error occurs
#taitank or yoga files
#currently Devtools specify taitank layout
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/taitank-*/**/*',
#other files
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/lib_openmp.c',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/tables/table_generator.c',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/arch/**/{dec,enc}_*.c',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/bin/base64.c',
] + devtools_exclude_files
devtools.exclude_files = devtools_exclude_files
devtools.public_header_files = [
'devtools/devtools-integration/native/include/devtools/devtools_data_source.h',
#devtools_integration/native
'devtools/devtools-integration/native/**/*.h',
'devtools/devtools-integration/native/include/devtools/devtools_data_source.h',
#devtools_backend
'devtools/devtools-backend/**/*.{h,hpp}',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/*-src/**/*.{h,hpp,ipp}',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/tables/*.h',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-build/config.h',
]
devtools.source_files = [
#devtools_integration/native
'devtools/devtools-integration/native/**/*.{h,cc}',
#devtools_integration/ios
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/*-src/**/*.{h,hpp,c,cc,ipp}',
'devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-build/config.h',
#devtools_backend
'devtools/devtools-backend/**/*.{h,hpp,cc}',
]
if use_frameworks
pod_search_path = "#{framework_header_path}/devtools-integration/ios/DevtoolsBackend/_deps/asio-src/asio/include" +
" #{framework_header_path}/devtools-integration/ios/DevtoolsBackend/_deps/json-src/include" +
" #{framework_header_path}/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/include" +
" #{framework_header_path}/devtools-integration/ios/DevtoolsBackend/_deps/websocketpp-src" +
pod_search_path =
" #{framework_header_path}/devtools-integration/native/include" +
" #{framework_header_path}/devtools-backend/include" +
" #{framework_header_path}/devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/arch"

" #{framework_header_path}/devtools-backend/include"
devtools.header_mappings_dir = 'devtools'
else
pod_search_path = '$(PODS_TARGET_SRCROOT)/devtools/devtools-integration/ios/DevtoolsBackend/_deps/asio-src/asio/include' +
' $(PODS_TARGET_SRCROOT)/devtools/devtools-integration/ios/DevtoolsBackend/_deps/json-src/include' +
' $(PODS_TARGET_SRCROOT)/devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/include' +
' $(PODS_TARGET_SRCROOT)/devtools/devtools-integration/ios/DevtoolsBackend/_deps/websocketpp-src' +
pod_search_path =
' $(PODS_TARGET_SRCROOT)/devtools/devtools-integration/native/include' +
' $(PODS_TARGET_SRCROOT)/devtools/devtools-backend/include' +
' $(PODS_TARGET_SRCROOT)/devtools/devtools-integration/ios/DevtoolsBackend/_deps/base64-src/lib/arch'
' $(PODS_TARGET_SRCROOT)/devtools/devtools-backend/include'
end
devtools.header_mappings_dir = 'devtools/'
devtools.pod_target_xcconfig = {
Expand All @@ -422,6 +414,9 @@ Pod::Spec.new do |s|
devtools.user_target_xcconfig = {
'GCC_PREPROCESSOR_DEFINITIONS' => 'ENABLE_INSPECTOR=1'
}
devtools.dependency 'hippy/JsonForDevTools'
devtools.dependency 'hippy/AsioForDevTools'
devtools.dependency 'hippy/WebsocketForDevTools'
devtools.dependency 'hippy/Footstone'
devtools.dependency 'hippy/Dom'
devtools.dependency 'hippy/VFS'
Expand Down
Loading