diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java index 37b52de956a..748d655c377 100644 --- a/compiler/java/com/google/dart/compiler/DartCompiler.java +++ b/compiler/java/com/google/dart/compiler/DartCompiler.java @@ -188,9 +188,10 @@ public class DartCompiler { try { for (LibraryUnit lib : libraries.values()) { LibrarySource libSrc = lib.getSource(); + boolean libIsDartUri = SystemLibraryManager.isDartUri(libSrc.getUri()); LibraryUnit apiLib = new LibraryUnit(libSrc); LibraryNode selfSourcePath = lib.getSelfSourcePath(); - boolean persist = !incremental || !apiLib.loadApi(context, context); + boolean persist = (!incremental && !libIsDartUri) || !apiLib.loadApi(context, context); // Parse each compilation unit and update the API to reflect its contents. for (LibraryNode libNode : lib.getSourcePaths()) { @@ -204,7 +205,7 @@ public class DartCompiler { } DartUnit apiUnit = apiLib.getUnit(dartSrc.getName()); - if (apiUnit == null || isSourceOutOfDate(dartSrc, libSrc)) { + if (apiUnit == null || (!libIsDartUri && isSourceOutOfDate(dartSrc, libSrc))) { DartUnit unit = parse(dartSrc, lib.getPrefixes()); if (unit != null) { // if we are visiting the tu @@ -381,6 +382,12 @@ public class DartCompiler { TraceEvent logEvent = Tracer.canTrace() ? Tracer.start(DartEventType.ADD_OUTOFDATE) : null; try { for (LibraryUnit lib : libraries.values()) { + + if (SystemLibraryManager.isDartUri(lib.getSource().getUri())) { + // embedded dart libs are always up to date + continue; + } + // Load the existing DEPS, or create an empty one. LibraryDeps deps = lib.getDeps(context); diff --git a/compiler/java/com/google/dart/compiler/DefaultDartArtifactProvider.java b/compiler/java/com/google/dart/compiler/DefaultDartArtifactProvider.java index 48bf311655a..42efa0aa68c 100644 --- a/compiler/java/com/google/dart/compiler/DefaultDartArtifactProvider.java +++ b/compiler/java/com/google/dart/compiler/DefaultDartArtifactProvider.java @@ -75,7 +75,7 @@ public class DefaultDartArtifactProvider extends DartArtifactProvider { public boolean isOutOfDate(Source source, Source base, String extension) { if (SystemLibraryManager.isDartUri(base.getUri())) { Source bundledSource = getBundledArtifact(source, base, "", extension); - if (bundledSource != null) { + if (bundledSource != null && bundledSource.exists()) { // Note: Artifacts bundled with sources are always up to date return false; } @@ -84,9 +84,22 @@ public class DefaultDartArtifactProvider extends DartArtifactProvider { return artifactFile.lastModified() < source.getLastModified(); } + // TODO(jbrosenberg): remove 'source' argument from this method, it's not used protected DartSource getBundledArtifact(Source source, Source base, String part, String extension) { - LibrarySource library = libraryOf(base); - URI relativeUri = library.getUri().resolve(".").normalize().relativize(base.getUri()); + LibrarySource library; + URI relativeUri; + if (base instanceof LibrarySource) { + library = (LibrarySource) base; + relativeUri = library.getUri().resolve(".").normalize().relativize(base.getUri()); + } else if (base instanceof DartSource){ + library = ((DartSource) base).getLibrary(); + String name = base.getName(); + URI nameUri = URI.create(name).normalize(); + relativeUri = library.getUri().resolve(".").normalize().relativize(nameUri); + } else { + throw new AssertionError(base.getClass().getName()); + } + DartSource bundledSource; if (!relativeUri.isAbsolute()) { bundledSource = library.getSourceFor(fullname(relativeUri.getPath(), part, extension)); @@ -96,16 +109,6 @@ public class DefaultDartArtifactProvider extends DartArtifactProvider { return bundledSource; } - private LibrarySource libraryOf(Source base) throws AssertionError { - if (base instanceof DartSource) { - return ((DartSource) base).getLibrary(); - } else if (base instanceof LibrarySource){ - return (LibrarySource) base; - } else { - throw new AssertionError(base.getClass().getName()); - } - } - /** * Answer the artifact file associated with the specified source. Only one * artifact may be associated with the given extension. diff --git a/compiler/java/com/google/dart/compiler/UrlSource.java b/compiler/java/com/google/dart/compiler/UrlSource.java index a59866f2837..67987f4f10c 100644 --- a/compiler/java/com/google/dart/compiler/UrlSource.java +++ b/compiler/java/com/google/dart/compiler/UrlSource.java @@ -88,9 +88,6 @@ public abstract class UrlSource implements Source { @Override public long getLastModified() { - if (!shouldCareAboutLastModified) { - return 0; - } initProperties(); return lastModified; }