diff --git a/Gemfile.lock b/Gemfile.lock index 09e274a4c5..909cb8fbd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ diff --git a/docs/releasing.md b/docs/releasing.md index 53aa609e1f..d8d32922e0 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -23,9 +23,10 @@ ruby -pi -e 'gsub(/PRISM_VERSION_PATCH \d+/, %Q{PRISM_VERSION_PATCH #{ENV["PRISM ruby -pi -e 'gsub(/PRISM_VERSION ".+?"/, %Q{PRISM_VERSION "#{ENV["PRISM_VERSION"]}"})' include/prism/version.h ruby -pi -e 'gsub(/"version": ".+?"/, %Q{"version": "#{ENV["PRISM_VERSION"]}"})' javascript/package.json ruby -pi -e 'gsub(/lossy\(\), ".+?"/, %Q{lossy(), "#{ENV["PRISM_VERSION"]}"})' rust/ruby-prism-sys/tests/utils_tests.rs -ruby -pi -e 'gsub(/\d+, "prism major/, %Q{#{ENV["PRISM_MAJOR"]}, "prism major})' templates/java/org/ruby_lang/prism/Loader.java.erb -ruby -pi -e 'gsub(/\d+, "prism minor/, %Q{#{ENV["PRISM_MINOR"]}, "prism minor})' templates/java/org/ruby_lang/prism/Loader.java.erb -ruby -pi -e 'gsub(/\d+, "prism patch/, %Q{#{ENV["PRISM_PATCH"]}, "prism patch})' templates/java/org/ruby_lang/prism/Loader.java.erb +ruby -pi -e 'gsub(/assertEquals\(".+?", prism.version\(\)\)/, %Q{assertEquals("#{ENV["PRISM_VERSION"]}", prism.version())})' java/wasm/src/test/java/org/jruby/parser/prism/WASMTest.java +ruby -pi -e 'gsub(/\d+, "prism major/, %Q{#{ENV["PRISM_MAJOR"]}, "prism major})' templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb +ruby -pi -e 'gsub(/\d+, "prism minor/, %Q{#{ENV["PRISM_MINOR"]}, "prism minor})' templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb +ruby -pi -e 'gsub(/\d+, "prism patch/, %Q{#{ENV["PRISM_PATCH"]}, "prism patch})' templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb ruby -pi -e 'gsub(/MAJOR_VERSION = \d+/, %Q{MAJOR_VERSION = #{ENV["PRISM_MAJOR"]}})' templates/javascript/src/deserialize.js.erb ruby -pi -e 'gsub(/MINOR_VERSION = \d+/, %Q{MINOR_VERSION = #{ENV["PRISM_MINOR"]}})' templates/javascript/src/deserialize.js.erb ruby -pi -e 'gsub(/PATCH_VERSION = \d+/, %Q{PATCH_VERSION = #{ENV["PRISM_PATCH"]}})' templates/javascript/src/deserialize.js.erb diff --git a/ext/prism/extension.h b/ext/prism/extension.h index 7959cd8613..55e6b5175e 100644 --- a/ext/prism/extension.h +++ b/ext/prism/extension.h @@ -1,7 +1,7 @@ #ifndef PRISM_EXT_NODE_H #define PRISM_EXT_NODE_H -#define EXPECTED_PRISM_VERSION "1.9.0" +#define EXPECTED_PRISM_VERSION "2.0.0.rc1" #include #include diff --git a/gemfiles/2.7/Gemfile.lock b/gemfiles/2.7/Gemfile.lock index 152ff8a21f..ac91cd02fa 100644 --- a/gemfiles/2.7/Gemfile.lock +++ b/gemfiles/2.7/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) diff --git a/gemfiles/3.0/Gemfile.lock b/gemfiles/3.0/Gemfile.lock index c77bd64fbd..94110f3d06 100644 --- a/gemfiles/3.0/Gemfile.lock +++ b/gemfiles/3.0/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) diff --git a/gemfiles/3.1/Gemfile.lock b/gemfiles/3.1/Gemfile.lock index ae7f862e2f..2e145f8701 100644 --- a/gemfiles/3.1/Gemfile.lock +++ b/gemfiles/3.1/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) diff --git a/gemfiles/3.2/Gemfile.lock b/gemfiles/3.2/Gemfile.lock index a0aafd5318..a58def2a2a 100644 --- a/gemfiles/3.2/Gemfile.lock +++ b/gemfiles/3.2/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) @@ -19,7 +19,7 @@ GEM ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) - sexp_processor (4.17.5) + sexp_processor (4.17.6) test-unit (3.7.8) power_assert diff --git a/gemfiles/3.3/Gemfile.lock b/gemfiles/3.3/Gemfile.lock index 30c8a2eb65..1af4495fd0 100644 --- a/gemfiles/3.3/Gemfile.lock +++ b/gemfiles/3.3/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) @@ -19,7 +19,7 @@ GEM ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) - sexp_processor (4.17.5) + sexp_processor (4.17.6) test-unit (3.7.8) power_assert diff --git a/gemfiles/3.4/Gemfile.lock b/gemfiles/3.4/Gemfile.lock index c4be36ee78..db9d181ba4 100644 --- a/gemfiles/3.4/Gemfile.lock +++ b/gemfiles/3.4/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) @@ -19,7 +19,7 @@ GEM ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) - sexp_processor (4.17.5) + sexp_processor (4.17.6) test-unit (3.7.8) power_assert diff --git a/gemfiles/4.0/Gemfile.lock b/gemfiles/4.0/Gemfile.lock index 2eb78e541a..fc18232f4a 100644 --- a/gemfiles/4.0/Gemfile.lock +++ b/gemfiles/4.0/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM parser (3.3.12.0) ast (~> 2.4.1) racc - power_assert (3.0.1) + power_assert (3.1.0) racc (1.8.1) rake (13.4.2) rake-compiler (1.3.2) @@ -19,7 +19,7 @@ GEM ruby_parser (3.22.0) racc (~> 1.5) sexp_processor (~> 4.16) - sexp_processor (4.17.5) + sexp_processor (4.17.6) test-unit (3.7.8) power_assert diff --git a/gemfiles/4.1/Gemfile.lock b/gemfiles/4.1/Gemfile.lock index f93d7a1ce6..a44e78ba25 100644 --- a/gemfiles/4.1/Gemfile.lock +++ b/gemfiles/4.1/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - prism (1.9.0) + prism (2.0.0.rc1) GEM remote: https://rubygems.org/ diff --git a/include/prism/version.h b/include/prism/version.h index 181b398462..c67b8a5970 100644 --- a/include/prism/version.h +++ b/include/prism/version.h @@ -11,12 +11,12 @@ /** * The major version of the Prism library as an int. */ -#define PRISM_VERSION_MAJOR 1 +#define PRISM_VERSION_MAJOR 2 /** * The minor version of the Prism library as an int. */ -#define PRISM_VERSION_MINOR 9 +#define PRISM_VERSION_MINOR 0 /** * The patch version of the Prism library as an int. @@ -26,7 +26,7 @@ /** * The version of the Prism library as a constant string. */ -#define PRISM_VERSION "1.9.0" +#define PRISM_VERSION "2.0.0.rc1" /** * The prism version and the serialization format. diff --git a/java/wasm/src/test/java/org/jruby/parser/prism/WASMTest.java b/java/wasm/src/test/java/org/jruby/parser/prism/WASMTest.java index 1ed4ffbc83..e6a0cc5d36 100644 --- a/java/wasm/src/test/java/org/jruby/parser/prism/WASMTest.java +++ b/java/wasm/src/test/java/org/jruby/parser/prism/WASMTest.java @@ -88,7 +88,7 @@ public void testMBCIdentifier() { @Test public void testVersion() { try (Prism prism = new Prism()) { - assertEquals("1.9.0", prism.version()); + assertEquals("2.0.0.rc1", prism.version()); } } } diff --git a/javascript/package.json b/javascript/package.json index bbdcef849f..359ad16d1e 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@ruby/prism", - "version": "1.9.0", + "version": "2.0.0-rc.1", "description": "Prism Ruby parser", "type": "module", "main": "src/index.js", diff --git a/prism.gemspec b/prism.gemspec index db4b311ca3..5223f75eb2 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "prism" - spec.version = "1.9.0" + spec.version = "2.0.0.rc1" spec.authors = ["Shopify"] spec.email = ["ruby@shopify.com"] diff --git a/rakelib/cargo.rake b/rakelib/cargo.rake index df2be8dfaf..b22a2dde56 100644 --- a/rakelib/cargo.rake +++ b/rakelib/cargo.rake @@ -1,4 +1,17 @@ namespace :cargo do + module GemspecVersion + def self.version(gemspec) + version = gemspec.version + + if version.prerelease? + major, minor, patch, rc, prerelease = version.segments + "#{major}.#{minor}.#{patch}-#{rc}.#{prerelease}" + else + version.to_s + end + end + end + CRATES = ["ruby-prism-sys", "ruby-prism"] desc "Build and test the Rust packages" @@ -7,9 +20,10 @@ namespace :cargo do require "yaml" gemspec = Gem::Specification.load("prism.gemspec") + version = GemspecVersion.version(gemspec) prism_sys_dir = Pathname(File.expand_path(File.join(__dir__, "../rust", "ruby-prism-sys"))) - prism_sys_vendor_dir = prism_sys_dir.join("vendor/prism-#{gemspec.version}") + prism_sys_vendor_dir = prism_sys_dir.join("vendor/prism-#{version}") rm_rf(prism_sys_dir.join("vendor")) mkdir_p(prism_sys_vendor_dir) @@ -17,7 +31,7 @@ namespace :cargo do cp_r("./src", prism_sys_vendor_dir.join("src")) prism_dir = Pathname(File.expand_path(File.join(__dir__, "../rust", "ruby-prism"))) - prism_vendor_dir = prism_dir.join("vendor/prism-#{gemspec.version}") + prism_vendor_dir = prism_dir.join("vendor/prism-#{version}") rm_rf(prism_dir.join("vendor")) mkdir_p(prism_vendor_dir) @@ -32,8 +46,8 @@ namespace :cargo do cargo_toml_path = Pathname.new("rust/#{crate}/Cargo.toml") old_cargo_toml = cargo_toml_path.read new_cargo_toml = old_cargo_toml - .gsub(/^version = ".*"/, %(version = "#{gemspec.version}")) - .gsub(/^ruby-prism-sys = { version = ".*",/, %(ruby-prism-sys = { version = "#{gemspec.version}",)) + .gsub(/^version = ".*"/, %(version = "#{version}")) + .gsub(/^ruby-prism-sys = { version = ".*",/, %(ruby-prism-sys = { version = "#{version}",)) File.write(cargo_toml_path, new_cargo_toml) end @@ -42,6 +56,7 @@ namespace :cargo do desc "Regenerate the pregenerated bindings for ruby-prism-sys" task bindings: [:build] do gemspec = Gem::Specification.load("prism.gemspec") + version = GemspecVersion.version(gemspec) generated_path = File.expand_path("../rust/target/pregenerated-bindings.rs", __dir__) mkdir_p(File.dirname(generated_path)) @@ -56,7 +71,7 @@ namespace :cargo do header = <<~HEADER /* Generated by `bundle exec rake cargo:bindings`. Do not edit by hand. - * prism #{gemspec.version}, bindgen #{bindgen_version}, layout_tests(false) + * prism #{version}, bindgen #{bindgen_version}, layout_tests(false) * so the file stays portable across pointer widths. */ HEADER diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 3d0daac31e..55cbc4ac43 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -193,7 +193,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "ruby-prism" -version = "1.9.0" +version = "2.0.0-rc.1" dependencies = [ "ruby-prism-sys", "serde", @@ -202,7 +202,7 @@ dependencies = [ [[package]] name = "ruby-prism-sys" -version = "1.9.0" +version = "2.0.0-rc.1" dependencies = [ "bindgen", "cc", diff --git a/rust/ruby-prism-sys/Cargo.toml b/rust/ruby-prism-sys/Cargo.toml index 8070de3682..f3856f9a68 100644 --- a/rust/ruby-prism-sys/Cargo.toml +++ b/rust/ruby-prism-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruby-prism-sys" -version = "1.9.0" +version = "2.0.0-rc.1" edition = "2021" license = "MIT" repository = "https://github.com/ruby/prism" diff --git a/rust/ruby-prism-sys/src/bindings.rs b/rust/ruby-prism-sys/src/bindings.rs index 95426a8404..d5085d457e 100644 --- a/rust/ruby-prism-sys/src/bindings.rs +++ b/rust/ruby-prism-sys/src/bindings.rs @@ -1,5 +1,5 @@ /* Generated by `bundle exec rake cargo:bindings`. Do not edit by hand. - * prism 1.9.0, bindgen 0.73.2, layout_tests(false) + * prism 2.0.0-rc.1, bindgen 0.73.2, layout_tests(false) * so the file stays portable across pointer widths. */ /* automatically generated by rust-bindgen 0.73.2 */ diff --git a/rust/ruby-prism-sys/tests/utils_tests.rs b/rust/ruby-prism-sys/tests/utils_tests.rs index c619765c63..3492345add 100644 --- a/rust/ruby-prism-sys/tests/utils_tests.rs +++ b/rust/ruby-prism-sys/tests/utils_tests.rs @@ -9,5 +9,5 @@ fn version_test() { CStr::from_ptr(version) }; - assert_eq!(&cstring.to_string_lossy(), "1.9.0"); + assert_eq!(&cstring.to_string_lossy(), "2.0.0.rc1"); } diff --git a/rust/ruby-prism/Cargo.toml b/rust/ruby-prism/Cargo.toml index 302780399c..efa945e75e 100644 --- a/rust/ruby-prism/Cargo.toml +++ b/rust/ruby-prism/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruby-prism" -version = "1.9.0" +version = "2.0.0-rc.1" edition = "2021" license = "MIT" repository = "https://github.com/ruby/prism" @@ -26,7 +26,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" [dependencies] -ruby-prism-sys = { version = "1.9.0", path = "../ruby-prism-sys" } +ruby-prism-sys = { version = "2.0.0-rc.1", path = "../ruby-prism-sys" } [features] default = ["vendored"] diff --git a/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb b/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb index f1785e5d30..ec7e56b70a 100644 --- a/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb +++ b/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb @@ -81,8 +81,8 @@ public class Loader { expect((byte) 'S', "incorrect prism header"); expect((byte) 'M', "incorrect prism header"); - expect((byte) 1, "prism major version does not match"); - expect((byte) 9, "prism minor version does not match"); + expect((byte) 2, "prism major version does not match"); + expect((byte) 0, "prism minor version does not match"); expect((byte) 0, "prism patch version does not match"); expect((byte) 1, "Loader.java requires no location fields in the serialized output"); diff --git a/templates/javascript/src/deserialize.js.erb b/templates/javascript/src/deserialize.js.erb index e00e0f26a9..9c02fd0e5c 100644 --- a/templates/javascript/src/deserialize.js.erb +++ b/templates/javascript/src/deserialize.js.erb @@ -3,8 +3,8 @@ import { getDecoder } from "./decoding.js"; import { Location } from "./location.js"; import { Source } from "./source.js"; -const MAJOR_VERSION = 1; -const MINOR_VERSION = 9; +const MAJOR_VERSION = 2; +const MINOR_VERSION = 0; const PATCH_VERSION = 0; /* The DataView getFloat64 function takes an optional second argument that diff --git a/templates/lib/prism/serialize.rb.erb b/templates/lib/prism/serialize.rb.erb index d6e92ab5e7..87fdd10366 100644 --- a/templates/lib/prism/serialize.rb.erb +++ b/templates/lib/prism/serialize.rb.erb @@ -9,11 +9,11 @@ module Prism module Serialize # :nodoc: # The major version of prism that we are expecting to find in the serialized # strings. - MAJOR_VERSION = 1 + MAJOR_VERSION = 2 # The minor version of prism that we are expecting to find in the serialized # strings. - MINOR_VERSION = 9 + MINOR_VERSION = 0 # The patch version of prism that we are expecting to find in the serialized # strings. diff --git a/test/prism/ractor_test.rb b/test/prism/ractor_test.rb index 0e008ffb08..fa8bef0f8d 100644 --- a/test/prism/ractor_test.rb +++ b/test/prism/ractor_test.rb @@ -7,7 +7,7 @@ module Prism class RactorTest < TestCase def test_version - assert_match(/\A\d+\.\d+\.\d+\z/, with_ractor { Prism::VERSION }) + assert_match(/\A\d+\.\d+\.\d+(\.rc\d+)?\z/, with_ractor { Prism::VERSION }) end def test_parse_file