rbs 4.0.1 → 4.0.3
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/.github/dependabot.yml +2 -0
- data/.github/workflows/bundle-update.yml +4 -1
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/milestone.yml +80 -0
- data/.github/workflows/ruby.yml +6 -0
- data/.github/workflows/rust.yml +93 -5
- data/.github/workflows/windows.yml +3 -0
- data/.gitignore +4 -0
- data/CHANGELOG.md +29 -0
- data/Rakefile +207 -0
- data/docs/rust.md +96 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77f310d0293781c4da3d3835ee34be5b310dc4aace7b75db580060432f5dd10c
|
|
4
|
+
data.tar.gz: 8d982db360beced794afa05c156c40db8b368f7b2d0b0180ad61434d3c1eb0a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87d0a52295c6167fb791c2ff843dee5a9b7c1d4cc9d13fe5ccf8c12abcc7ed507497021e691dd0cd1a134ff886c9ba29461f03f2a26fc3402af1c78bc36ec62f
|
|
7
|
+
data.tar.gz: 40381f1988f06a3262de9367042ad0e04864f7c9f0a1556f30dc01003874db8018a77b10c613e090993738d3787861ccb84417631a4cc57c3998ca99c831eb8b
|
data/.github/dependabot.yml
CHANGED
|
@@ -57,4 +57,7 @@ jobs:
|
|
|
57
57
|
--title "bundle update ($(date +'%Y-%m-%d'))" \
|
|
58
58
|
--body "Automated weekly bundle update" \
|
|
59
59
|
--head "$(git rev-parse --abbrev-ref HEAD)" \
|
|
60
|
-
--base "${{ github.event.repository.default_branch }}"
|
|
60
|
+
--base "${{ github.event.repository.default_branch }}" \
|
|
61
|
+
--label "no-milestone"
|
|
62
|
+
|
|
63
|
+
gh pr merge --auto --merge "$(git rev-parse --abbrev-ref HEAD)"
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
|
|
15
15
|
steps:
|
|
16
16
|
- name: Dependabot metadata
|
|
17
|
-
uses: dependabot/fetch-metadata@
|
|
17
|
+
uses: dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36 # v3.0.0
|
|
18
18
|
id: metadata
|
|
19
19
|
- name: Checkout repository
|
|
20
20
|
uses: actions/checkout@v6
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: Check milestone
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, edited, labeled, unlabeled, milestoned, demilestoned, synchronize]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
check:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
|
+
|
|
14
|
+
- name: Extract RBS::Version
|
|
15
|
+
id: version
|
|
16
|
+
run: |
|
|
17
|
+
# Extract version string from lib/rbs/version.rb
|
|
18
|
+
version=$(ruby -e 'load "lib/rbs/version.rb"; print RBS::VERSION')
|
|
19
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
20
|
+
|
|
21
|
+
# Parse major.minor.patch
|
|
22
|
+
IFS='.' read -r major minor patch _rest <<< "$version"
|
|
23
|
+
echo "major=$major" >> "$GITHUB_OUTPUT"
|
|
24
|
+
echo "minor=$minor" >> "$GITHUB_OUTPUT"
|
|
25
|
+
echo "patch=$patch" >> "$GITHUB_OUTPUT"
|
|
26
|
+
|
|
27
|
+
echo "RBS::VERSION = $version (major=$major, minor=$minor, patch=$patch)"
|
|
28
|
+
|
|
29
|
+
- name: Check milestone
|
|
30
|
+
uses: actions/github-script@v8
|
|
31
|
+
with:
|
|
32
|
+
script: |
|
|
33
|
+
const pr = context.payload.pull_request;
|
|
34
|
+
const milestone = pr.milestone;
|
|
35
|
+
const labels = pr.labels.map(l => l.name);
|
|
36
|
+
|
|
37
|
+
const version = '${{ steps.version.outputs.version }}';
|
|
38
|
+
const major = '${{ steps.version.outputs.major }}';
|
|
39
|
+
const minor = '${{ steps.version.outputs.minor }}';
|
|
40
|
+
const patch = parseInt('${{ steps.version.outputs.patch }}', 10);
|
|
41
|
+
|
|
42
|
+
if (!milestone) {
|
|
43
|
+
if (labels.includes('no-milestone')) {
|
|
44
|
+
core.info('No milestone set, but no-milestone label is present — OK');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
core.setFailed(
|
|
48
|
+
'No milestone set. Add a milestone or add the "no-milestone" label.'
|
|
49
|
+
);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (labels.includes('no-milestone')) {
|
|
54
|
+
core.setFailed(
|
|
55
|
+
'Milestone is set but "no-milestone" label is present. Remove the label or the milestone.'
|
|
56
|
+
);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const milestoneName = milestone.title;
|
|
61
|
+
core.info(`Milestone: "${milestoneName}", RBS::VERSION: ${version}`);
|
|
62
|
+
|
|
63
|
+
// Expected milestone based on version:
|
|
64
|
+
// patch == 0 → "RBS major.minor" (e.g. "RBS 4.0")
|
|
65
|
+
// patch >= 1 → "RBS major.minor.x" (e.g. "RBS 4.0.x")
|
|
66
|
+
let expectedMilestone;
|
|
67
|
+
if (patch === 0) {
|
|
68
|
+
expectedMilestone = `RBS ${major}.${minor}`;
|
|
69
|
+
} else {
|
|
70
|
+
expectedMilestone = `RBS ${major}.${minor}.x`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (milestoneName !== expectedMilestone) {
|
|
74
|
+
core.setFailed(
|
|
75
|
+
`Milestone "${milestoneName}" does not match RBS::VERSION ${version}. ` +
|
|
76
|
+
`Expected milestone: "${expectedMilestone}"`
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
core.info(`Milestone "${milestoneName}" matches RBS::VERSION ${version}`);
|
|
80
|
+
}
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -63,6 +63,9 @@ jobs:
|
|
|
63
63
|
if: ${{ contains(matrix.ruby, 'head') }}
|
|
64
64
|
run: |
|
|
65
65
|
bundle config set force_ruby_platform true
|
|
66
|
+
- name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
|
|
67
|
+
if: ${{ contains(matrix.ruby, 'head') }}
|
|
68
|
+
run: bundle config set --local version system
|
|
66
69
|
- name: Skip installing type checkers
|
|
67
70
|
if: ${{ ! contains(matrix.job, 'typecheck_test') }}
|
|
68
71
|
run: |
|
|
@@ -106,6 +109,9 @@ jobs:
|
|
|
106
109
|
if: ${{ contains(matrix.ruby, 'head') }}
|
|
107
110
|
run: |
|
|
108
111
|
bundle config set force_ruby_platform true
|
|
112
|
+
- name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
|
|
113
|
+
if: ${{ contains(matrix.ruby, 'head') }}
|
|
114
|
+
run: bundle config set --local version system
|
|
109
115
|
- name: bin/setup
|
|
110
116
|
run: |
|
|
111
117
|
bin/setup
|
data/.github/workflows/rust.yml
CHANGED
|
@@ -24,6 +24,20 @@ jobs:
|
|
|
24
24
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
25
25
|
steps:
|
|
26
26
|
- uses: actions/checkout@v6
|
|
27
|
+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
28
|
+
- name: Set up Ruby
|
|
29
|
+
uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ruby
|
|
32
|
+
bundler: none
|
|
33
|
+
- name: Update rubygems & bundler
|
|
34
|
+
run: gem update --system
|
|
35
|
+
- name: Install gems
|
|
36
|
+
run: |
|
|
37
|
+
bundle config set --local without libs:profilers
|
|
38
|
+
bundle install --jobs 4 --retry 3
|
|
39
|
+
- name: Set up vendored RBS source
|
|
40
|
+
run: bundle exec rake rust:rbs:sync
|
|
27
41
|
- name: Install Rust tools
|
|
28
42
|
run: |
|
|
29
43
|
rustup update --no-self-update stable
|
|
@@ -42,12 +56,30 @@ jobs:
|
|
|
42
56
|
cd rust
|
|
43
57
|
cargo test --verbose
|
|
44
58
|
|
|
45
|
-
publish-dry-run:
|
|
46
|
-
name:
|
|
59
|
+
publish-dry-run-ruby-rbs-sys:
|
|
60
|
+
name: rust:publish:ruby-rbs-sys
|
|
47
61
|
runs-on: ubuntu-latest
|
|
48
62
|
continue-on-error: true
|
|
49
63
|
steps:
|
|
50
64
|
- uses: actions/checkout@v6
|
|
65
|
+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
66
|
+
- name: Set up git identity
|
|
67
|
+
run: |
|
|
68
|
+
git config user.name "GitHub Actions"
|
|
69
|
+
git config user.email "actions@github.com"
|
|
70
|
+
- name: Set up Ruby
|
|
71
|
+
uses: ruby/setup-ruby@v1
|
|
72
|
+
with:
|
|
73
|
+
ruby-version: ruby
|
|
74
|
+
bundler: none
|
|
75
|
+
- name: Update rubygems & bundler
|
|
76
|
+
run: gem update --system
|
|
77
|
+
- name: Install gems
|
|
78
|
+
run: |
|
|
79
|
+
bundle config set --local without libs:profilers
|
|
80
|
+
bundle install --jobs 4 --retry 3
|
|
81
|
+
- name: Set up vendored RBS source
|
|
82
|
+
run: bundle exec rake rust:rbs:sync
|
|
51
83
|
- name: Install Rust tools
|
|
52
84
|
run: |
|
|
53
85
|
rustup update --no-self-update stable
|
|
@@ -61,16 +93,72 @@ jobs:
|
|
|
61
93
|
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
|
|
62
94
|
restore-keys: |
|
|
63
95
|
${{ runner.os }}-cargo-
|
|
64
|
-
- name: Test publish
|
|
96
|
+
- name: Test publish ruby-rbs-sys
|
|
97
|
+
run: bundle exec rake rust:publish:ruby-rbs-sys
|
|
98
|
+
env:
|
|
99
|
+
RBS_RUST_PUBLISH_DRY_RUN: "1"
|
|
100
|
+
|
|
101
|
+
publish-dry-run-ruby-rbs:
|
|
102
|
+
name: rust:publish:ruby-rbs
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
continue-on-error: true
|
|
105
|
+
steps:
|
|
106
|
+
- uses: actions/checkout@v6
|
|
107
|
+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
108
|
+
- name: Set up git identity
|
|
65
109
|
run: |
|
|
66
|
-
|
|
67
|
-
|
|
110
|
+
git config user.name "GitHub Actions"
|
|
111
|
+
git config user.email "actions@github.com"
|
|
112
|
+
- name: Set up Ruby
|
|
113
|
+
uses: ruby/setup-ruby@v1
|
|
114
|
+
with:
|
|
115
|
+
ruby-version: ruby
|
|
116
|
+
bundler: none
|
|
117
|
+
- name: Update rubygems & bundler
|
|
118
|
+
run: gem update --system
|
|
119
|
+
- name: Install gems
|
|
120
|
+
run: |
|
|
121
|
+
bundle config set --local without libs:profilers
|
|
122
|
+
bundle install --jobs 4 --retry 3
|
|
123
|
+
- name: Set up vendored RBS source
|
|
124
|
+
run: bundle exec rake rust:rbs:sync
|
|
125
|
+
- name: Install Rust tools
|
|
126
|
+
run: |
|
|
127
|
+
rustup update --no-self-update stable
|
|
128
|
+
rustup default stable
|
|
129
|
+
- uses: actions/cache@v5
|
|
130
|
+
with:
|
|
131
|
+
path: |
|
|
132
|
+
~/.cargo/registry
|
|
133
|
+
~/.cargo/git
|
|
134
|
+
rust/target
|
|
135
|
+
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
|
|
136
|
+
restore-keys: |
|
|
137
|
+
${{ runner.os }}-cargo-
|
|
138
|
+
- name: Test publish ruby-rbs
|
|
139
|
+
run: bundle exec rake rust:publish:ruby-rbs
|
|
140
|
+
env:
|
|
141
|
+
RBS_RUST_PUBLISH_DRY_RUN: "1"
|
|
68
142
|
|
|
69
143
|
lint:
|
|
70
144
|
name: cargo:lint
|
|
71
145
|
runs-on: ubuntu-latest
|
|
72
146
|
steps:
|
|
73
147
|
- uses: actions/checkout@v6
|
|
148
|
+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
149
|
+
- name: Set up Ruby
|
|
150
|
+
uses: ruby/setup-ruby@v1
|
|
151
|
+
with:
|
|
152
|
+
ruby-version: ruby
|
|
153
|
+
bundler: none
|
|
154
|
+
- name: Update rubygems & bundler
|
|
155
|
+
run: gem update --system
|
|
156
|
+
- name: Install gems
|
|
157
|
+
run: |
|
|
158
|
+
bundle config set --local without libs:profilers
|
|
159
|
+
bundle install --jobs 4 --retry 3
|
|
160
|
+
- name: Set up vendored RBS source
|
|
161
|
+
run: bundle exec rake rust:rbs:sync
|
|
74
162
|
- name: Install Rust tools
|
|
75
163
|
run: |
|
|
76
164
|
rustup update --no-self-update stable
|
|
@@ -35,6 +35,9 @@ jobs:
|
|
|
35
35
|
bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
|
|
36
36
|
system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true
|
|
37
37
|
'
|
|
38
|
+
- name: Ignore Gemfile.lock's BUNDLED WITH on dev Ruby
|
|
39
|
+
if: ${{ matrix.ruby == 'ucrt' || matrix.ruby == 'mswin' }}
|
|
40
|
+
run: bundle config set --local version system
|
|
38
41
|
- name: bundle install
|
|
39
42
|
run: |
|
|
40
43
|
bundle config set without profilers libs
|
data/.gitignore
CHANGED
|
@@ -25,3 +25,7 @@ doc/
|
|
|
25
25
|
# For clangd's editor integration
|
|
26
26
|
ext/rbs_extension/compile_commands.json
|
|
27
27
|
ext/rbs_extension/.cache
|
|
28
|
+
|
|
29
|
+
# Rust crate vendored RBS source (managed by rake rust:rbs:sync or rust:rbs:symlink)
|
|
30
|
+
rust/ruby-rbs-sys/vendor/rbs/
|
|
31
|
+
rust/ruby-rbs/vendor/rbs/
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 4.0.3 (2026-06-18)
|
|
4
|
+
|
|
5
|
+
### Miscellaneous
|
|
6
|
+
|
|
7
|
+
* Fix Ruby CI failure with compressed `Zlib::GzipReader` test fixtures. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
8
|
+
* Fix flaky `DirSingletonTest#test_fchdir` and `DirSingletonTest#test_for_fd` under aggressive GC. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
9
|
+
* Fix Ruby head CI failure caused by the lockfile-pinned Bundler version. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
10
|
+
|
|
11
|
+
## 4.0.2 (2026-03-25)
|
|
12
|
+
|
|
13
|
+
### Library changes
|
|
14
|
+
|
|
15
|
+
#### rbs collection
|
|
16
|
+
|
|
17
|
+
* Fix: pathname not written to lockfile. ([#2889](https://github.com/ruby/rbs/pull/2889))
|
|
18
|
+
|
|
19
|
+
### Miscellaneous
|
|
20
|
+
|
|
21
|
+
* Fix test failure on Windows in `ruby/ruby` ([#2900](https://github.com/ruby/rbs/pull/2900))
|
|
22
|
+
* Fix test for Ruby 4.1 ([#2899](https://github.com/ruby/rbs/pull/2899))
|
|
23
|
+
|
|
3
24
|
## 4.0.1 (2026-03-23)
|
|
4
25
|
|
|
5
26
|
This is a minor release to fix Ruby CI failure, which was caused by symlinks included in the `rust` directory.
|
|
@@ -221,6 +242,14 @@ This release also introduces two language changes: type argument support for sin
|
|
|
221
242
|
* Skip loading ruby_memcheck ([#2349](https://github.com/ruby/rbs/pull/2349))
|
|
222
243
|
* Forcibly uninstall gems even if there is a dependency problem. ([#2346](https://github.com/ruby/rbs/pull/2346))
|
|
223
244
|
|
|
245
|
+
## 3.10.4 (2026-03-25)
|
|
246
|
+
|
|
247
|
+
### Library changes
|
|
248
|
+
|
|
249
|
+
#### rbs collection
|
|
250
|
+
|
|
251
|
+
* [Backport] [3.10] Fix: pathname not written to lockfile. ([#2896](https://github.com/ruby/rbs/pull/2896))
|
|
252
|
+
|
|
224
253
|
## 3.10.3 (2026-01-30)
|
|
225
254
|
|
|
226
255
|
This is a minor fix around the dependency to `tsort`.
|
data/Rakefile
CHANGED
|
@@ -199,6 +199,9 @@ task :validate => :compile do
|
|
|
199
199
|
libs << "rbs"
|
|
200
200
|
end
|
|
201
201
|
|
|
202
|
+
libs.delete("bigdecimal-math") or raise
|
|
203
|
+
libs.delete("bigdecimal") or raise
|
|
204
|
+
|
|
202
205
|
libs.each do |lib|
|
|
203
206
|
args = ["-r", lib]
|
|
204
207
|
|
|
@@ -545,3 +548,207 @@ task :prepare_profiling do
|
|
|
545
548
|
Rake::Task[:"templates"].invoke
|
|
546
549
|
Rake::Task[:"compile"].invoke
|
|
547
550
|
end
|
|
551
|
+
|
|
552
|
+
namespace :rust do
|
|
553
|
+
namespace :rbs do
|
|
554
|
+
RUST_DIR = File.expand_path("rust", __dir__)
|
|
555
|
+
RBS_VERSION_FILE = File.join(RUST_DIR, "rbs_version")
|
|
556
|
+
|
|
557
|
+
VENDOR_TARGETS = {
|
|
558
|
+
"ruby-rbs-sys" => %w[include src],
|
|
559
|
+
"ruby-rbs" => %w[config.yml],
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
desc "Sync vendored RBS source from the pinned version"
|
|
563
|
+
task :sync do
|
|
564
|
+
unless File.exist?(RBS_VERSION_FILE)
|
|
565
|
+
raise "#{RBS_VERSION_FILE} not found. Run `rake rust:rbs:pin[VERSION]` first."
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
version = File.read(RBS_VERSION_FILE).strip
|
|
569
|
+
raise "#{RBS_VERSION_FILE} is empty" if version.empty?
|
|
570
|
+
|
|
571
|
+
puts "Syncing vendor/rbs/ from #{version}..."
|
|
572
|
+
|
|
573
|
+
VENDOR_TARGETS.each do |crate, entries|
|
|
574
|
+
vendor_dir = File.join(RUST_DIR, crate, "vendor", "rbs")
|
|
575
|
+
|
|
576
|
+
puts " Copying files for #{crate}:"
|
|
577
|
+
chmod_R "u+w", vendor_dir, verbose: false if File.exist?(vendor_dir)
|
|
578
|
+
rm_rf vendor_dir, verbose: false
|
|
579
|
+
mkdir_p vendor_dir, verbose: false
|
|
580
|
+
|
|
581
|
+
entries.each do |entry|
|
|
582
|
+
target = File.join(vendor_dir, entry)
|
|
583
|
+
|
|
584
|
+
# Extract the entry from the pinned git tag using git archive
|
|
585
|
+
IO.popen(["git", "archive", "--format=tar", version, "--", entry], "rb") do |tar|
|
|
586
|
+
IO.popen(["tar", "xf", "-", "-C", vendor_dir], "wb") do |extract|
|
|
587
|
+
IO.copy_stream(tar, extract)
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
raise "Failed to extract #{entry} from #{version}" unless File.exist?(target)
|
|
592
|
+
puts " #{entry}"
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
# Make files read-only to prevent accidental edits
|
|
596
|
+
chmod_R "a-w", vendor_dir, verbose: false
|
|
597
|
+
end
|
|
598
|
+
|
|
599
|
+
puts "📦 Synced vendor/rbs/ from #{version} (read-only)"
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
desc "Pin a specific RBS version for Rust crates (e.g., rake rust:rbs:pin[v4.0.3])"
|
|
603
|
+
task :pin, [:version] do |_t, args|
|
|
604
|
+
version = args[:version] or raise "Usage: rake rust:rbs:pin[VERSION]"
|
|
605
|
+
|
|
606
|
+
# Verify the tag exists
|
|
607
|
+
unless system("git", "rev-parse", "--verify", "#{version}^{commit}", out: File::NULL, err: File::NULL)
|
|
608
|
+
raise "Tag #{version} not found"
|
|
609
|
+
end
|
|
610
|
+
|
|
611
|
+
File.write(RBS_VERSION_FILE, "#{version}\n")
|
|
612
|
+
puts "📌 Pinned RBS version to #{version}"
|
|
613
|
+
|
|
614
|
+
Rake::Task["rust:rbs:sync"].invoke
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
desc "Create symlinks from vendor/rbs/ to the repository root (for development/CI)"
|
|
618
|
+
task :symlink do
|
|
619
|
+
VENDOR_TARGETS.each do |crate, entries|
|
|
620
|
+
vendor_dir = File.join(RUST_DIR, crate, "vendor", "rbs")
|
|
621
|
+
|
|
622
|
+
puts "Setting up symlinks for #{crate}..."
|
|
623
|
+
entries.each do |entry|
|
|
624
|
+
puts " #{entry} -> repository root"
|
|
625
|
+
end
|
|
626
|
+
|
|
627
|
+
chmod_R "u+w", vendor_dir, verbose: false if File.exist?(vendor_dir)
|
|
628
|
+
rm_rf vendor_dir, verbose: false
|
|
629
|
+
mkdir_p vendor_dir, verbose: false
|
|
630
|
+
|
|
631
|
+
entries.each do |entry|
|
|
632
|
+
ln_s File.join("..", "..", "..", "..", entry), File.join(vendor_dir, entry), verbose: false
|
|
633
|
+
end
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
puts "🔗 Symlinked vendor/rbs/ to repository root"
|
|
637
|
+
end
|
|
638
|
+
end
|
|
639
|
+
|
|
640
|
+
namespace :publish do
|
|
641
|
+
def self.prepare_publish_branch(crate_name)
|
|
642
|
+
dry_run = ENV["RBS_RUST_PUBLISH_DRY_RUN"]
|
|
643
|
+
|
|
644
|
+
version_file = File.join(RUST_DIR, "rbs_version")
|
|
645
|
+
|
|
646
|
+
unless File.exist?(version_file)
|
|
647
|
+
raise "#{version_file} not found. Run `rake rust:rbs:pin[VERSION]` first."
|
|
648
|
+
end
|
|
649
|
+
|
|
650
|
+
rbs_version = File.read(version_file).strip
|
|
651
|
+
raise "#{version_file} is empty" if rbs_version.empty?
|
|
652
|
+
|
|
653
|
+
crate_version = File.read(File.join(RUST_DIR, crate_name, "Cargo.toml"))[/^version\s*=\s*"(.+)"/, 1]
|
|
654
|
+
release_branch = "rust/release-#{crate_name}-#{Time.now.strftime('%Y%m%d%H%M%S')}"
|
|
655
|
+
|
|
656
|
+
puts "=" * 60
|
|
657
|
+
puts "Rust crate publish: #{crate_name}#{dry_run ? " (DRY RUN)" : ""}"
|
|
658
|
+
puts "=" * 60
|
|
659
|
+
puts " RBS source version: #{rbs_version}"
|
|
660
|
+
puts " #{crate_name}: #{crate_version} (tag: #{crate_name}-v#{crate_version})"
|
|
661
|
+
puts " Release branch: #{release_branch}"
|
|
662
|
+
puts "=" * 60
|
|
663
|
+
|
|
664
|
+
# Check that vendor dirs contain real files, not symlinks
|
|
665
|
+
entries = VENDOR_TARGETS.fetch(crate_name)
|
|
666
|
+
entries.each do |entry|
|
|
667
|
+
path = File.join(RUST_DIR, crate_name, "vendor", "rbs", entry)
|
|
668
|
+
if File.symlink?(path)
|
|
669
|
+
raise "#{path} is a symlink. Run `rake rust:rbs:sync` first."
|
|
670
|
+
end
|
|
671
|
+
unless File.exist?(path)
|
|
672
|
+
raise "#{path} does not exist. Run `rake rust:rbs:sync` first."
|
|
673
|
+
end
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
# Ensure working tree is clean before publishing
|
|
677
|
+
unless `git status --porcelain`.strip.empty?
|
|
678
|
+
raise "💢 Working tree is dirty. Please commit or stash your changes before publishing."
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
# Create a release branch with vendor files committed
|
|
682
|
+
original_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
|
683
|
+
|
|
684
|
+
sh "git", "checkout", "-b", release_branch, verbose: false
|
|
685
|
+
vendor_path = File.join("rust", crate_name, "vendor", "rbs")
|
|
686
|
+
sh "git", "add", "-f", vendor_path, verbose: false
|
|
687
|
+
sh "git", "commit", "-m", "Publish #{crate_name} (RBS #{rbs_version})", verbose: false
|
|
688
|
+
|
|
689
|
+
[dry_run, crate_version, original_branch]
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
desc "Publish ruby-rbs-sys crate to crates.io (set RBS_RUST_PUBLISH_DRY_RUN=1 for dry-run only)"
|
|
693
|
+
task :"ruby-rbs-sys" do
|
|
694
|
+
crate_name = "ruby-rbs-sys"
|
|
695
|
+
dry_run, crate_version, original_branch = prepare_publish_branch(crate_name)
|
|
696
|
+
|
|
697
|
+
begin
|
|
698
|
+
puts "🔰 Dry-run publishing..."
|
|
699
|
+
|
|
700
|
+
Dir.chdir(File.join(RUST_DIR, crate_name)) do
|
|
701
|
+
sh "cargo", "publish", "--dry-run"
|
|
702
|
+
end
|
|
703
|
+
|
|
704
|
+
puts "✅ Dry-run succeeded!"
|
|
705
|
+
|
|
706
|
+
unless dry_run
|
|
707
|
+
puts "💪 Publishing #{crate_name} for real..."
|
|
708
|
+
|
|
709
|
+
Dir.chdir(File.join(RUST_DIR, crate_name)) do
|
|
710
|
+
sh "cargo", "publish"
|
|
711
|
+
end
|
|
712
|
+
|
|
713
|
+
sh "git", "tag", "#{crate_name}-v#{crate_version}"
|
|
714
|
+
sh "git", "push", "origin", "#{crate_name}-v#{crate_version}"
|
|
715
|
+
|
|
716
|
+
puts "🎉 Published #{crate_name} successfully!"
|
|
717
|
+
end
|
|
718
|
+
ensure
|
|
719
|
+
sh "git", "checkout", original_branch, verbose: false
|
|
720
|
+
end
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
desc "Publish ruby-rbs crate to crates.io (set RBS_RUST_PUBLISH_DRY_RUN=1 for dry-run only)"
|
|
724
|
+
task :"ruby-rbs" do
|
|
725
|
+
crate_name = "ruby-rbs"
|
|
726
|
+
dry_run, crate_version, original_branch = prepare_publish_branch(crate_name)
|
|
727
|
+
|
|
728
|
+
begin
|
|
729
|
+
puts "🔰 Dry-run publishing..."
|
|
730
|
+
|
|
731
|
+
Dir.chdir(File.join(RUST_DIR, crate_name)) do
|
|
732
|
+
sh "cargo", "publish", "--dry-run", "--no-verify"
|
|
733
|
+
end
|
|
734
|
+
|
|
735
|
+
puts "✅ Dry-run succeeded!"
|
|
736
|
+
|
|
737
|
+
unless dry_run
|
|
738
|
+
puts "💪 Publishing #{crate_name} for real..."
|
|
739
|
+
|
|
740
|
+
Dir.chdir(File.join(RUST_DIR, crate_name)) do
|
|
741
|
+
sh "cargo", "publish"
|
|
742
|
+
end
|
|
743
|
+
|
|
744
|
+
sh "git", "tag", "#{crate_name}-v#{crate_version}"
|
|
745
|
+
sh "git", "push", "origin", "#{crate_name}-v#{crate_version}"
|
|
746
|
+
|
|
747
|
+
puts "🎉 Published #{crate_name} successfully!"
|
|
748
|
+
end
|
|
749
|
+
ensure
|
|
750
|
+
sh "git", "checkout", original_branch, verbose: false
|
|
751
|
+
end
|
|
752
|
+
end
|
|
753
|
+
end
|
|
754
|
+
end
|
data/docs/rust.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Rust Crates
|
|
2
|
+
|
|
3
|
+
RBS provides two Rust crates:
|
|
4
|
+
|
|
5
|
+
- **`ruby-rbs-sys`** -- Low-level FFI bindings to the RBS C parser
|
|
6
|
+
- **`ruby-rbs`** -- High-level safe Rust API for parsing RBS signatures
|
|
7
|
+
|
|
8
|
+
Both crates are published to [crates.io](https://crates.io/) and are developed within the `rust/` directory of this repository.
|
|
9
|
+
|
|
10
|
+
## Vendored RBS Source
|
|
11
|
+
|
|
12
|
+
The Rust crates depend on the RBS C parser source code (`include/`, `src/`) and configuration (`config.yml`) from this repository. These files are vendored into each crate's `vendor/rbs/` directory, which is managed by Rake tasks and not tracked by git.
|
|
13
|
+
|
|
14
|
+
The file `rust/rbs_version` records which version of RBS the Rust crates are pinned to.
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
After cloning the repository, set up the vendored source before building the Rust crates:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
rake rust:rbs:sync # Uses the pinned version from rust/rbs_version
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then build and test:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cd rust
|
|
28
|
+
cargo test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Rake Tasks
|
|
32
|
+
|
|
33
|
+
### `rake rust:rbs:sync`
|
|
34
|
+
|
|
35
|
+
Copies the source files from the pinned version into each crate's `vendor/rbs/`. The copied files are made read-only to prevent accidental edits.
|
|
36
|
+
|
|
37
|
+
### `rake rust:rbs:pin[VERSION]`
|
|
38
|
+
|
|
39
|
+
Records a git tag in `rust/rbs_version`. For example:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
rake rust:rbs:pin[v4.0.3]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `rake rust:publish:ruby-rbs-sys` / `rake rust:publish:ruby-rbs`
|
|
46
|
+
|
|
47
|
+
Publishes each crate to crates.io individually. Each task:
|
|
48
|
+
|
|
49
|
+
1. Verifies `rust/rbs_version` is set
|
|
50
|
+
2. Verifies vendor directories contain real files (not symlinks)
|
|
51
|
+
3. Verifies the git working tree is clean
|
|
52
|
+
4. Creates a release branch and commits the vendor files
|
|
53
|
+
5. Runs a dry-run to check packaging
|
|
54
|
+
6. Publishes the crate
|
|
55
|
+
|
|
56
|
+
Set `RBS_RUST_PUBLISH_DRY_RUN=1` to only run the dry-run step and skip the actual publish to crates.io. This is used in CI to verify that the crates can be packaged correctly.
|
|
57
|
+
|
|
58
|
+
### `rake rust:rbs:symlink`
|
|
59
|
+
|
|
60
|
+
If your development needs unreleased version of RBS source code, use `rake rust:rbs:symlink` to set up symlinks in vendor directories to refer the worktree source code. Changes to the C parser source are immediately reflected in Rust builds.
|
|
61
|
+
|
|
62
|
+
## Publishing Workflow
|
|
63
|
+
|
|
64
|
+
1. Pin the RBS version to release against:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
rake rust:rbs:pin[v4.0.3]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
2. Sync the vendored source:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
rake rust:rbs:sync
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. Update crate versions in `rust/ruby-rbs-sys/Cargo.toml` and `rust/ruby-rbs/Cargo.toml`.
|
|
77
|
+
|
|
78
|
+
4. Build and test:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cd rust && cargo test
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
5. Commit the version changes and `rust/rbs_version`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git add rust/rbs_version rust/ruby-rbs-sys/Cargo.toml rust/ruby-rbs/Cargo.toml
|
|
88
|
+
git commit -m "Bump Rust crate versions"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
6. Publish each crate:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rake rust:publish:ruby-rbs-sys
|
|
95
|
+
rake rust:publish:ruby-rbs
|
|
96
|
+
```
|
|
@@ -188,8 +188,8 @@ module RBS
|
|
|
188
188
|
lockfile.gems[name] = { name: name, version: "0", source: source }
|
|
189
189
|
end
|
|
190
190
|
return
|
|
191
|
-
when 'set'
|
|
192
|
-
# set
|
|
191
|
+
when 'set'
|
|
192
|
+
# set is migrated to core from stdlib.
|
|
193
193
|
RBS.logger.info {
|
|
194
194
|
from = from_gem || "rbs_collection.yaml"
|
|
195
195
|
"`#{name}` is a part of the Ruby core library. The dependency to the library can be safely deleted from #{from}."
|
data/lib/rbs/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Soutaro Matsumoto
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 1980-01-
|
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logger
|
|
@@ -68,6 +68,7 @@ files:
|
|
|
68
68
|
- ".github/workflows/c-check.yml"
|
|
69
69
|
- ".github/workflows/comments.yml"
|
|
70
70
|
- ".github/workflows/dependabot.yml"
|
|
71
|
+
- ".github/workflows/milestone.yml"
|
|
71
72
|
- ".github/workflows/ruby.yml"
|
|
72
73
|
- ".github/workflows/rust.yml"
|
|
73
74
|
- ".github/workflows/typecheck.yml"
|
|
@@ -180,6 +181,7 @@ files:
|
|
|
180
181
|
- docs/inline.md
|
|
181
182
|
- docs/rbs_by_example.md
|
|
182
183
|
- docs/repo.md
|
|
184
|
+
- docs/rust.md
|
|
183
185
|
- docs/sigs.md
|
|
184
186
|
- docs/stdlib.md
|
|
185
187
|
- docs/syntax.md
|
|
@@ -624,7 +626,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
624
626
|
- !ruby/object:Gem::Version
|
|
625
627
|
version: '0'
|
|
626
628
|
requirements: []
|
|
627
|
-
rubygems_version: 4.0.
|
|
629
|
+
rubygems_version: 4.0.6
|
|
628
630
|
specification_version: 4
|
|
629
631
|
summary: Type signature for Ruby.
|
|
630
632
|
test_files: []
|