OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Common methods used by transfomers. | 5 /// Common methods used by transfomers. |
6 library polymer.src.build.common; | 6 library polymer.src.build.common; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 | 9 |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /// `type="application/dart"` scripts with equivalent *.dart.js files. | 70 /// `type="application/dart"` scripts with equivalent *.dart.js files. |
71 /// | 71 /// |
72 /// If [contentSecurityPolicy] enabled, this will reference files | 72 /// If [contentSecurityPolicy] enabled, this will reference files |
73 /// named *.dart.precompiled.js. | 73 /// named *.dart.precompiled.js. |
74 final bool directlyIncludeJS; | 74 final bool directlyIncludeJS; |
75 | 75 |
76 /// Run transformers to create a releasable app. For example, include the | 76 /// Run transformers to create a releasable app. For example, include the |
77 /// minified versions of the polyfills rather than the debug versions. | 77 /// minified versions of the polyfills rather than the debug versions. |
78 final bool releaseMode; | 78 final bool releaseMode; |
79 | 79 |
| 80 /// This will make a physical element appear on the page showing build logs. |
| 81 /// It will only appear when ![releaseMode] even if this is true. |
| 82 final bool injectBuildLogsInOutput; |
| 83 |
80 /// True to run liner on all html files before starting other phases. | 84 /// True to run liner on all html files before starting other phases. |
81 // TODO(jmesserly): instead of this flag, we should only run linter on | 85 // TODO(jmesserly): instead of this flag, we should only run linter on |
82 // reachable (entry point+imported) html if deploying. See dartbug.com/17199. | 86 // reachable (entry point+imported) html if deploying. See dartbug.com/17199. |
83 final bool lint; | 87 final bool lint; |
84 | 88 |
85 TransformOptions({entryPoints, this.inlineStylesheets, | 89 TransformOptions({entryPoints, this.inlineStylesheets, |
86 this.contentSecurityPolicy: false, this.directlyIncludeJS: true, | 90 this.contentSecurityPolicy: false, this.directlyIncludeJS: true, |
87 this.releaseMode: true, this.lint: true}) | 91 this.releaseMode: true, this.lint: true, |
| 92 this.injectBuildLogsInOutput: false}) |
88 : entryPoints = entryPoints == null ? null | 93 : entryPoints = entryPoints == null ? null |
89 : entryPoints.map(systemToAssetPath).toList(); | 94 : entryPoints.map(systemToAssetPath).toList(); |
90 | 95 |
91 /// Whether an asset with [id] is an entry point HTML file. | 96 /// Whether an asset with [id] is an entry point HTML file. |
92 bool isHtmlEntryPoint(AssetId id) { | 97 bool isHtmlEntryPoint(AssetId id) { |
93 if (id.extension != '.html') return false; | 98 if (id.extension != '.html') return false; |
94 | 99 |
95 // Note: [id.path] is a relative path from the root of a package. | 100 // Note: [id.path] is a relative path from the root of a package. |
96 if (entryPoints == null) { | 101 if (entryPoints == null) { |
97 return id.path.startsWith('web/') || id.path.startsWith('test/'); | 102 return id.path.startsWith('web/') || id.path.startsWith('test/'); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 bool isCustomTagName(String name) { | 228 bool isCustomTagName(String name) { |
224 if (name == null || !name.contains('-')) return false; | 229 if (name == null || !name.contains('-')) return false; |
225 return !invalidTagNames.containsKey(name); | 230 return !invalidTagNames.containsKey(name); |
226 } | 231 } |
227 | 232 |
228 /// Regex to split names in the 'attributes' attribute, which supports 'a b c', | 233 /// Regex to split names in the 'attributes' attribute, which supports 'a b c', |
229 /// 'a,b,c', or even 'a b,c'. This is the same as in `lib/src/declaration.dart`. | 234 /// 'a,b,c', or even 'a b,c'. This is the same as in `lib/src/declaration.dart`. |
230 final ATTRIBUTES_REGEX = new RegExp(r'\s|,'); | 235 final ATTRIBUTES_REGEX = new RegExp(r'\s|,'); |
231 | 236 |
232 const POLYMER_EXPERIMENTAL_HTML = 'packages/polymer/polymer_experimental.html'; | 237 const POLYMER_EXPERIMENTAL_HTML = 'packages/polymer/polymer_experimental.html'; |
| 238 |
| 239 const String LOG_EXTENSION = '._buildLogs'; |
OLD | NEW |