mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 05:37:56 +00:00
Bypass precompiled libs for up to date checks
Fixes to bundledArtifact handling Review URL: https://chromereviews.googleplex.com/3562014 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@192 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
0369e68509
commit
b66797f6e4
3 changed files with 25 additions and 18 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -88,9 +88,6 @@ public abstract class UrlSource implements Source {
|
|||
|
||||
@Override
|
||||
public long getLastModified() {
|
||||
if (!shouldCareAboutLastModified) {
|
||||
return 0;
|
||||
}
|
||||
initProperties();
|
||||
return lastModified;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue