Skip to content

[tool] Restore publishability#11745

Merged
auto-submit[bot] merged 9 commits into
flutter:mainfrom
stuartmorgan-g:tool-publishability
May 21, 2026
Merged

[tool] Restore publishability#11745
auto-submit[bot] merged 9 commits into
flutter:mainfrom
stuartmorgan-g:tool-publishability

Conversation

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Restores the repo tooling to a publishable state, so that we can start using it for flutter/core-packages.

I expect fixes will be necessary to make it actually work correctly in that repo, but this gives us a foundation to iterate from where we can actually publish and test changes:

  • Removes publish_to: none
  • Restores the old CHANGELOG, and adds a new entry for the new version.
  • Moves the formatter download cache to the repo root instead of a directory that other repo's wont have
  • Changes the setup to find the repo root by walking up from the current directory until finding something that looks like the repo root, rather than hard-coding a relative path from the invoked script.
  • Adds back some initial documentation about how to use this in another repo. Having two ways of running it was always confusing to explain, so this tries a new approach of demonstrating setting up an alias, and then having all the examples use that alias. We may need to iterate if that proves confusing (to people and/or to AI agents)

Fixes flutter/flutter#185764

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 20, 2026

@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 refactors the repository tooling to support global installation and improves repository root detection by replacing hardcoded paths with a dynamic discovery mechanism. It introduces a centralized .repo_tool_cache for managing external Java and Kotlin formatters and updates the documentation to include setup instructions for both local and global usage. Review feedback highlights the need for robust error handling during formatter downloads, improved repository root detection to accommodate git worktrees, and the correction of syntax errors in the README's shell examples. Additionally, a concern was raised regarding side effects within the cache directory resolution utility.

Comment thread script/tool/README.md
Comment thread script/tool/README.md
Comment thread script/tool/lib/src/common/core.dart
Comment thread script/tool/lib/src/main.dart Outdated
Comment on lines 482 to +483
final http.Response response = await http.get(_javaFormatterUrl);
javaFormatterFile.writeAsBytesSync(response.bodyBytes);
file.writeAsBytesSync(response.bodyBytes);

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.

medium

The HTTP request lacks error handling. If the download fails (e.g., due to a 404 error or network issues), the tool will write the error response body to the JAR file, causing obscure errors when it later attempts to execute it. Verify the status code before writing.

      final http.Response response = await http.get(_javaFormatterUrl);
      if (response.statusCode != 200) {
        print('Failed to download Google Java Format (error ${response.statusCode})');
        throw ToolExit(1);
      }
      file.writeAsBytesSync(response.bodyBytes);

Comment on lines 494 to +495
final http.Response response = await http.get(_kotlinFormatterUrl);
kotlinFormatterFile.writeAsBytesSync(response.bodyBytes);
file.writeAsBytesSync(response.bodyBytes);

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.

medium

The HTTP request lacks error handling. Verify the status code before writing the bytes to the file.

      final http.Response response = await http.get(_kotlinFormatterUrl);
      if (response.statusCode != 200) {
        print('Failed to download ktfmt (error ${response.statusCode})');
        throw ToolExit(1);
      }
      file.writeAsBytesSync(response.bodyBytes);

@github-actions github-actions Bot removed the CICD Run CI/CD label May 20, 2026
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label May 20, 2026

@tarrinneal tarrinneal 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.

Not sure if I like the alias swap, but I guess it's more readable.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label May 21, 2026
@auto-submit auto-submit Bot merged commit 3754d04 into flutter:main May 21, 2026
83 checks passed
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator Author

For posterity in case it ends up being confusing: I'm not going to bother publishing this version of the tool (it's still manual), since we still need some other fixes before it will be usable in core-packages. In retrospect I should have not included the version bump yet. I'll do another bump when it's ready to publish.

@stuartmorgan-g stuartmorgan-g deleted the tool-publishability branch May 21, 2026 14:31
pull Bot pushed a commit to safarmer/flutter that referenced this pull request May 21, 2026
…r#186888)

flutter/packages@1dfbada...3754d04

2026-05-21 stuartmorgan@google.com [tool] Restore publishability
(flutter/packages#11745)
2026-05-20 engine-flutter-autoroll@skia.org Roll Flutter from
259aeae to e03b91f (21 revisions) (flutter/packages#11747)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
matthewhendrix pushed a commit to matthewhendrix/flutter that referenced this pull request May 23, 2026
…r#186888)

flutter/packages@1dfbada...3754d04

2026-05-21 stuartmorgan@google.com [tool] Restore publishability
(flutter/packages#11745)
2026-05-20 engine-flutter-autoroll@skia.org Roll Flutter from
259aeae to e03b91f (21 revisions) (flutter/packages#11747)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Restores the repo tooling to a publishable state, so that we can start using it for flutter/core-packages.

I expect fixes will be necessary to make it actually work correctly in that repo, but this gives us a foundation to iterate from where we can actually publish and test changes:
- Removes `publish_to: none`
- Restores the old CHANGELOG, and adds a new entry for the new version.
- Moves the formatter download cache to the repo root instead of a directory that other repo's wont have
- Changes the setup to find the repo root by walking up from the current directory until finding something that looks like the repo root, rather than hard-coding a relative path from the invoked script.
- Adds back some initial documentation about how to use this in another repo. Having two ways of running it was always confusing to explain, so this tries a new approach of demonstrating setting up an alias, and then having all the examples use that alias. We may need to iterate if that proves confusing (to people and/or to AI agents)

Fixes flutter/flutter#185764
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…r#186888)

flutter/packages@1dfbada...3754d04

2026-05-21 stuartmorgan@google.com [tool] Restore publishability
(flutter/packages#11745)
2026-05-20 engine-flutter-autoroll@skia.org Roll Flutter from
259aeae to e03b91f (21 revisions) (flutter/packages#11747)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[packages] Return to publishing repo tools

2 participants