)]}'
{
  "commit": "21cca7613ea893f44f2431f8dc138b12304021b6",
  "tree": "bd493d8060154d29108ed071cb86c79a98ccb588",
  "parents": [
    "dc33073afd16590f93468b18d1131a88e5709649"
  ],
  "author": {
    "name": "Ufuk Kayserilioglu",
    "email": "ufuk.kayserilioglu@shopify.com",
    "time": "Mon Oct 19 11:00:29 2026 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Oct 19 11:16:19 2026 -0700"
  },
  "message": "Ruby: define Google::Protobuf::VERSION in lib/google/protobuf/version.rb (#30762)\n\n### Motivation\n\nThe `google-protobuf` gem does not expose its version in Ruby code. The version is only a string literal in `ruby/google-protobuf.gemspec`. Most gems define a `VERSION` constant in `lib/\u003cgem\u003e/version.rb`, and the gemspec reads it from there. This lets applications and tools read the version at runtime with `Google::Protobuf::VERSION`.\n\n### Changes\n\n- Add `ruby/lib/google/protobuf/version.rb`, which defines `Google::Protobuf::VERSION`.\n- Make `ruby/google-protobuf.gemspec` read `s.version` from `Google::Protobuf::VERSION`.\n- Require `google/protobuf/version` at the end of `ruby/lib/google/protobuf.rb`, so the constant is available after `require \"google/protobuf\"`.\n- Add `//ruby/lib/google:protobuf/version.rb` to the `rb_bundle_fetch` sources in `WORKSPACE`, because the gemspec now requires the file.\n\n### Required change to the internal version update tool\n\n\u003e [!IMPORTANT]\n\u003e The internal version update tool (the `update_versions` library that makes the \"Updating version.json and repo version numbers\" commits) must change after this PR merges.\n\nThe tool currently writes the Ruby version into `ruby/google-protobuf.gemspec`. The legacy `update_version.py` (removed in #9983) used this pattern:\n\n```python\nRewriteTextFile(\u0027ruby/google-protobuf.gemspec\u0027,\n  lambda line : re.sub(\n    r\u0027^  s.version     \u003d \".*\"$\u0027,\n    \u0027  s.version     \u003d \"%s\"\u0027 % GetFullVersion(rc_suffix \u003d \u0027.rc.\u0027),\n    line))\n```\n\nAfter this PR, the gemspec does not contain a version literal, so that pattern matches nothing. The tool must write the version into `ruby/lib/google/protobuf/version.rb` instead, for example:\n\n```python\nRewriteTextFile(\u0027ruby/lib/google/protobuf/version.rb\u0027,\n  lambda line : re.sub(\n    r\u0027^    VERSION \u003d \".*\"$\u0027,\n    \u0027    VERSION \u003d \"%s\"\u0027 % GetFullVersion(rc_suffix \u003d \u0027.rc.\u0027),\n    line))\n```\n\nIf the tool does not change, the next version bump will leave `version.rb` at the old version without an error, and the gem will be published with the wrong version. `PROTOBUF_RUBY_VERSION` in `protobuf_version.bzl` still names the `.gem` file in the Bazel release rules, so the tool must continue to update both values.\n\nCloses #30762\n\nCOPYBARA_INTEGRATE_REVIEW\u003dhttps://github.com/protocolbuffers/protobuf/pull/30762 from Shopify:uk-add-version-file 36692bbd9ae1561d54622086f4c0e56ddb69fab1\nPiperOrigin-RevId: 1002455477\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c05fe00f5a7576ff3705483cbe8043b505297419",
      "old_mode": 33188,
      "old_path": "WORKSPACE",
      "new_id": "05652a2edc9089b8f0b8b8477af22a4f8f45eaa3",
      "new_mode": 33188,
      "new_path": "WORKSPACE"
    },
    {
      "type": "modify",
      "old_id": "0a4ce403555336230f061a6a52422f7010418094",
      "old_mode": 33188,
      "old_path": "ruby/google-protobuf.gemspec",
      "new_id": "8ea45d8614cd856099a2319838ddc9ac10be7786",
      "new_mode": 33188,
      "new_path": "ruby/google-protobuf.gemspec"
    },
    {
      "type": "modify",
      "old_id": "fdfa9b687ee241d095a4f3487ac83da53f113ff7",
      "old_mode": 33188,
      "old_path": "ruby/lib/google/protobuf.rb",
      "new_id": "63496442e9ac2d03a6850a65d79d7d10e631a66e",
      "new_mode": 33188,
      "new_path": "ruby/lib/google/protobuf.rb"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "dcf2603891e16a3bccc258a299a18326fc666791",
      "new_mode": 33188,
      "new_path": "ruby/lib/google/protobuf/version.rb"
    }
  ]
}
