OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library compiler; | 5 library compiler; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show SplayTreeMap; | 8 import 'dart:collection' show SplayTreeMap; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur
iBasedDirective; | 10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur
iBasedDirective; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 var mainDir = path.dirname(_mainPath); | 79 var mainDir = path.dirname(_mainPath); |
80 var baseDir = options.baseDir != null ? options.baseDir : mainDir; | 80 var baseDir = options.baseDir != null ? options.baseDir : mainDir; |
81 var outputDir = options.outputDir != null ? options.outputDir : mainDir; | 81 var outputDir = options.outputDir != null ? options.outputDir : mainDir; |
82 var packageRoot = options.packageRoot != null ? options.packageRoot | 82 var packageRoot = options.packageRoot != null ? options.packageRoot |
83 : path.join(path.dirname(_mainPath), 'packages'); | 83 : path.join(path.dirname(_mainPath), 'packages'); |
84 | 84 |
85 if (options.resetCssFile != null) { | 85 if (options.resetCssFile != null) { |
86 _resetCssFile = options.resetCssFile; | 86 _resetCssFile = options.resetCssFile; |
87 if (path.isRelative(_resetCssFile)) { | 87 if (path.isRelative(_resetCssFile)) { |
88 // If CSS reset file path is relative from our current path. | 88 // If CSS reset file path is relative from our current path. |
89 _resetCssFile = path.resolve(_resetCssFile); | 89 _resetCssFile = path.absolute(_resetCssFile); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 // Normalize paths - all should be relative or absolute paths. | 93 // Normalize paths - all should be relative or absolute paths. |
94 if (path.isAbsolute(_mainPath) || path.isAbsolute(baseDir) || | 94 if (path.isAbsolute(_mainPath) || path.isAbsolute(baseDir) || |
95 path.isAbsolute(outputDir) || path.isAbsolute(packageRoot)) { | 95 path.isAbsolute(outputDir) || path.isAbsolute(packageRoot)) { |
96 if (path.isRelative(_mainPath)) _mainPath = path.resolve(_mainPath); | 96 if (path.isRelative(_mainPath)) _mainPath = path.absolute(_mainPath); |
97 if (path.isRelative(baseDir)) baseDir = path.resolve(baseDir); | 97 if (path.isRelative(baseDir)) baseDir = path.absolute(baseDir); |
98 if (path.isRelative(outputDir)) outputDir = path.resolve(outputDir); | 98 if (path.isRelative(outputDir)) outputDir = path.absolute(outputDir); |
99 if (path.isRelative(packageRoot)) { | 99 if (path.isRelative(packageRoot)) { |
100 packageRoot = path.resolve(packageRoot); | 100 packageRoot = path.absolute(packageRoot); |
101 } | 101 } |
102 } | 102 } |
103 _pathMapper = new PathMapper( | 103 _pathMapper = new PathMapper( |
104 baseDir, outputDir, packageRoot, options.forceMangle, | 104 baseDir, outputDir, packageRoot, options.forceMangle, |
105 options.rewriteUrls); | 105 options.rewriteUrls); |
106 } | 106 } |
107 | 107 |
108 /** Compile the application starting from the given input file. */ | 108 /** Compile the application starting from the given input file. */ |
109 Future run() { | 109 Future run() { |
110 if (path.basename(_mainPath).endsWith('.dart')) { | 110 if (path.basename(_mainPath).endsWith('.dart')) { |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 809 |
810 import 'package:web_ui/watcher.dart' as watcher; | 810 import 'package:web_ui/watcher.dart' as watcher; |
811 import '$userMainImport' as userMain; | 811 import '$userMainImport' as userMain; |
812 | 812 |
813 main() { | 813 main() { |
814 watcher.useObservers = $useObservers; | 814 watcher.useObservers = $useObservers; |
815 userMain.main(); | 815 userMain.main(); |
816 userMain.init_autogenerated(); | 816 userMain.init_autogenerated(); |
817 } | 817 } |
818 """; | 818 """; |
OLD | NEW |