Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: pkg/barback/lib/transformer.dart

Issue 16854005: First pass at build dependency graph for barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
nweiz 2013/06/14 00:57:57 I don't understand why the classes in this file ar
Bob Nystrom 2013/06/17 23:35:05 I thought it might be nice to separate out the pub
nweiz 2013/06/18 23:14:45 As I mentioned elsewhere, this sort of thing shoul
Bob Nystrom 2013/06/20 00:23:59 OK. Done.
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library barback.generator;
6
7 import 'dart:async';
8 import 'dart:io';
9
10 import 'package:pathos/path.dart' as pathos;
11
12 import 'barback.dart';
13
14 /// A [Transformer] represents a processing step that can take in one or more
nweiz 2013/06/14 00:57:57 "processing step" here is confusing; it sounds lik
Bob Nystrom 2013/06/17 23:35:05 Done.
15 /// input assets and use them to generate one or more output assets.
16 ///
17 /// Dart2js, a SASS->CSS processor, a CSS spriter, and a tool to concatenate JS
18 /// files are all examples of transformers. To define your own transformation
nweiz 2013/06/14 00:57:57 "a tool to concatenate JS files" is a weird exampl
Bob Nystrom 2013/06/17 23:35:05 Done.
19 /// step, you extend (or implement) this class.
nweiz 2013/06/14 00:57:57 "you" -> ""
Bob Nystrom 2013/06/17 23:35:05 Done.
20 abstract class Transformer {
21 /// Returns `true` if [input] can be a primary input for this transformer.
22 /// This is used to tell which files this transformer applies to.
nweiz 2013/06/14 00:57:57 Explain what a primary input is.
Bob Nystrom 2013/06/17 23:35:05 Done.
23 Future<bool> isPrimary(AssetId input);
24
25 /// Process this transformer on [transform], which describes the actual
nweiz 2013/06/14 00:57:57 "Process this transformer on [transform]" is very
Bob Nystrom 2013/06/17 23:35:05 Done.
26 /// assets being transformed.
nweiz 2013/06/14 00:57:57 I don't think it's accurate to say that a Transfor
Bob Nystrom 2013/06/17 23:35:05 Done.
27 Future apply(Transform transform);
28
29 String toString() => runtimeType.toString().replaceAll("Transformer", "");
30 }
31
32 /// While a [Transformer] represents a *kind* of transformation, this defines
33 /// one specific usage of it on a set of files. It is used in [apply()] to
nweiz 2013/06/14 00:57:57 "usage" -> "instance" "It is used" -> "Transforme
Bob Nystrom 2013/06/17 23:35:05 Reworded.
34 /// access the inputs for the transformation and to provide the outputs.
35 abstract class Transform {
36 /// Gets the ID of the primary input for this transformation. While a
37 /// transformation can use multiple input assets, one must be a special
38 /// "primary" asset. This will be the "entrypoint" or "main" input file for
39 /// a transformation.
40 ///
41 /// For example, with a dart2js transform, the primary input would be the
42 /// entrypoint Dart file. All of the other Dart files that that imports
43 /// would be other, secondary inputs.
nweiz 2013/06/14 00:57:57 "other," -> ""
Bob Nystrom 2013/06/17 23:35:05 Done.
44 AssetId get primaryId;
45
46 /// Gets the asset for the primary input.
47 Future<Asset> get primaryInput => getInput(primaryId);
48
49 /// Gets the asset for for an input [id]. If an input with that ID cannot be
50 /// found, throws an [AssetNotFoundException].
51 Future<Asset> getInput(AssetId id);
52
53 /// Stores [output] as the output created by this transformation for asset
54 /// [id]. A transformation can output as many assets as it wants.
55 void addOutput(AssetId id, Asset output);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698