Deletes DevMode specific linker hacks.
Change-Id: I4087ebc291a7f6dc219c93902f6b9429be5bf8d3
(cherry picked from commit a84cb614ed7fa22b898061a34cb8e9aef316ee1a)
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
index 1b73d49..0557d69 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
@@ -295,18 +295,7 @@
protected EmittedArtifact emitSelectionScript(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
throws UnableToCompleteException {
- /*
- * Last modified is important to keep Development Mode refreses from
- * clobbering Production Mode compiles. We set the timestamp on the
- * Development Mode selection script to the same mod time as the module (to
- * allow updates). For Production Mode, we just set it to now.
- */
- long lastModified;
- if (permutationsUtil.getPermutationsMap().isEmpty()) {
- lastModified = context.getModuleLastModified();
- } else {
- lastModified = System.currentTimeMillis();
- }
+ long lastModified = context.getModuleLastModified();
String ss = generateSelectionScript(logger, context, artifacts);
return emitString(logger, ss, context.getModuleName()
+ ".nocache.js", lastModified);
diff --git a/dev/core/src/com/google/gwt/dev/util/OutputFileSet.java b/dev/core/src/com/google/gwt/dev/util/OutputFileSet.java
index 4f95198..79cee97 100644
--- a/dev/core/src/com/google/gwt/dev/util/OutputFileSet.java
+++ b/dev/core/src/com/google/gwt/dev/util/OutputFileSet.java
@@ -69,14 +69,12 @@
/**
* Opens a file for write. If writing to a zip file and the file already exists,
- * there will be no effect. If writing to a directory, the file exists, and the
- * given timestamp is older than the current timestamp, there will be no effect.
+ * there will be no effect. If writing to a directory already existing files are
+ * overwritten.
*
- * @param timeStampMillis last modified time in milliseconds, or
- * TIMESTAMP_UNAVAILABLE to force an overwrite.
+ * @param timeStampMillis last modified time in milliseconds.
* @return the output stream to write to, possibly a NullOutputStream
*/
- // TODO: revalidate whether any timestamp based overwrite prevention is needed.
public OutputStream openForWrite(String path, long timeStampMillis)
throws IOException {
pathsSeen.add(path);
diff --git a/dev/core/src/com/google/gwt/dev/util/OutputFileSetOnDirectory.java b/dev/core/src/com/google/gwt/dev/util/OutputFileSetOnDirectory.java
index d772a9a..17720f7 100644
--- a/dev/core/src/com/google/gwt/dev/util/OutputFileSetOnDirectory.java
+++ b/dev/core/src/com/google/gwt/dev/util/OutputFileSetOnDirectory.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.util;
-import com.google.gwt.dev.util.NullOutputFileSet.NullOutputStream;
import com.google.gwt.dev.util.collect.HashSet;
import java.io.File;
@@ -46,11 +45,6 @@
protected OutputStream createNewOutputStream(String path,
final long timeStampMillis) throws IOException {
final File file = pathToFile(path);
- if (file.exists() && timeStampMillis != TIMESTAMP_UNAVAILABLE &&
- file.lastModified() > timeStampMillis) {
- return new NullOutputStream();
- }
-
mkdirs(file.getParentFile());
return new FileOutputStream(file) {
@Override
diff --git a/dev/core/test/com/google/gwt/dev/util/OutputFileSetOnDirectoryTest.java b/dev/core/test/com/google/gwt/dev/util/OutputFileSetOnDirectoryTest.java
index 0c2283e..599e9ce 100644
--- a/dev/core/test/com/google/gwt/dev/util/OutputFileSetOnDirectoryTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/OutputFileSetOnDirectoryTest.java
@@ -65,7 +65,7 @@
}
}
- public void testNewFileOlderTimestampDies() throws IOException {
+ public void testNewFileOlderTimestampOverwrites() throws IOException {
File work = Utility.makeTemporaryDirectory(null, "outputfileset");
try {
OutputFileSetOnDirectory output = new OutputFileSetOnDirectory(work, "test/");
@@ -75,7 +75,7 @@
firstStream.close();
OutputStream secondStream = output.createNewOutputStream("path/to/file", 1000);
- assertFalse(secondStream instanceof FileOutputStream);
+ assertTrue(secondStream instanceof FileOutputStream);
secondStream.close();
} finally {
Util.recursiveDelete(work, false);
diff --git a/user/test/com/google/gwt/core/ext/linker/impl/SelectionScriptLinkerUnitTest.java b/user/test/com/google/gwt/core/ext/linker/impl/SelectionScriptLinkerUnitTest.java
index 38e9d73..6e8d0b7 100644
--- a/user/test/com/google/gwt/core/ext/linker/impl/SelectionScriptLinkerUnitTest.java
+++ b/user/test/com/google/gwt/core/ext/linker/impl/SelectionScriptLinkerUnitTest.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -147,8 +147,8 @@
}
/**
- * Test timestamps on the selection script. For Development Mode, it should match
- * the module's timestamp. For Production Mode, it should be current.
+ * Test timestamps on the selection script. For both Development Mode and ProductionMode it should
+ * match the module's timestamp.
*/
public void testTimestampOnSelectionScript() throws UnableToCompleteException {
// Development Mode
@@ -170,7 +170,7 @@
updated = new ShardableSelectionScriptLinker().link(TreeLogger.NULL,
new MockLinkerContext(), updated, false);
EmittedArtifact selectionScript = findSelectionScript(updated);
- assertTrue(MOCK_MODULE_LAST_MODIFIED != selectionScript.getLastModified());
+ assertEquals(MOCK_MODULE_LAST_MODIFIED, selectionScript.getLastModified());
}
}