mini_racer 0.5.0 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f868c575c8ed41f4080580b2d09d0d42522d337390f425b3110e38298952a6f4
4
- data.tar.gz: 9c2df1f0171dd3ed4bba7a59faa3ea7d87a1976087395da3ec56966aeedd23d8
3
+ metadata.gz: 4290b52d3d19c196567892c0d3eda0b47f07047afe059e63d4ac976258cb52a0
4
+ data.tar.gz: 55e41b4e8ab93cdfe45446ff08a5b3c42323356e36b79d91f2e564c43a7715fe
5
5
  SHA512:
6
- metadata.gz: 7c51ea3a8f4abc4ae458090ce2f37760110ac240f7600e3fd249f07df97725e0b7903884fb90063b3d3140c0337eeae132a6e395b1f74777c85dfddc03b6ad96
7
- data.tar.gz: '0948c498cdb9a0767dbe0de9d4b233d2561eb6b72f6603170c3f4d9304083487a03fc395f8803f1d1690ef6f9d06e0faddc86ef694b950c0e95ea4047943c96e'
6
+ metadata.gz: c0e0cca11803ffa6ba38998810ccb82413257145947a637f3800252f4a0d47bd47fde425786c09f1eedf6c28b1bb584d34914b111effffef908ff182e79c5329
7
+ data.tar.gz: 05dbfe34c140fedf6fbd33f5eee62f6cc6880579d238039f2e351a0279fa9267575b46ae7890f9c7d19ebd43bf1020e9bb57d445ad4e6ac8f89440ac3e2744d3
@@ -1,48 +1,92 @@
1
- name: Test
1
+ name: Tests
2
+
2
3
  on:
3
- - push
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - master
4
8
 
5
9
  jobs:
10
+ test-truffleruby:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os:
15
+ - "macos-11"
16
+ - "macos-12"
17
+ - "ubuntu-20.04"
18
+ ruby:
19
+ - "truffleruby+graalvm-head"
20
+
21
+ name: ${{ matrix.os }} - ${{ matrix.ruby }}
22
+ runs-on: ${{ matrix.os }}
23
+
24
+ env:
25
+ TRUFFLERUBYOPT: "--jvm --polyglot"
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+ - name: Install GraalVM JS component
34
+ run: gu install js
35
+ - name: Compile
36
+ run: bundle exec rake compile
37
+ - name: Test
38
+ run: bundle exec rake test
39
+
6
40
  test-darwin:
7
41
  strategy:
8
42
  fail-fast: false
9
43
  matrix:
10
44
  os:
11
- - '10.15'
12
- - '11.0'
13
- platform:
14
- - x86_64
15
- # arm64
16
- name: Test (darwin)
17
- runs-on: macos-${{ matrix.os }}
45
+ - "macos-11"
46
+ - "macos-12"
47
+ ruby:
48
+ - "ruby-2.6"
49
+ - "ruby-2.7"
50
+ - "ruby-3.0"
51
+ - "ruby-3.1"
52
+
53
+ name: ${{ matrix.os }} - ${{ matrix.ruby }}
54
+ runs-on: ${{ matrix.os }}
55
+
18
56
  steps:
19
- - name: Checkout
20
- uses: actions/checkout@v2
21
- - name: Bundle
22
- run: bundle install
57
+ - uses: actions/checkout@v3
58
+ - uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: ${{ matrix.ruby }}
61
+ bundler-cache: true
23
62
  - name: Compile
24
63
  run: bundle exec rake compile
25
64
  - name: Test
26
65
  run: bundle exec rake test
66
+
27
67
  test-linux:
28
68
  strategy:
29
69
  fail-fast: false
30
70
  matrix:
31
71
  ruby:
32
- - '2.6'
33
- - '2.7'
34
- - '3.0'
72
+ - "2.6"
73
+ - "2.7"
74
+ - "3.0"
75
+ - "3.1"
35
76
  platform:
36
- - amd64
37
- - arm64
38
- # arm
39
- # ppc64le
40
- # s390x
77
+ - "amd64"
78
+ - "arm64"
41
79
  libc:
42
- - gnu
43
- - musl
44
- name: Test (linux)
80
+ - "gnu"
81
+ - "musl"
82
+ exclude:
83
+ # there's no libv8-node (v16) for aarch64-linux-musl at the moment
84
+ - platform: "arm64"
85
+ libc: "musl"
86
+
87
+ name: linux-${{ matrix.platform }} - ruby-${{ matrix.ruby }} - ${{ matrix.libc }}
45
88
  runs-on: ubuntu-20.04
89
+
46
90
  steps:
47
91
  - name: Enable ${{ matrix.platform }} platform
48
92
  id: qemu
@@ -67,9 +111,11 @@ jobs:
67
111
  echo "::set-output name=id::$(cat container_id)"
68
112
  - name: Install Alpine system dependencies
69
113
  if: ${{ matrix.libc == 'musl' }}
70
- run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base linux-headers bash python2 python3 git curl tar clang binutils-gold
114
+ run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} apk add --no-cache build-base bash git
71
115
  - name: Checkout
72
- uses: actions/checkout@v2
116
+ uses: actions/checkout@v3
117
+ - name: Update Rubygems
118
+ run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} gem update --system
73
119
  - name: Bundle
74
120
  run: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install
75
121
  - name: Compile
data/CHANGELOG CHANGED
@@ -1,5 +1,45 @@
1
+ - 16-08-2022
2
+
3
+ - 0.6.3
4
+
5
+ - Truffle ruby support! Thanks to Brandon Fish and the truffle team
6
+ - Hide libv8 symbols on ELF targets
7
+ - Slightly shrunk binary size
8
+ - Simplified timeout implementation
9
+ - Some stability fixes
10
+
11
+ - 17-01-2022
12
+
13
+ - 0.6.2
14
+
15
+ - Fix support for compilation on 2.6, llvm compiles
16
+ - Stability patches to handle rare memory leaks
17
+ - Corrected re-raising of exceptions to support strings
18
+ - During early termination of context under certain conditions MiniRacer could crash
19
+
20
+
21
+ - 31-12-2021
22
+
23
+ - 0.6.1
24
+
25
+ - Added support for single threaded platform: `MiniRacer::Platform.set_flags! :single_threaded`
26
+ must be called prior to booting ANY MiniRacer::Context
27
+
28
+ - 0.6.0
29
+
30
+ - Ruby 3.1 support
31
+ - Fixes memory leak in heap snapshotting
32
+ - Improved compilation ergonomics in clang
33
+ - Migrated internal storage in c extension to TypedData
34
+
1
35
  - 11-04-2021
2
36
 
37
+ - 0.5.0
38
+ - Fixes issues on aarch (Apple M1)
39
+ - Update to use libv8-node 16.x (#210) [Loic Nageleisen]
40
+ - FEATURE: Configurable max marshal stack depth (#202) [seanmakesgames]
41
+ - Ruby 2.3 and 2.4 are EOL, we no longer support them
42
+
3
43
  - 0.4.0
4
44
 
5
45
  - FEATURE: upgrade to libv8 node 15.14.0 (v8 8.6.395.17)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MiniRacer
2
2
 
3
- [![Build Status](https://travis-ci.org/rubyjs/mini_racer.svg?branch=master)](https://travis-ci.org/rubyjs/mini_racer)
3
+ [![Test](https://github.com/rubyjs/mini_racer/actions/workflows/ci.yml/badge.svg)](https://github.com/rubyjs/mini_racer/actions/workflows/ci.yml)
4
4
 
5
5
  Minimal, modern embedded V8 for Ruby.
6
6
 
@@ -12,7 +12,7 @@ MiniRacer has an adapter for [execjs](https://github.com/rails/execjs) so it can
12
12
 
13
13
  ### A note about Ruby version Support
14
14
 
15
- MiniRacer only supports non-EOL versions of Ruby. See [Ruby](https://www.ruby-lang.org/en/downloads) to see the list of non-EOL Rubies.
15
+ MiniRacer only supports non-EOL versions of Ruby. See [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) for the list of non-EOL Rubies.
16
16
 
17
17
  If you require support for older versions of Ruby install an older version of the gem.
18
18
 
@@ -112,16 +112,21 @@ context.eval('bar()', filename: 'a/bar.js')
112
112
 
113
113
  ### Fork safety
114
114
 
115
- Some Ruby web servers employ forking (for example unicorn or puma in clustered mode). V8 is not fork safe.
116
- Sadly Ruby does not have support for fork notifications per [#5446](https://bugs.ruby-lang.org/issues/5446).
115
+ Some Ruby web servers employ forking (for example unicorn or puma in clustered mode). V8 is not fork safe by default and sadly Ruby does not have support for fork notifications per [#5446](https://bugs.ruby-lang.org/issues/5446).
116
+
117
+ Since 0.6.1 mini_racer does support V8 single threaded platform mode which should remove most forking related issues. To enable run this before using `MiniRacer::Context`:
118
+
119
+ ```ruby
120
+ MiniRacer::Platform.set_flags!(:single_threaded)
121
+ ```
117
122
 
118
123
  If you want to ensure your application does not leak memory after fork either:
119
124
 
120
- 1. Ensure no MiniRacer::Context objects are created in the master process
125
+ 1. Ensure no `MiniRacer::Context` objects are created in the master process
121
126
 
122
127
  Or
123
128
 
124
- 2. Dispose manually of all MiniRacer::Context objects prior to forking
129
+ 2. Dispose manually of all `MiniRacer::Context` objects prior to forking
125
130
 
126
131
  ```ruby
127
132
  # before fork
@@ -419,18 +424,15 @@ Or install it yourself as:
419
424
  **Note** using v8.h and compiling MiniRacer requires a C++11 standard compiler, more specifically clang 3.5 (or later) or GCC 6.3 (or later).
420
425
 
421
426
 
422
- ## Travis-ci
427
+ ### Troubleshooting
423
428
 
424
- To install `mini-racer` you will need a version of GCC that supports C++11 (GCC 6.3) this is included by default in ubuntu trusty based images.
429
+ If you have a problem installing mini_racer, please consider the following steps:
425
430
 
426
- Travis today ships by default with a precise based image. Precise Pangolin (12.04 LTS) was first released in August 2012. Even though you can install GCC 6.3 on precise the simpler approach is to opt for the trusty based image.
427
-
428
- Add this to your .travis.yml file:
429
-
430
- ```
431
- - sudo: required
432
- - dist: trusty
433
- ```
431
+ * make sure you try the latest released version of mini_racer
432
+ * make sure you have Rubygems >= 3.2.13 and bundler >= 2.2.13 installed via `gem update --system`
433
+ * if you are using bundler, make sure to have `PLATFORMS` set correctly in `Gemfile.lock` via `bundle lock --add-platform`
434
+ * make sure to recompile/reinstall `mini_racer` and `libv8-node` after system upgrades (for example via `gem uninstall --all mini_racer libv8-node`)
435
+ * make sure you are on the latest patch/teeny version of a supported Ruby branch
434
436
 
435
437
  ## Similar Projects
436
438
 
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
- require "rake/extensiontask"
4
3
 
5
4
  Rake::TestTask.new(:test) do |t|
6
5
  t.libs << "test"
@@ -11,8 +10,21 @@ end
11
10
  task :default => [:compile, :test]
12
11
 
13
12
  gem = Gem::Specification.load( File.dirname(__FILE__) + '/mini_racer.gemspec' )
14
- Rake::ExtensionTask.new( 'mini_racer_loader', gem )
15
- Rake::ExtensionTask.new( 'mini_racer_extension', gem )
13
+
14
+ if RUBY_ENGINE == "truffleruby"
15
+ task :compile do
16
+ # noop
17
+ end
18
+
19
+ task :clean do
20
+ # noop
21
+ end
22
+ else
23
+ require 'rake/extensiontask'
24
+ Rake::ExtensionTask.new( 'mini_racer_loader', gem )
25
+ Rake::ExtensionTask.new( 'mini_racer_extension', gem )
26
+ end
27
+
16
28
 
17
29
 
18
30
  # via http://blog.flavorjon.es/2009/06/easily-valgrind-gdb-your-ruby-c.html
@@ -92,5 +104,5 @@ task :lint do
92
104
  portability-*
93
105
  readability-*).join(',')
94
106
 
95
- sh RbConfig::expand("clang-tidy -checks='#{checks}' ext/mini_racer_extension/mini_racer_extension.cc -- #$INCFLAGS #$CPPFLAGS", conf)
107
+ sh RbConfig::expand("clang-tidy -checks='#{checks}' ext/mini_racer_extension/mini_racer_extension.cc -- #$INCFLAGS #$CXXFLAGS", conf)
96
108
  end
@@ -1,4 +1,10 @@
1
1
  require 'mkmf'
2
+
3
+ if RUBY_ENGINE == "truffleruby"
4
+ File.write("Makefile", dummy_makefile($srcdir).join(""))
5
+ return
6
+ end
7
+
2
8
  require_relative '../../lib/mini_racer/version'
3
9
  gem 'libv8-node', MiniRacer::LIBV8_NODE_VERSION
4
10
  require 'libv8-node'
@@ -7,18 +13,25 @@ IS_DARWIN = RUBY_PLATFORM =~ /darwin/
7
13
 
8
14
  have_library('pthread')
9
15
  have_library('objc') if IS_DARWIN
10
- $CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
11
- $CPPFLAGS += " -g" unless $CPPFLAGS.split.include? "-g"
12
- $CPPFLAGS += " -rdynamic" unless $CPPFLAGS.split.include? "-rdynamic"
13
- $CPPFLAGS += " -fPIC" unless $CPPFLAGS.split.include? "-rdynamic" or IS_DARWIN
14
- $CPPFLAGS += " -std=c++14"
15
- $CPPFLAGS += " -fpermissive"
16
- #$CPPFLAGS += " -DV8_COMPRESS_POINTERS"
17
- $CPPFLAGS += " -fvisibility=hidden "
18
-
19
- $CPPFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
20
-
21
- $LDFLAGS.insert(0, " -stdlib=libc++ ") if IS_DARWIN
16
+ $CXXFLAGS += " -Wall" unless $CXXFLAGS.split.include? "-Wall"
17
+ $CXXFLAGS += " -g" unless $CXXFLAGS.split.include? "-g"
18
+ $CXXFLAGS += " -rdynamic" unless $CXXFLAGS.split.include? "-rdynamic"
19
+ $CXXFLAGS += " -fPIC" unless $CXXFLAGS.split.include? "-rdynamic" or IS_DARWIN
20
+ $CXXFLAGS += " -std=c++14"
21
+ $CXXFLAGS += " -fpermissive"
22
+ #$CXXFLAGS += " -DV8_COMPRESS_POINTERS"
23
+ $CXXFLAGS += " -fvisibility=hidden "
24
+
25
+ # __declspec gets used by clang via ruby 3.x headers...
26
+ $CXXFLAGS += " -fms-extensions"
27
+
28
+ $CXXFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
29
+
30
+ if IS_DARWIN
31
+ $LDFLAGS.insert(0, " -stdlib=libc++ ")
32
+ else
33
+ $LDFLAGS.insert(0, " -lstdc++ ")
34
+ end
22
35
 
23
36
  # check for missing symbols at link time
24
37
  # $LDFLAGS += " -Wl,--no-undefined " unless IS_DARWIN
@@ -63,9 +76,17 @@ end
63
76
 
64
77
  Libv8::Node.configure_makefile
65
78
 
79
+ # --exclude-libs is only for i386 PE and ELF targeted ports
80
+ append_ldflags("-Wl,--exclude-libs=ALL ")
81
+
66
82
  if enable_config('asan')
67
- $CPPFLAGS.insert(0, " -fsanitize=address ")
83
+ $CXXFLAGS.insert(0, " -fsanitize=address ")
68
84
  $LDFLAGS.insert(0, " -fsanitize=address ")
69
85
  end
70
86
 
87
+ # there doesn't seem to be a CPP macro for this in Ruby 2.6:
88
+ if RUBY_ENGINE == 'ruby'
89
+ $CPPFLAGS += ' -DENGINE_IS_CRUBY '
90
+ end
91
+
71
92
  create_makefile 'mini_racer_extension'