re2 2.4.3 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile +6 -0
- data/README.md +281 -192
- data/Rakefile +41 -83
- data/dependencies.yml +4 -4
- data/ext/re2/extconf.rb +251 -361
- data/ext/re2/re2.cc +505 -284
- data/ext/re2/recipes.rb +31 -20
- data/lib/re2/regexp.rb +72 -0
- data/lib/re2/scanner.rb +11 -0
- data/lib/re2/string.rb +12 -59
- data/lib/re2/version.rb +10 -1
- data/lib/re2.rb +9 -3
- data/ports/archives/20240116.2.tar.gz +0 -0
- data/ports/archives/re2-2024-06-01.tar.gz +0 -0
- data/re2.gemspec +6 -3
- data/spec/kernel_spec.rb +10 -2
- data/spec/re2/match_data_spec.rb +98 -28
- data/spec/re2/regexp_spec.rb +546 -113
- data/spec/re2/scanner_spec.rb +26 -9
- data/spec/re2/set_spec.rb +28 -18
- data/spec/re2/string_spec.rb +2 -0
- data/spec/re2_spec.rb +34 -4
- data/spec/spec_helper.rb +2 -0
- metadata +12 -11
- data/ports/archives/20230802.1.tar.gz +0 -0
- data/ports/archives/re2-2023-11-01.tar.gz +0 -0
data/Rakefile
CHANGED
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'rake/extensiontask'
|
|
4
|
-
require 'rspec/core/rake_task'
|
|
5
4
|
require 'rake_compiler_dock'
|
|
6
|
-
require '
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
7
6
|
|
|
8
7
|
require_relative 'ext/re2/recipes'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
FileList['**/Makefile'],
|
|
13
|
-
FileList['pkg/']
|
|
14
|
-
|
|
15
|
-
CLOBBER.include FileList['**/tmp'],
|
|
16
|
-
FileList['**/*.log'],
|
|
17
|
-
FileList['doc/**'],
|
|
18
|
-
FileList['tmp/']
|
|
19
|
-
CLOBBER.add("ports/*").exclude(%r{ports/archives$})
|
|
20
|
-
|
|
21
|
-
RE2_GEM_SPEC = Gem::Specification.load('re2.gemspec')
|
|
22
|
-
|
|
23
|
-
task :prepare do
|
|
24
|
-
puts "Preparing project for gem building..."
|
|
25
|
-
recipes = load_recipes
|
|
26
|
-
recipes.each { |recipe| recipe.download }
|
|
27
|
-
end
|
|
9
|
+
re2_gemspec = Gem::Specification.load('re2.gemspec')
|
|
10
|
+
abseil_recipe, re2_recipe = load_recipes
|
|
28
11
|
|
|
29
|
-
|
|
12
|
+
# Add Abseil and RE2's latest archives to the gem files. (Note these will be
|
|
13
|
+
# removed from the precompiled native gems.)
|
|
14
|
+
abseil_archive = File.join("ports/archives", File.basename(abseil_recipe.files[0][:url]))
|
|
15
|
+
re2_archive = File.join("ports/archives", File.basename(re2_recipe.files[0][:url]))
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
p.need_tar = false
|
|
34
|
-
end
|
|
17
|
+
re2_gemspec.files << abseil_archive
|
|
18
|
+
re2_gemspec.files << re2_archive
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
CROSS_RUBY_PLATFORMS = %w[
|
|
20
|
+
cross_platforms = %w[
|
|
38
21
|
aarch64-linux
|
|
39
22
|
arm-linux
|
|
40
23
|
arm64-darwin
|
|
@@ -46,13 +29,15 @@ CROSS_RUBY_PLATFORMS = %w[
|
|
|
46
29
|
x86_64-linux
|
|
47
30
|
].freeze
|
|
48
31
|
|
|
49
|
-
ENV['RUBY_CC_VERSION'] =
|
|
32
|
+
ENV['RUBY_CC_VERSION'] = %w[3.3.0 3.2.0 3.1.0 3.0.0 2.7.0 2.6.0].join(':')
|
|
33
|
+
|
|
34
|
+
Gem::PackageTask.new(re2_gemspec).define
|
|
50
35
|
|
|
51
|
-
Rake::ExtensionTask.new('re2',
|
|
36
|
+
Rake::ExtensionTask.new('re2', re2_gemspec) do |e|
|
|
52
37
|
e.cross_compile = true
|
|
53
38
|
e.cross_config_options << '--enable-cross-build'
|
|
54
39
|
e.config_options << '--disable-system-libraries'
|
|
55
|
-
e.cross_platform =
|
|
40
|
+
e.cross_platform = cross_platforms
|
|
56
41
|
e.cross_compiling do |spec|
|
|
57
42
|
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
|
58
43
|
spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' }
|
|
@@ -61,72 +46,45 @@ end
|
|
|
61
46
|
|
|
62
47
|
RSpec::Core::RakeTask.new(:spec)
|
|
63
48
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
begin
|
|
50
|
+
require 'ruby_memcheck'
|
|
51
|
+
require 'ruby_memcheck/rspec/rake_task'
|
|
52
|
+
|
|
53
|
+
namespace :spec do
|
|
54
|
+
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
|
|
69
55
|
end
|
|
56
|
+
rescue LoadError
|
|
57
|
+
# Only define the spec:valgrind task if ruby_memcheck is installed
|
|
58
|
+
end
|
|
70
59
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
#
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'/usr/local/bin/cmake'
|
|
79
|
-
else
|
|
80
|
-
'cmake'
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
desc "build native gem for #{platform} platform"
|
|
60
|
+
namespace :gem do
|
|
61
|
+
cross_platforms.each do |platform|
|
|
62
|
+
|
|
63
|
+
# Compile each platform's native gem, packaging up the result. Note we add
|
|
64
|
+
# /usr/local/bin to the PATH as it contains the newest version of CMake in
|
|
65
|
+
# the rake-compiler-dock images.
|
|
66
|
+
desc "Compile and build native gem for #{platform} platform"
|
|
84
67
|
task platform do
|
|
85
68
|
RakeCompilerDock.sh <<~SCRIPT, platform: platform, verbose: true
|
|
86
69
|
gem install bundler --no-document &&
|
|
87
70
|
bundle &&
|
|
88
|
-
bundle exec rake
|
|
71
|
+
bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
|
|
89
72
|
SCRIPT
|
|
90
73
|
end
|
|
91
|
-
|
|
92
|
-
namespace platform do
|
|
93
|
-
desc "build native gem for #{platform} platform (guest container)"
|
|
94
|
-
task 'builder' do
|
|
95
|
-
gem_builder(platform)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
74
|
end
|
|
99
|
-
|
|
100
|
-
desc 'build all native gems'
|
|
101
|
-
multitask 'native' => CROSS_RUBY_PLATFORMS
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def add_file_to_gem(relative_source_path)
|
|
105
|
-
dest_path = File.join(gem_build_path, relative_source_path)
|
|
106
|
-
dest_dir = File.dirname(dest_path)
|
|
107
|
-
|
|
108
|
-
mkdir_p dest_dir unless Dir.exist?(dest_dir)
|
|
109
|
-
rm_f dest_path if File.exist?(dest_path)
|
|
110
|
-
safe_ln relative_source_path, dest_path
|
|
111
|
-
|
|
112
|
-
RE2_GEM_SPEC.files << relative_source_path
|
|
113
75
|
end
|
|
114
76
|
|
|
115
|
-
|
|
116
|
-
|
|
77
|
+
# Set up file tasks for Abseil and RE2's archives so they are automatically
|
|
78
|
+
# downloaded when required by the gem task.
|
|
79
|
+
file abseil_archive do
|
|
80
|
+
abseil_recipe.download
|
|
117
81
|
end
|
|
118
82
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
abseil_archive = File.join('ports', 'archives', "#{dependencies['abseil']['version']}.tar.gz")
|
|
122
|
-
libre2_archive = File.join('ports', 'archives', "re2-#{dependencies['libre2']['version']}.tar.gz")
|
|
123
|
-
|
|
124
|
-
add_file_to_gem(abseil_archive)
|
|
125
|
-
add_file_to_gem(libre2_archive)
|
|
83
|
+
file re2_archive do
|
|
84
|
+
re2_recipe.download
|
|
126
85
|
end
|
|
127
86
|
|
|
128
|
-
task
|
|
129
|
-
add_vendored_libraries
|
|
130
|
-
end
|
|
87
|
+
task default: :spec
|
|
131
88
|
|
|
132
|
-
|
|
89
|
+
CLEAN.add("lib/**/*.{o,so,bundle}", "pkg")
|
|
90
|
+
CLOBBER.add("ports")
|
data/dependencies.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
libre2:
|
|
3
|
-
version: '
|
|
4
|
-
sha256:
|
|
3
|
+
version: '2024-06-01'
|
|
4
|
+
sha256: 7326c74cddaa90b12090fcfc915fe7b4655723893c960ee3c2c66e85c5504b6c
|
|
5
5
|
abseil:
|
|
6
|
-
version: '
|
|
7
|
-
sha256:
|
|
6
|
+
version: '20240116.2'
|
|
7
|
+
sha256: 733726b8c3a6d39a4120d7e45ea8b41a434cdacde401cba500f14236c49b39dc
|