Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk bundle install --path .bundle
- name: Lint
run: |-
POD_VERSION=0.0.1-for-ci-test bundle exec pod spec lint PrimJS.podspec --verbose --skip-import-validation --allow-warnings
POD_VERSION=${{ github.event.pull_request.head.sha }} bundle exec pod spec lint PrimJS.podspec --verbose --skip-import-validation --allow-warnings

check-unittests-linux:
runs-on: lynx-ubuntu-22.04-medium
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ endif()

set(napi_v8_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/napi/v8/js_native_api_v8.cc)

set(napi_adapter_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/napi/adapter/js_native_api_adapter.cc)

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/interpreter
Expand All @@ -191,7 +193,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/env
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/internal
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/quickjs
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/v8)
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/v8
${CMAKE_CURRENT_SOURCE_DIR}/src/napi/adapter)

set(JS_V8_HEADERS ${CMAKE_SOURCE_DIR}/../../third_party/v8/include)

Expand All @@ -208,10 +211,13 @@ if(NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}))
set(napi_v8_sources
${napi_v8_sources}
PARENT_SCOPE)
set(napi_adapter_sources
${napi_adapter_sources}
PARENT_SCOPE)
endif()

set_source_files_properties(
${napi_sources} ${napi_v8_sources}
${napi_sources} ${napi_v8_sources} ${napi_adapter_sources}
PROPERTIES
COMPILE_FLAGS
"${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
Expand All @@ -233,13 +239,15 @@ if(ENABLE_BUILD_AAR)
add_library(quick SHARED ${quickjs_sources})
add_library(napi SHARED ${napi_sources})
add_library(napi_v8 SHARED ${napi_v8_sources})
add_library(napi_adapter SHARED ${napi_adapter_sources})
find_library(log_lib log)
target_link_libraries(quick ${log_lib})
target_link_libraries(napi quick)
target_link_libraries(napi ${log_lib})
target_include_directories(napi_v8 PRIVATE ${JS_V8_HEADERS})
target_link_libraries(
napi_v8 PUBLIC ${JS_V8_LIBRARY}/${ANDROID_ABI}/libv8_libfull.cr.so)
target_link_libraries(napi_adapter napi)
endif()

if(WIN32)
Expand Down
25 changes: 22 additions & 3 deletions PrimJS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@

Pod::Spec.new do |s|
s.name = "PrimJS"
s.version = "#{ ENV['POD_VERSION'] || File.read('PRIMJS_VERSION').strip}"
s.version = begin
raw_version = ENV['POD_VERSION'] || File.read('PRIMJS_VERSION').strip
if raw_version.match?(/^[0-9a-f]{40}$/i)
"0.0.1-for-ci-test"
else
raw_version
end
end
s.summary = "A short description of PrimJS."
s.homepage = "https://github.com/lynx-family/primjs"

Expand All @@ -28,8 +35,13 @@ Pod::Spec.new do |s|
s.license = "MIT"
s.author = { "pandazyp" => "[email protected]" }

s.source = { :git => "https://github.com/lynx-family/primjs.git", :tag => s.version.to_s }

s.source = { :git => "https://github.com/lynx-family/primjs.git", }.tap do |source_hash|
if ENV['POD_VERSION'] =~ /^[0-9a-f]{40}$/i
source_hash[:commit] = ENV['POD_VERSION']
else
source_hash[:tag] = s.version.to_s
end
end
s.compiler_flags = "-Wall", "-Wno-shorten-64-to-32", "-Os"
s.ios.deployment_target = "9.0"
s.pod_target_xcconfig = {
Expand Down Expand Up @@ -115,6 +127,13 @@ Pod::Spec.new do |s|
ssp.dependency "PrimJS/quickjs"
ssp.frameworks = "JavaScriptCore"
end

sp.subspec "adapter" do |ssp|
ssp.source_files = "src/napi/adapter/*.{h,cc}"
ssp.public_header_files = "src/napi/adapter/js_native_api_adapter.h"
ssp.dependency "PrimJS/napi/core"
ssp.dependency "PrimJS/napi/env"
end
end

s.subspec "log" do |sp|
Expand Down
15 changes: 15 additions & 0 deletions src/napi/adapter/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 The Lynx Authors. All rights reserved.
# Licensed under the Apache License Version 2.0 that can be found in the
# LICENSE file in the root directory of this source tree.

import("//Primjs.gni")
config("config") {
include_dirs = [ "." ]
}

napi_source_set("adapter") {
sources = [ "js_native_api_adapter.cc" ]
public = [ "./js_native_api_adapter.h" ]
public_configs = [ ":config" ]
public_deps = [ "../..:napi_lib" ]
}
Loading
Loading