Skip to content

Require bwc by default in build mode #38

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 2 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 0.1.5
## 0.2.0

- Pass the arguments supporting `directory:port` for the `serve` command.
- Add the requirement for `build_web_compilers` to `build` command.
- Renamed `--require-build-web-compilers` flag to `--build-web-compilers`.

## 0.1.4

Expand Down
33 changes: 18 additions & 15 deletions webdev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ $ webdev help serve
Run a local web development server and a file system watcher that re-builds on changes.

Usage: webdev serve [arguments] [<directory>[:<port>]]...
-h, --help Print this usage information.
-r, --[no-]release Build with release mode defaults for builders.
-o, --output A directory to write the result of a build to. Or a mapping from a top-level directory in the package to the directory to write a filtered build output to. For example "web:deploy".
-v, --verbose Enables verbose logging.
--hostname Specify the hostname to serve on
(defaults to "localhost")
-h, --help Print this usage information.
-r, --[no-]release Build with release mode defaults for builders.
-o, --output A directory to write the result of a build to. Or a mapping from a top-level directory in the package to the directory to write a filtered build output to. For example "web:deploy".
-v, --verbose Enables verbose logging.
--[no-]build-web-compilers If a dependency on `build_web_compilers` is required to run.
(defaults to on)

--log-requests Enables logging for each request to the server.
--[no-]require-build-web-compilers If a dependency on `build_web_compilers` is required to run.
(defaults to on)
--hostname Specify the hostname to serve on
(defaults to "localhost")

--log-requests Enables logging for each request to the server.

Run "webdev help" to see global options.
```
Expand All @@ -45,12 +46,14 @@ $ webdev help build
Run builders to build a package.

Usage: webdev build [arguments]
-h, --help Print this usage information.
-r, --[no-]release Build with release mode defaults for builders.
(defaults to on)

-o, --output A directory to write the result of a build to. Or a mapping from a top-level directory in the package to the directory to write a filtered build output to. For example "web:deploy".
-v, --verbose Enables verbose logging.
-h, --help Print this usage information.
-r, --[no-]release Build with release mode defaults for builders.
(defaults to on)

-o, --output A directory to write the result of a build to. Or a mapping from a top-level directory in the package to the directory to write a filtered build output to. For example "web:deploy".
-v, --verbose Enables verbose logging.
--[no-]build-web-compilers If a dependency on `build_web_compilers` is required to run.
(defaults to on)

Run "webdev help" to see global options.
```
2 changes: 1 addition & 1 deletion webdev/lib/src/command/build_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class BuildCommand extends CommandBase {
final description = 'Run builders to build a package.';

@override
Future<int> run() => runCore('build', requireBuildWebCompilers: false);
Future<int> run() => runCore('build');
}
15 changes: 11 additions & 4 deletions webdev/lib/src/command/command_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const _release = 'release';
const _output = 'output';
const _verbose = 'verbose';

const _requireBuildWebCompilers = 'build-web-compilers';

/// Extend to get a command with the arguments common to all build_runner
/// commands.
abstract class CommandBase extends Command<int> {
Expand All @@ -42,7 +44,11 @@ abstract class CommandBase extends Command<int> {
abbr: 'v',
defaultsTo: false,
negatable: false,
help: 'Enables verbose logging.');
help: 'Enables verbose logging.')
..addFlag(_requireBuildWebCompilers,
defaultsTo: true,
negatable: true,
help: 'If a dependency on `build_web_compilers` is required to run.');
}

List<String> getArgs() {
Expand All @@ -62,9 +68,10 @@ abstract class CommandBase extends Command<int> {
return arguments;
}

Future<int> runCore(String command,
{@required bool requireBuildWebCompilers}) async {
await checkPubspecLock(requireBuildWebCompilers: requireBuildWebCompilers);
Future<int> runCore(String command) async {
await checkPubspecLock(
requireBuildWebCompilers:
argResults[_requireBuildWebCompilers] as bool);

var buildRunnerScript = await _buildRunnerScript();

Expand Down
11 changes: 2 additions & 9 deletions webdev/lib/src/command/serve_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import 'dart:async';

import 'command_base.dart';

const _requireBuildWebCompilers = 'require-build-web-compilers';

/// Command to execute pub run build_runner serve.
class ServeCommand extends CommandBase {
@override
Expand All @@ -29,11 +27,7 @@ class ServeCommand extends CommandBase {
..addFlag('log-requests',
defaultsTo: false,
negatable: false,
help: 'Enables logging for each request to the server.')
..addFlag(_requireBuildWebCompilers,
defaultsTo: true,
negatable: true,
help: 'If a dependency on `build_web_compilers` is required to run.');
help: 'Enables logging for each request to the server.');
}

@override
Expand All @@ -56,6 +50,5 @@ class ServeCommand extends CommandBase {
}

@override
Future<int> run() => runCore('serve',
requireBuildWebCompilers: argResults[_requireBuildWebCompilers] as bool);
Future<int> run() => runCore('serve');
}
2 changes: 1 addition & 1 deletion webdev/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: webdev
version: 0.1.5-dev
version: 0.2.0-dev
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/webdev
description: >-
Expand Down
Loading