Skip to content

feat(dart): implement bump - #6989

Merged
brianquinlan merged 76 commits into
googleapis:mainfrom
brianquinlan:design_doc_ideas
Aug 7, 2026
Merged

feat(dart): implement bump#6989
brianquinlan merged 76 commits into
googleapis:mainfrom
brianquinlan:design_doc_ideas

Conversation

@brianquinlan

@brianquinlan brianquinlan commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

librarian bump works differently for Dart compared to other languages:

  1. bump for Dart does not work on single libraries
  2. bump for Dart uses analysis of the package interface as a heuristic to determine how much to bump the version
  3. bump also updates CHANGELOG.md and dependency constraints

Expected publishing workflow:

$ librarian update # update all SDK descriptions
$ librarian generate --all # regenerate all packages
$ git commit …
$ librarian bump --all # inc the version number of changed packages
$ git commit …
$ librarian publish # publish packages that were updated
$ librarian tag # create a git tag for each published package

Refactors:

  1. Moved FormatTagName and HasChangesIn to internal/librarian/bump.go from internal/git/git.go

Repository Package Release Algorithm (excluding edge cases)

  1. Find the dependencies of all packages in the repository.
  2. Order the packages topologically so that no package appears before any of its dependencies.
  3. For each package in order:
    • a. Check if any files have changed since the last release.
    • b. Use dart-apitool to determine the recommended next version.
    • c. If the version should be updated:
      • Update the version in pubspec.yaml.
      • Update CHANGELOG.md.
      • Update the dependencies: section of each dependent package.
      • Update the version for the package in cfg.Default.Dart.Packages if the package has an entry there.

@brianquinlan

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for bumping Dart packages in the workspace, utilizing dart-apitool to recommend version updates, updating pubspec.yaml and CHANGELOG.md files, and managing dependencies. It also refactors common git operations (FormatTagName and HasChangesIn) into the internal/git package. The review feedback highlights a bug in the manual version increment logic that prevents file updates and changelog generation, as well as a potential file collision issue when creating temporary reports in os.TempDir().

Comment thread internal/librarian/dart/bump.go Outdated
Comment thread internal/librarian/dart/bump.go Outdated
@brianquinlan

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for bumping Dart packages, adding dependency sorting, pubspec updates, and changelog generation, alongside refactoring git helper functions into the git package. The review feedback highlights several critical issues: potential corruption of nested dependencies in pubspec.yaml due to line-by-line replacement, a potential crash in recommendedVersion when a package is not yet published, a security/collision risk from using a predictable temporary file path, and incorrect matching of nested version fields. Additionally, a style improvement was suggested to remove an unnecessary else block after a return statement.

Comment thread internal/librarian/dart/pubspec.go
Comment thread internal/librarian/dart/bump.go
Comment thread internal/librarian/dart/bump.go
Comment thread internal/librarian/dart/bump.go Outdated
Comment thread internal/librarian/dart/pubspec.go Outdated
@brianquinlan

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for bumping Dart packages in the workspace. It adds a new internal/librarian/dart package that implements the bumping logic, including dependency sorting, version recommendations using dart-apitool, and updating pubspec.yaml and CHANGELOG.md. It also refactors common Git helper functions into internal/git. The review feedback highlights several improvement opportunities: ensuring the version: field update in pubspec.yaml only matches top-level keys, avoiding indented success flows after error checks, removing an unused newDeps map, and using os.CreateTemp to safely generate unique temporary files.

Comment thread internal/librarian/dart/pubspec.go Outdated
Comment thread internal/librarian/dart/bump.go Outdated
Comment thread internal/librarian/dart/bump.go
Comment thread internal/librarian/dart/bump.go Outdated
brianquinlan and others added 4 commits July 23, 2026 17:51
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Brian Quinlan <bquinlan@google.com>
@brianquinlan

Copy link
Copy Markdown
Contributor Author

I'm away all next week so there is no hurry for this review.

Comment thread internal/git/git.go
Comment thread internal/librarian/dart/pubspec.go
@brianquinlan
brianquinlan enabled auto-merge (squash) August 6, 2026 16:52
@brianquinlan
brianquinlan merged commit 5505997 into googleapis:main Aug 7, 2026
40 checks passed
@brianquinlan
brianquinlan deleted the design_doc_ideas branch August 7, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants