-
Notifications
You must be signed in to change notification settings - Fork 125
Cleanup grind and add serving capability via dhttpd #1570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tool/grind.dart
Outdated
import 'package:path/path.dart' as path; | ||
import 'package:yaml/yaml.dart' as yaml; | ||
|
||
main([List<String> args]) => grind(args); | ||
|
||
final Directory docsDir = | ||
new Directory(path.join('${Directory.systemTemp.path}', defaultOutDir)); | ||
final Directory dartdocDocsDir = Directory.systemTemp.createTempSync('dartdoc'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script creates these temp dirs on every run, whether they're used or not. They're in temp, so it may not actually matter, but consider not creating them until the variables are first referenced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/// TODO(jcollins-g): move this to grinder? | ||
Future runStreamed(String executable, List<String> arguments, | ||
{String workingDirectory}) async { | ||
stderr.write('$prefix+ '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want stderr here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Modeled after set -x in bash, which echos the commands used to stderr.
|
||
# The above script validates the generation; we echo the main file here. | ||
cat dev/docs/doc/index.html | ||
pub run grinder build-flutter-docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 awesome - nice to make it easy for other people to run this
This is the beginning of a short series of dartdoc infrastructure PRs to increase release reliability and velocity.
TL;DR:
serve-sdk-docs
andserve-flutter-docs
.Many times I find it useful to have local serving versions of docs for browsing. To make this easier for other developers I've written some parts of what I do into the grind script. Two new targets,
serve-sdk-docs
andserve-flutter-docs
build and launch a Dart web server for browsing documentation for the SDK and flutter.This also cleans up the grind script so that we launch processes via a single entry point (
_SubprocessLauncher
), which logs the command being executed as well as any pertinent environment variables, the working directory, etc in a manner familiar to shell script authors but hopefully readable to others as well. This used to be done inconsistently making for challenging debugging.The refactor also makes it a little safer to do these tasks in parallel -- this is why there is the creation of throwaway pub caches and safer temporary directory creation. A followup will have a "serve-everything" grind target that will parallelize dartdoc to save time and serve the SDK, the test package, and the flutter docs on three different ports from a single command.
Other followups will include patching new versions of dartdoc into the SDK (temporarily for a test, and for release) and Flutter automatically, with generation of review docs.