protovalidate 0.1.0.beta1 → 0.1.0.beta2
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/.gitattributes +12 -0
- data/CHANGELOG.md +5 -0
- data/README.md +5 -2
- data/Rakefile +5 -0
- data/ext/protovalidate/sys/build.rs +81 -1
- data/lib/protovalidate/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa9accbc06dca6c9a48cf7f7b944fd5831b2e453f63da38861e687bc24bc11e1
|
|
4
|
+
data.tar.gz: 45b07a1ee9e4faff86119af90d4d65dc5d1437bf9f68cf251b1d449433ca144d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11cae4c40737c00931f7232fd0abefa846efcccce3b1eb64607c21af936b8b99753b2d0779ba9ba4386ea435f1b757f6e56403dd8b383051468fbb1f89674ed5
|
|
7
|
+
data.tar.gz: 39916ae1fcfa899a4231a1e813f51e1707a5cb829599b44dc987d7f822126cf99e6be2117cf15c6a11f8e99443ca0fc1d2f9da93a2f0e76d37053d3c04c8411d
|
data/.gitattributes
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ext/protovalidate/sys/third_party/** linguist-vendored
|
|
2
|
+
|
|
3
|
+
# script/extract-native-sources
|
|
4
|
+
ext/protovalidate/sys/gen/** linguist-generated
|
|
5
|
+
ext/protovalidate/sys/filelists/*.txt linguist-generated
|
|
6
|
+
|
|
7
|
+
# rake proto:generate
|
|
8
|
+
lib/buf/validate/validate_pb.rb linguist-generated
|
|
9
|
+
spec/gen/** linguist-generated
|
|
10
|
+
|
|
11
|
+
# Compiled descriptor set of spec/proto
|
|
12
|
+
spec/fixtures/spec_messages.fdset linguist-generated
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0.beta2 (2026-09-21)
|
|
4
|
+
|
|
5
|
+
- Precompiled gems for `x86_64-linux-musl`, `aarch64-linux-musl`, `arm-linux-gnu` and `x64-mingw-ucrt`.
|
|
6
|
+
- Precompiled Linux glibc gems now require glibc 2.34 or newer (was 2.28); older hosts fall back to the source gem.
|
|
7
|
+
|
|
3
8
|
## 0.1.0.beta1 (2026-09-20)
|
|
4
9
|
|
|
5
10
|
- Initial release: `Protovalidate.validate` / `collect_violations` backed by protovalidate-cc 1.2.0 (protovalidate 1.2.2).
|
data/README.md
CHANGED
|
@@ -14,8 +14,11 @@ Precompiled gems are published for:
|
|
|
14
14
|
|
|
15
15
|
| Platform | Requirements |
|
|
16
16
|
|---|---|
|
|
17
|
-
| `x86_64-linux-gnu`, `aarch64-linux-gnu` | glibc 2.
|
|
17
|
+
| `x86_64-linux-gnu`, `aarch64-linux-gnu` | glibc 2.34 or newer |
|
|
18
|
+
| `arm-linux-gnu` (ARMv7, hard float) | glibc 2.31 or newer |
|
|
19
|
+
| `x86_64-linux-musl`, `aarch64-linux-musl` | musl libc, e.g. Alpine Linux |
|
|
18
20
|
| `arm64-darwin` | macOS 11 or newer |
|
|
21
|
+
| `x64-mingw-ucrt` | RubyInstaller (UCRT) Ruby |
|
|
19
22
|
|
|
20
23
|
Each covers Ruby 3.3, 3.4 and 4.0. On other platforms or Ruby versions the source gem is built at install time, which needs a Rust toolchain (1.85+), a C++17 compiler and a few minutes: it compiles protovalidate-cc, cel-cpp, abseil, protobuf, re2 and the ANTLR runtime.
|
|
21
24
|
|
|
@@ -86,7 +89,7 @@ bundle exec rake steep yard:check rubocop
|
|
|
86
89
|
|
|
87
90
|
The native code lives in `ext/protovalidate`: `src/lib.rs` binds `Protovalidate::Native::Engine` with [magnus](https://github.com/matsadler/magnus), and `sys/` compiles protovalidate-cc and its dependencies from git submodules using file lists derived from protovalidate-cc's Bazel build. To move to a new protovalidate-cc release, edit `ext/protovalidate/sys/versions.json`, run `script/extract-native-sources` (needs Bazel), update `PROTOVALIDATE_VERSION` in `lib/protovalidate/version.rb` if the specification version moved, and run `bundle exec rake proto:generate`.
|
|
88
91
|
|
|
89
|
-
Precompiled gems are assembled by `.github/workflows/native.yml`: Linux builds run inside
|
|
92
|
+
Precompiled gems are assembled by `.github/workflows/native.yml`: glibc Linux builds run inside manylinux_2_34 containers, macOS builds on macos-15 and Windows builds on windows-2025. musl and 32-bit ARM builds are cross-compiled with `rake cross compile` inside [rb-sys-dock](https://github.com/oxidize-rb/rb-sys) images, with newer cross compilers swapped in. `rake 'gem:native[PLATFORM]'` packages one gem per platform.
|
|
90
93
|
|
|
91
94
|
## License
|
|
92
95
|
|
data/Rakefile
CHANGED
|
@@ -14,6 +14,11 @@ Rake::ExtensionTask.new("protovalidate_native") do |ext|
|
|
|
14
14
|
ext.ext_dir = "ext/protovalidate"
|
|
15
15
|
ext.lib_dir = "lib/protovalidate"
|
|
16
16
|
ext.source_pattern = "{Cargo.toml,Cargo.lock,build.rs,src/**/*.rs,sys/Cargo.toml,sys/build.rs,sys/src/**/*.rs,sys/shim/*,sys/filelists/*.txt}"
|
|
17
|
+
# Platforms without a native CI runner are cross-compiled inside rb-sys-dock
|
|
18
|
+
# images (see .github/workflows/native.yml). Given several RUBY_CC_VERSIONs,
|
|
19
|
+
# `rake cross compile` stages each under tmp/<platform>/stage/lib/protovalidate/<X.Y>/.
|
|
20
|
+
ext.cross_compile = true
|
|
21
|
+
ext.cross_platform = %w[x86_64-linux-musl aarch64-linux-musl arm-linux-gnueabihf]
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
RSpec::Core::RakeTask.new(:spec)
|
|
@@ -101,6 +101,62 @@ fn read_filelist(path: &Path) -> Vec<String> {
|
|
|
101
101
|
.collect()
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/// Whether the target is Windows with the GNU toolchain (RubyInstaller's).
|
|
105
|
+
fn target_is_mingw() -> bool {
|
|
106
|
+
env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows")
|
|
107
|
+
&& env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("gnu")
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Whether libstdc++ is linked into the extension rather than loaded at
|
|
111
|
+
/// runtime. musl distributions do not install libstdc++ by default, and on
|
|
112
|
+
/// Windows the MinGW runtime DLLs are not on the PATH Ruby loads from.
|
|
113
|
+
fn link_libstdcxx_statically() -> bool {
|
|
114
|
+
env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("musl") || target_is_mingw()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// cel-cpp's typeinfo.cc takes `_WIN32` to mean MSVC and demangles with
|
|
118
|
+
/// `type_info::raw_name`, which only MSVC has. MinGW gets a copy that tests
|
|
119
|
+
/// `_MSC_VER` instead and so takes the Itanium ABI path GCC implements.
|
|
120
|
+
fn patch_for_mingw(path: PathBuf) -> PathBuf {
|
|
121
|
+
if !target_is_mingw() || !path.ends_with("third_party/cel-cpp/common/typeinfo.cc") {
|
|
122
|
+
return path;
|
|
123
|
+
}
|
|
124
|
+
let source =
|
|
125
|
+
std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display()));
|
|
126
|
+
assert_eq!(
|
|
127
|
+
source.matches("#ifdef _WIN32").count(),
|
|
128
|
+
2,
|
|
129
|
+
"{}: the _WIN32 guards moved; revisit patch_for_mingw",
|
|
130
|
+
path.display(),
|
|
131
|
+
);
|
|
132
|
+
let patched =
|
|
133
|
+
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR")).join("cel_typeinfo_mingw.cc");
|
|
134
|
+
std::fs::write(&patched, source.replace("#ifdef _WIN32", "#ifdef _MSC_VER"))
|
|
135
|
+
.unwrap_or_else(|e| panic!("{}: {e}", patched.display()));
|
|
136
|
+
patched
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// Lets rustc find an archive that ships with the C++ compiler; rustc
|
|
140
|
+
/// resolves `static=` libraries itself rather than asking the compiler.
|
|
141
|
+
fn add_archive_search_path(compiler: &cc::Tool, archive: &str) {
|
|
142
|
+
let output = compiler
|
|
143
|
+
.to_command()
|
|
144
|
+
.arg(format!("-print-file-name={archive}"))
|
|
145
|
+
.output()
|
|
146
|
+
.expect("run the C++ compiler");
|
|
147
|
+
let path = PathBuf::from(String::from_utf8(output.stdout).expect("utf-8").trim());
|
|
148
|
+
// An archive the compiler does not know comes back as the bare name.
|
|
149
|
+
assert!(path.is_absolute(), "the C++ compiler has no {archive}");
|
|
150
|
+
let dir = path.parent().expect("archive directory");
|
|
151
|
+
println!("cargo::rustc-link-search=native={}", dir.display());
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/// Links an archive that ships with the C++ compiler into the extension.
|
|
155
|
+
fn link_static_archive(compiler: &cc::Tool, name: &str) {
|
|
156
|
+
add_archive_search_path(compiler, &format!("lib{name}.a"));
|
|
157
|
+
println!("cargo::rustc-link-lib=static={name}");
|
|
158
|
+
}
|
|
159
|
+
|
|
104
160
|
/// One static library built from the C++ sources.
|
|
105
161
|
struct CxxLib {
|
|
106
162
|
name: String,
|
|
@@ -129,13 +185,16 @@ impl CxxLib {
|
|
|
129
185
|
build.flag_if_supported("-fvisibility=hidden");
|
|
130
186
|
build.flag_if_supported("-fvisibility-inlines-hidden");
|
|
131
187
|
}
|
|
188
|
+
if link_libstdcxx_statically() {
|
|
189
|
+
build.cpp_link_stdlib_static(true);
|
|
190
|
+
}
|
|
132
191
|
for dir in includes {
|
|
133
192
|
build.include(dir);
|
|
134
193
|
}
|
|
135
194
|
|
|
136
195
|
let root = manifest_dir();
|
|
137
196
|
for file in read_filelist(&root.join(format!("filelists/{name}.txt"))) {
|
|
138
|
-
build.file(root.join(file));
|
|
197
|
+
build.file(patch_for_mingw(root.join(file)));
|
|
139
198
|
}
|
|
140
199
|
Self {
|
|
141
200
|
name: name.to_owned(),
|
|
@@ -212,6 +271,27 @@ fn main() {
|
|
|
212
271
|
antlr4_lib.compile();
|
|
213
272
|
absl_lib.compile();
|
|
214
273
|
|
|
274
|
+
let compiler = absl_lib.build.get_compiler();
|
|
275
|
+
if link_libstdcxx_statically() {
|
|
276
|
+
add_archive_search_path(&compiler, "libstdc++.a");
|
|
277
|
+
// MinGW's libstdc++ implements threads on winpthreads, whose DLL is
|
|
278
|
+
// no more on Ruby's PATH than libstdc++'s.
|
|
279
|
+
if target_is_mingw() {
|
|
280
|
+
link_static_archive(&compiler, "winpthread");
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// 32-bit ARM has no 64-bit atomic instructions, so GCC calls out to
|
|
284
|
+
// libatomic, which distributions do not always install.
|
|
285
|
+
if env::var("CARGO_CFG_TARGET_ARCH").as_deref() == Ok("arm") {
|
|
286
|
+
link_static_archive(&compiler, "atomic");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// abseil's sysinfo.cc reads the CPU frequency from the registry; bazel
|
|
290
|
+
// links advapi32 through abseil's linkopts.
|
|
291
|
+
if env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
|
|
292
|
+
println!("cargo::rustc-link-lib=advapi32");
|
|
293
|
+
}
|
|
294
|
+
|
|
215
295
|
if env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
|
|
216
296
|
println!("cargo::rustc-link-lib=framework=CoreFoundation");
|
|
217
297
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protovalidate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0.
|
|
4
|
+
version: 0.1.0.beta2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sorah Fukumori
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: 0.9.130
|
|
40
40
|
description: Ruby implementation of protovalidate. Validates Protobuf messages against
|
|
41
41
|
the buf.validate rules in their schema, evaluated with CEL by protovalidate-cc through
|
|
42
|
-
a native extension. Precompiled gems are published for Linux and
|
|
42
|
+
a native extension. Precompiled gems are published for Linux, macOS and Windows.
|
|
43
43
|
email:
|
|
44
44
|
- sorah@ivry.jp
|
|
45
45
|
executables: []
|
|
@@ -47,6 +47,7 @@ extensions:
|
|
|
47
47
|
- ext/protovalidate/extconf.rb
|
|
48
48
|
extra_rdoc_files: []
|
|
49
49
|
files:
|
|
50
|
+
- ".gitattributes"
|
|
50
51
|
- ".yardopts"
|
|
51
52
|
- CHANGELOG.md
|
|
52
53
|
- LICENSE.txt
|