Skip to content

feat(dart): implement bump - #6989

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

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.

@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 Resolved
Comment thread internal/librarian/dart/bump.go Resolved
@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 Resolved
Comment thread internal/librarian/dart/bump.go Resolved
Comment thread internal/librarian/dart/bump.go Resolved
Comment thread internal/librarian/dart/bump.go Resolved
Comment thread internal/librarian/dart/pubspec.go Resolved
@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 Resolved
Comment thread internal/librarian/dart/bump.go Resolved
Comment thread internal/librarian/dart/bump.go Resolved
Comment thread internal/librarian/dart/bump.go Resolved
brianquinlan and others added 4 commits July 23, 2026 17:51
@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 Resolved
Comment thread internal/librarian/dart/pubspec.go Resolved
@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
JoeWang1127 pushed a commit that referenced this pull request Aug 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.34.0](v0.33.0...v0.34.0)
(2026-08-08)


### Features

* **dart:** add a setup skill
([#7193](#7193))
([d322aa0](d322aa0))
* **dart:** implement bump
([#6989](#6989))
([5505997](5505997))
* **internal/librarian/php:** derive component name with config override
in generate
([#7197](#7197))
([557e664](557e664)),
refs [#7025](#7025)
* **internal/librarian/php:** derive lowercase hyphenated php library
names from api path
([#7215](#7215))
([4669112](4669112))
* **internal/librarian/php:** initialize new component before generation
([#7225](#7225))
([b6c50b4](b6c50b4))
* **internal/librarian/ruby:** support deleting output paths after
generation
([#7223](#7223))
([609ffb7](609ffb7)),
refs [#6633](#6633)
* **internal/librarian/rust:** support external type conversions
([#7212](#7212))
([5b72c52](5b72c52)),
refs [#7144](#7144)
* **internal/proto:** add package to gather proto files
([#7218](#7218))
([9646f09](9646f09)),
refs [#7217](#7217)
* **internal/sidekick/rust:** initialize bidi streaming RPCs eagerly
([#7221](#7221))
([cbfa368](cbfa368)),
refs [#6835](#6835)
* **internal/sidekick/rust:** support type-erased streaming handles
([#7229](#7229))
([17f5a3d](17f5a3d)),
refs [#6835](#6835)
* **internal/sidekick/rust:** use builder pattern for bidi methods
([#7203](#7203))
([bc90045](bc90045)),
refs [#6835](#6835)
* **internal/tool/composer:** use entrypoint configuration instead of
package names
([#7156](#7156))
([e33192f](e33192f))
* **sidekick/rust:** bigquery query creation metadata
([#7167](#7167))
([d70f2a2](d70f2a2))
* **swift:** conversions support map fields
([#7222](#7222))
([341f1e5](341f1e5))
* **swift:** protobuf conversions support oneofs
([#7205](#7205))
([40c48df](40c48df))
* **swift:** support skipped_ids in configuration
([#7206](#7206))
([95d3464](95d3464))


### Bug Fixes

* **internal/librarian/php:** remove version suffix from init namespace
([#7227](#7227))
([7fb3b46](7fb3b46))
* **internal/librarian/ruby:** pass gem namespace option to generator
([#7210](#7210))
([817146f](817146f))
* **internal/librarian/ruby:** pass service override option to generator
([#7208](#7208))
([e9886bf](e9886bf)),
refs [#6633](#6633)
* **internal/librarian/ruby:** search proto recursively in API path
([#7220](#7220))
([3d4a4a1](3d4a4a1)),
refs [#7219](#7219)
[#7217](#7217)
* **internal/librarian/rust:** preserve parent messages of used types
([#7170](#7170))
([e51520c](e51520c)),
refs [#7143](#7143)
* **internal/serviceconfig:** update config for compute
([#7200](#7200))
([a08e565](a08e565))
* **internal/sidekick/rust:** use from for repeated enum conversions in
convert-prost
([#7211](#7211))
([ee4fb71](ee4fb71))


### Performance Improvements

* **java:** batch format all libraries using argument file
([#7186](#7186))
([5a7775a](5a7775a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit to sofisl/librarian that referenced this pull request Aug 10, 2026
`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:

```bash
$ 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.

---------

Signed-off-by: Brian Quinlan <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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