File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ #/bin/sh
2+
3+ set -e
4+ set -u
5+
6+ BASEDIR="${PWD}"
7+
8+ TARGET_PLATFORM=x86_64-darwin
9+ RUBY_TARGET_PLATFORM=x86_64-darwin
10+
11+ bundle install
12+
13+ RUBY_PLATFORM=$(./libexec/metadata ruby_platform)
14+ GEM_PLATFORM=$(./libexec/metadata gem_platform)
15+ GEM_VERSION=$(./libexec/metadata gem_version)
16+ NODE_VERSION=$(./libexec/metadata node_version)
17+ LIBV8_VERSION=$(./libexec/metadata libv8_version)
18+
19+ ./libexec/download-node $NODE_VERSION
20+ ./libexec/extract-node $NODE_VERSION
21+
22+ # Validate that we have the correct V8 version.
23+ libv8_version_h=$(./libexec/metadata libv8_version_h)
24+ if [ "$libv8_version_h" != "$LIBV8_VERSION" ]; then
25+ echo "LIBV8 version mismatch: expected $LIBV8_VERSION but found $libv8_version_h"
26+ exit 1
27+ fi
28+
29+ # Build the package.
30+ ./libexec/build-libv8 $NODE_VERSION
31+ ./libexec/build-monolith $NODE_VERSION
32+ ./libexec/inject-libv8 $NODE_VERSION
33+
34+ # Run V8 tests.
35+ cd test/gtest
36+ cmake -S . -B build
37+ cd build
38+ cmake --build .
39+ ./c_v8_tests
40+
41+ if [ $? -ne 0 ]; then
42+ echo "Tests failed."
43+ exit 1
44+ fi
45+
46+ # Build the gem.
47+ cd "${BASEDIR}"
48+ bundle exec rake binary
49+
50+ # Test that the gem can be installed and used.
51+ gem install pkg/libv8-node-$GEM_VERSION-$GEM_PLATFORM.gem
52+
53+ rm -rf test/mini_racer
54+ git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
55+ cd test/mini_racer
56+ ruby -i -ne "\$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(\" LIBV8_NODE_VERSION = \\\"$GEM_VERSION\\\"\\n\") : print" lib/mini_racer/version.rb
57+ ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec
58+ bundle install
59+ bundle exec rake compile
60+ bundle exec rake test
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ if(${system_name} STREQUAL "linux")
3939 endif ()
4040endif ()
4141
42+ if (APPLE )
43+ find_library (CoreFoundation CoreFoundation)
44+ endif ()
45+
4246message (STATUS "Detected vendor architecture directory: ${vendor_arch} " )
4347
4448# TODO?: Detect and support ruby-arch builds?
@@ -47,5 +51,7 @@ target_link_libraries(c_v8_tests ${CMAKE_SOURCE_DIR}/../../vendor/v8/${vendor_ar
4751# This has to be after the v8 monolith for some build setups.
4852target_link_libraries (c_v8_tests dl)
4953
54+ target_link_libraries (c_v8_tests $<$<PLATFORM_ID:Darwin>:${CoreFoundation} >)
55+
5056include (GoogleTest)
5157gtest_discover_tests(c_v8_tests)
You can’t perform that action at this time.
0 commit comments