Skip to content
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
2 changes: 2 additions & 0 deletions .analysis_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
analyzer:
strong-mode: true
2 changes: 2 additions & 0 deletions lib/src/asset/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ class AssetCache {
class CachedAssetReader extends AssetReader {
final AssetCache _cache;
final AssetReader _reader;

/// Cache of ongoing reads by [AssetId].
final _pendingReads = <AssetId, Future<String>>{};

/// Cache of ongoing hasInput checks by [AssetId].
final _pendingHasInputChecks = <AssetId, Future<bool>>{};

Expand Down
10 changes: 3 additions & 7 deletions lib/src/asset/id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class AssetId implements Comparable<AssetId> {
/// The [path] will be normalized: any backslashes will be replaced with
/// forward slashes (regardless of host OS) and "." and ".." will be removed
/// where possible.
AssetId(this.package, String path)
: path = _normalizePath(path);
AssetId(this.package, String path) : path = _normalizePath(path);

/// Parses an [AssetId] string of the form "package|path/to/asset.txt".
///
Expand All @@ -49,8 +48,7 @@ class AssetId implements Comparable<AssetId> {
}

if (parts[1].isEmpty) {
throw new FormatException(
'Cannot have empty path in "$description".');
throw new FormatException('Cannot have empty path in "$description".');
}

return new AssetId(parts[0], parts[1]);
Expand All @@ -68,9 +66,7 @@ class AssetId implements Comparable<AssetId> {

/// Returns `true` of [other] is an [AssetId] with the same package and path.
operator ==(other) =>
other is AssetId &&
package == other.package &&
path == other.path;
other is AssetId && package == other.package && path == other.path;

int get hashCode => package.hashCode ^ path.hashCode;

Expand Down
1 change: 1 addition & 0 deletions lib/src/builder/build_step.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:convert';

import 'package:logging/logging.dart';

import '../analyzer/resolver.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/src/generate/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Future<BuildResult> build(List<List<Phase>> phaseGroups,
AssetReader reader,
AssetWriter writer,
Level logLevel,
onLog(LogRecord),
onLog(LogRecord record),
Stream terminateEventStream}) async {
var options = new BuildOptions(
packageGraph: packageGraph,
Expand Down Expand Up @@ -87,7 +87,7 @@ Stream<BuildResult> watch(List<List<Phase>> phaseGroups,
AssetReader reader,
AssetWriter writer,
Level logLevel,
onLog(LogRecord),
onLog(LogRecord record),
Duration debounceDelay,
DirectoryWatcherFactory directoryWatcherFactory,
Stream terminateEventStream}) {
Expand Down Expand Up @@ -124,7 +124,7 @@ Stream<BuildResult> serve(List<List<Phase>> phaseGroups,
AssetReader reader,
AssetWriter writer,
Level logLevel,
onLog(LogRecord),
onLog(LogRecord record),
Duration debounceDelay,
DirectoryWatcherFactory directoryWatcherFactory,
Stream terminateEventStream,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/generate/build_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import 'package:stack_trace/stack_trace.dart';
import 'package:watcher/watcher.dart';

import '../asset/asset.dart';
import '../asset/cache.dart';
import '../asset/exceptions.dart';
import '../asset/id.dart';
import '../asset/cache.dart';
import '../asset/reader.dart';
import '../asset/writer.dart';
import '../asset_graph/exceptions.dart';
import '../asset_graph/graph.dart';
import '../asset_graph/node.dart';
import '../builder/builder.dart';
import '../builder/build_step_impl.dart';
import '../builder/builder.dart';
import '../package_graph/package_graph.dart';
import 'build_result.dart';
import 'exceptions.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/src/generate/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class ConcurrentBuildException implements Exception {

const ConcurrentBuildException();

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/generate/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BuildOptions {
{this.debounceDelay,
this.directoryWatcherFactory,
Level logLevel,
onLog(LogRecord),
onLog(LogRecord record),
this.packageGraph,
this.reader,
this.writer,
Expand Down
12 changes: 5 additions & 7 deletions lib/src/package_graph/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class PackageGraph {

/// Creates a [PackageGraph] given the [root] [PackageNode].
factory PackageGraph.fromRoot(PackageNode root) {
final allPackages = <String, PackageNode>{
root.name: root,
};
final allPackages = <String, PackageNode>{root.name: root};

addDeps(PackageNode package) {
for (var dep in package.dependencies) {
Expand Down Expand Up @@ -80,8 +78,8 @@ class PackageGraph {
{bool isRoot: false}) {
var name = yaml['name'];
assert(!nodes.containsKey(name));
var node = new PackageNode(
name, yaml['version'], type, packageLocations[name]);
var node =
new PackageNode(name, yaml['version'], type, packageLocations[name]);
nodes[name] = node;

var deps = _depsFromYaml(yaml, isRoot: isRoot);
Expand Down Expand Up @@ -168,8 +166,8 @@ PackageDependencyType _dependencyType(source) {
}

/// Gets the deps from a yaml file, taking into account dependency_overrides.
Map<String, YamlMap> _depsFromYaml(YamlMap yaml, {bool isRoot: false}) {
var deps = new Map.from(yaml['dependencies'] ?? {});
Map<String, dynamic> _depsFromYaml(YamlMap yaml, {bool isRoot: false}) {
var deps = new Map<String, dynamic>.from(yaml['dependencies'] ?? {});
if (isRoot) {
deps.addAll(new Map.from(yaml['dev_dependencies'] ?? {}));
yaml['dependency_overrides']?.forEach((dep, source) {
Expand Down
1 change: 1 addition & 0 deletions lib/src/server/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:io';

import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/transformer/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import '../asset/asset.dart' as build;
import '../asset/id.dart' as build;
import '../asset/reader.dart';
import '../asset/writer.dart';
import '../builder/builder.dart';
import '../builder/build_step_impl.dart';
import '../builder/builder.dart';
import '../util/barback.dart';

/// A [Transformer] which runs multiple [Builder]s.
Expand Down
Loading