Skip to content

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

Merged
merged 12 commits into from
Dec 12, 2017

Conversation

jcollins-g
Copy link
Contributor

@jcollins-g jcollins-g commented Dec 11, 2017

This is the beginning of a short series of dartdoc infrastructure PRs to increase release reliability and velocity.

TL;DR:

  • Centralize grind script process launching
  • Port flutter bot to a grind target
  • Add web serving targets serve-sdk-docs and serve-flutter-docs.
  • Drop duplicitous link checking -- this is now part of dartdoc proper.

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 and serve-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.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Dec 11, 2017
@jcollins-g jcollins-g changed the title Workflow enhancements Cleanup grind and add serving capability via dhttpd Dec 12, 2017
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');
Copy link
Member

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?

Copy link
Contributor Author

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+ ');
Copy link
Member

Choose a reason for hiding this comment

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

you want stderr here?

Copy link
Contributor Author

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
Copy link
Member

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

@jcollins-g jcollins-g merged commit 97b180c into master Dec 12, 2017
@jcollins-g jcollins-g deleted the workflow-enhancements branch December 12, 2017 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants