Skip to content

Use "2026" in copyright header to generate code in google-cloud-ruby before Librarian migration #35038

Description

@suztomo

In coming weeks, we'll onboard the libraries in google-cloud-ruby to Librarian, which uses protoc 33.2. The resulting migration pull request would have code diffs about copyright header year because the OwlBot postprocessor has a logic to keep the copyright year if a code change only contains copyright year change. With Librarian, we stop doing that because bumping copyright header year once a year, in a controlled schedule, is not a problem.

Image

When we migrate hundreds of Gem folders in batches and humans need to review the changes, it would be ideal if the Ruby team uplift the google-cloud-ruby version to use 2026 with current Bazel-based code generation before batched Librarian migrations. With this uplifting, the librarian migration pull requests are focused on the Librarian-related changes.

Implementation of current logic

The current logic of preserving copyright year is at https://github.com/googleapis/ruby-common-tools/blob/627339bd54393ba09ec414d7f413f14091eeeaa6/owlbot-postprocessor/lib/owlbot/common_modifiers.rb#L33-L44

    ##
    # A convenience method that installs a modifier preserving copyright years
    # in existing files.
    #
    # @param path [String,Regexp,Array<String,Regexp>] Optional path filter(s)
    #     determining whether this modifier will run. Defaults to
    #     `[/Rakefile$/, /\.rb$/, /\.gemspec$/, /Gemfile$/]`.
    # @param name [String] Optional name for the modifier to add. Defaults to
    #     `"preserve_existing_copyright_years"`.
    #
    def preserve_existing_copyright_years path: nil, name: nil
      path ||= [/Rakefile$/, /\.rb$/, /\.gemspec$/, /Gemfile$/]
      name ||= "preserve_existing_copyright_years"
      modifier path: path, name: name do |src, dest|
        if src && dest
          regex = /^# Copyright (\d{4}) Google LLC$/
          match = regex.match dest
          src = src.sub regex, "# Copyright #{match[1]} Google LLC" if match
        end
        src
      end
    end

...

    ##
    # Install the default modifiers. This includes:
    #
    # * A modifier named `"preserve_existing_copyright_years"` which ensures
    #   the copyright year of existing files is not modified.
...
    def install_default_modifiers
      preserve_existing_copyright_years
...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions