[tool] Restore publishability#11745
Conversation
…ng change standpoint
There was a problem hiding this comment.
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.
| final http.Response response = await http.get(_javaFormatterUrl); | ||
| javaFormatterFile.writeAsBytesSync(response.bodyBytes); | ||
| file.writeAsBytesSync(response.bodyBytes); |
There was a problem hiding this comment.
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);| final http.Response response = await http.get(_kotlinFormatterUrl); | ||
| kotlinFormatterFile.writeAsBytesSync(response.bodyBytes); | ||
| file.writeAsBytesSync(response.bodyBytes); |
There was a problem hiding this comment.
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);
tarrinneal
left a comment
There was a problem hiding this comment.
Not sure if I like the alias swap, but I guess it's more readable.
|
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. |
…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
…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
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
…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
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:
publish_to: noneFixes flutter/flutter#185764