Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
|
Brian Wilkerson
2012/08/21 21:30:01
nit: copyright year
| |
| 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
| 6 | 6 |
| 7 import java.io.BufferedReader; | 7 import java.io.BufferedReader; |
| 8 import java.io.BufferedWriter; | 8 import java.io.BufferedWriter; |
| 9 import java.io.File; | 9 import java.io.File; |
| 10 import java.io.FileNotFoundException; | 10 import java.io.FileNotFoundException; |
| 11 import java.io.FileReader; | 11 import java.io.FileReader; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 28 this(new File("out")); | 28 this(new File("out")); |
| 29 } | 29 } |
| 30 | 30 |
| 31 public DefaultDartArtifactProvider(File outputDirectory) { | 31 public DefaultDartArtifactProvider(File outputDirectory) { |
| 32 this.outputDirectory = outputDirectory; | 32 this.outputDirectory = outputDirectory; |
| 33 } | 33 } |
| 34 | 34 |
| 35 @Override | 35 @Override |
| 36 public Reader getArtifactReader(Source source, String part, String extension) | 36 public Reader getArtifactReader(Source source, String part, String extension) |
| 37 throws IOException { | 37 throws IOException { |
| 38 if (SystemLibraryManager.isDartUri(source.getUri())) { | 38 if (PackageLibraryManager.isDartUri(source.getUri())) { |
| 39 DartSource bundledSource = getBundledArtifact(source, source, part, extens ion); | 39 DartSource bundledSource = getBundledArtifact(source, source, part, extens ion); |
| 40 if (bundledSource != null) { | 40 if (bundledSource != null) { |
| 41 Reader reader = null; | 41 Reader reader = null; |
| 42 try { | 42 try { |
| 43 reader = bundledSource.getSourceReader(); | 43 reader = bundledSource.getSourceReader(); |
| 44 } catch (FileNotFoundException e) { | 44 } catch (FileNotFoundException e) { |
| 45 /* thrown if file doesn't exist, which is fine */ | 45 /* thrown if file doesn't exist, which is fine */ |
| 46 } | 46 } |
| 47 if (reader != null) { | 47 if (reader != null) { |
| 48 return new BufferedReader(reader); | 48 return new BufferedReader(reader); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 66 } | 66 } |
| 67 | 67 |
| 68 @Override | 68 @Override |
| 69 public Writer getArtifactWriter(Source source, String part, String extension) throws IOException { | 69 public Writer getArtifactWriter(Source source, String part, String extension) throws IOException { |
| 70 return new BufferedWriter(new FileWriter(makeDirectories(getArtifactFile(sou rce, part, | 70 return new BufferedWriter(new FileWriter(makeDirectories(getArtifactFile(sou rce, part, |
| 71 extension)))); | 71 extension)))); |
| 72 } | 72 } |
| 73 | 73 |
| 74 @Override | 74 @Override |
| 75 public boolean isOutOfDate(Source source, Source base, String extension) { | 75 public boolean isOutOfDate(Source source, Source base, String extension) { |
| 76 if (SystemLibraryManager.isDartUri(base.getUri())) { | 76 if (PackageLibraryManager.isDartUri(base.getUri())) { |
| 77 Source bundledSource = getBundledArtifact(source, base, "", extension); | 77 Source bundledSource = getBundledArtifact(source, base, "", extension); |
| 78 if (bundledSource != null && bundledSource.exists()) { | 78 if (bundledSource != null && bundledSource.exists()) { |
| 79 // Note: Artifacts bundled with sources are always up to date | 79 // Note: Artifacts bundled with sources are always up to date |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 File artifactFile = getArtifactFile(base, "", extension); | 83 File artifactFile = getArtifactFile(base, "", extension); |
| 84 return !artifactFile.exists() || artifactFile.lastModified() < source.getLas tModified(); | 84 return !artifactFile.exists() || artifactFile.lastModified() < source.getLas tModified(); |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 } | 226 } |
| 227 | 227 |
| 228 private String fullname(String name, String part, String extension) { | 228 private String fullname(String name, String part, String extension) { |
| 229 if (part.isEmpty()) { | 229 if (part.isEmpty()) { |
| 230 return name + "." + extension; | 230 return name + "." + extension; |
| 231 } else { | 231 } else { |
| 232 return name + "$" + part + "." + extension; | 232 return name + "$" + part + "." + extension; |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 } | 235 } |
| OLD | NEW |