Skip to content

Commit 15e41b5

Browse files
committed
Renamed enum values to be lower-case
Closes #94
1 parent 88be032 commit 15e41b5

File tree

11 files changed

+41
-37
lines changed

11 files changed

+41
-37
lines changed

.analysis_options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ linter:
88
- avoid_init_to_null
99
- avoid_return_types_on_setters
1010
- camel_case_types
11-
# - constant_identifier_names # https://github.com/dart-lang/build/issues/94
11+
- constant_identifier_names
1212
- empty_constructor_bodies
1313
- hash_and_equals
1414
- library_names

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.3.0
4+
- **BREAKING** Renamed values of three enums to be lower-case:
5+
`BuildType`, `BuildStatus`, and `PackageDependencyType`.
6+
37
## 0.2.1
48
- Added the `deleteFilesByDefault` option to all top level methods. This will
59
skip the prompt to delete files, and instead act as if you responded `y`.

lib/src/generate/build_impl.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BuildImpl {
6060
///
6161
/// The returned [Future] is guaranteed to complete with a [BuildResult]. If
6262
/// an exception is thrown by any phase, [BuildResult#status] will be set to
63-
/// [BuildStatus.Failure]. The exception and stack trace that caused the failure
63+
/// [BuildStatus.failure]. The exception and stack trace that caused the failure
6464
/// will be available as [BuildResult#exception] and [BuildResult#stackTrace]
6565
/// respectively.
6666
///
@@ -74,7 +74,7 @@ class BuildImpl {
7474
var watch = new Stopwatch()..start();
7575

7676
/// Assume incremental, change if necessary.
77-
var buildType = BuildType.Incremental;
77+
var buildType = BuildType.incremental;
7878
var done = new Completer<BuildResult>();
7979
Chain.capture(() async {
8080
if (_buildRunning) throw const ConcurrentBuildException();
@@ -88,7 +88,7 @@ class BuildImpl {
8888
if (_assetGraph.allNodes.isEmpty &&
8989
!(await _reader.hasInput(_assetGraphId))) {
9090
isNewAssetGraph = true;
91-
buildType = BuildType.Full;
91+
buildType = BuildType.full;
9292
} else {
9393
/// Collect updates since the asset graph was last created. This only
9494
/// handles updates and deletes, not adds. We list the file system for
@@ -109,7 +109,7 @@ class BuildImpl {
109109
await logWithTime(_logger, 'Checking build script for updates',
110110
() async {
111111
if (await _buildScriptUpdated()) {
112-
buildType = BuildType.Full;
112+
buildType = BuildType.full;
113113
if (_isFirstBuild) {
114114
_logger.warning(
115115
'Invalidating asset graph due to build script update');
@@ -118,7 +118,7 @@ class BuildImpl {
118118
.forEach((node) =>
119119
(node as GeneratedAssetNode).needsUpdate = true);
120120
} else {
121-
done.complete(new BuildResult(BuildStatus.Failure, buildType, [],
121+
done.complete(new BuildResult(BuildStatus.failure, buildType, [],
122122
exception: new BuildScriptUpdatedException()));
123123
}
124124
}
@@ -157,13 +157,13 @@ class BuildImpl {
157157

158158
done.complete(result);
159159
}, onError: (e, Chain chain) {
160-
done.complete(new BuildResult(BuildStatus.Failure, buildType, [],
160+
done.complete(new BuildResult(BuildStatus.failure, buildType, [],
161161
exception: e, stackTrace: chain.toTrace()));
162162
});
163163
var result = await done.future;
164164
_buildRunning = false;
165165
_isFirstBuild = false;
166-
if (result.status == BuildStatus.Success) {
166+
if (result.status == BuildStatus.success) {
167167
_logger.info('Succeeded after ${watch.elapsedMilliseconds}ms with '
168168
'${result.outputs.length} outputs\n\n');
169169
} else {
@@ -455,7 +455,7 @@ class BuildImpl {
455455
_inputsByPackage[outputId.package].add(outputId);
456456
}
457457
}
458-
return new BuildResult(BuildStatus.Success, BuildType.Full, outputs);
458+
return new BuildResult(BuildStatus.success, BuildType.full, outputs);
459459
}
460460

461461
/// Initializes the map of all the available inputs by package.

lib/src/generate/build_result.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BuildResult {
2727

2828
@override
2929
String toString() {
30-
if (status == BuildStatus.Success) {
30+
if (status == BuildStatus.success) {
3131
return '''
3232
3333
Build Succeeded!
@@ -47,7 +47,7 @@ $stackTrace
4747
}
4848

4949
/// The status of a build.
50-
enum BuildStatus { Success, Failure, }
50+
enum BuildStatus { success, failure, }
5151

5252
/// The type of a build.
53-
enum BuildType { Incremental, Full }
53+
enum BuildType { incremental, full }

lib/src/generate/watch_impl.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class WatchImpl {
156156
_currentBuild.then((result) {
157157
// Terminate the watcher if the build script is updated, there is no
158158
// need to continue listening.
159-
if (result.status == BuildStatus.Failure &&
159+
if (result.status == BuildStatus.failure &&
160160
result.exception is FatalBuildException) {
161161
terminate();
162162
}

lib/src/package_graph/package_graph.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class PackageGraph {
101101
}
102102

103103
var root =
104-
addNodeAndDeps(rootYaml, PackageDependencyType.Path, isRoot: true);
104+
addNodeAndDeps(rootYaml, PackageDependencyType.path, isRoot: true);
105105
return new PackageGraph._(root, nodes);
106106
}
107107

@@ -152,20 +152,20 @@ class PackageNode {
152152

153153
/// The type of dependency being used. This dictates how the package should be
154154
/// watched for changes.
155-
enum PackageDependencyType { Pub, Github, Path, }
155+
enum PackageDependencyType { pub, github, path }
156156

157157
PackageDependencyType _dependencyType(source) {
158-
if (source is String || source == null) return PackageDependencyType.Pub;
158+
if (source is String || source == null) return PackageDependencyType.pub;
159159

160160
assert(source is YamlMap);
161161
assert(source.keys.length == 1);
162162

163163
var typeString = source.keys.first;
164164
switch (typeString) {
165165
case 'git':
166-
return PackageDependencyType.Github;
166+
return PackageDependencyType.github;
167167
case 'path':
168-
return PackageDependencyType.Path;
168+
return PackageDependencyType.path;
169169
default:
170170
throw 'Unrecognized package dependency type `$typeString`';
171171
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build
2-
version: 0.2.2-dev
2+
version: 0.3.0-dev
33
description: A build system for Dart.
44
author: Dart Team <[email protected]>
55
homepage: https://github.com/dart-lang/build

test/common/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Future testPhases(PhaseGroup phases, Map<String, String> inputs,
7575
{bool deleteFilesByDefault,
7676
Map<String, String> outputs,
7777
PackageGraph packageGraph,
78-
BuildStatus status: BuildStatus.Success,
78+
BuildStatus status: BuildStatus.success,
7979
Matcher exceptionMatcher,
8080
InMemoryAssetWriter writer}) async {
8181
writer ??= new InMemoryAssetWriter();

test/generate/build_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void main() {
9898
new CopyBuilder(), new InputSet('b', ['**/*']));
9999

100100
await testPhases(phases, {'b|lib/b.txt': 'b'},
101-
outputs: {}, status: BuildStatus.Failure);
101+
outputs: {}, status: BuildStatus.failure);
102102
});
103103
});
104104

@@ -142,7 +142,7 @@ void main() {
142142
'a|lib/a.txt.copy': 'a',
143143
'a|$assetGraphPath': JSON.encode(emptyGraph.serialize()),
144144
},
145-
status: BuildStatus.Failure,
145+
status: BuildStatus.failure,
146146
exceptionMatcher: invalidOutputException);
147147
});
148148
});

test/generate/watch_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ void main() {
146146
ChangeType.MODIFY, path.absolute('a', 'web', 'a.txt')));
147147

148148
result = await nextResult(results);
149-
expect(result.status, BuildStatus.Failure);
149+
expect(result.status, BuildStatus.failure);
150150
});
151151

152152
test('ignores events from nested packages', () async {
153153
var writer = new InMemoryAssetWriter();
154154
var results = <BuildResult>[];
155155
var packageA = new PackageNode(
156-
'a', '0.1.0', PackageDependencyType.Path, new Uri.file('a/'));
156+
'a', '0.1.0', PackageDependencyType.path, new Uri.file('a/'));
157157
var packageB = new PackageNode(
158-
'b', '0.1.0', PackageDependencyType.Path, new Uri.file('a/b/'));
158+
'b', '0.1.0', PackageDependencyType.path, new Uri.file('a/b/'));
159159
packageA.dependencies.add(packageB);
160160
var packageGraph = new PackageGraph.fromRoot(packageA);
161161

0 commit comments

Comments
 (0)