Remove GWT version check.
Change-Id: I4dac980e65764380fc4fe2b32e4da3addb46858d
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java
index 8921246..6f49676 100644
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java
@@ -233,11 +233,6 @@
}
@Override
- public boolean isUpdateCheckDisabled() {
- return true;
- }
-
- @Override
public boolean isValidateOnly() {
return false;
}
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java
index ca27d67..1da7efb 100644
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java
@@ -70,11 +70,6 @@
}
@Override
- public final void setDisableUpdateCheck(boolean disabled) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public final void setEnableAssertions(boolean enableAssertions) {
throw new UnsupportedOperationException();
}
diff --git a/dev/core/src/com/google/gwt/dev/About.java b/dev/core/src/com/google/gwt/dev/About.java
index d327de4..6b70efd 100644
--- a/dev/core/src/com/google/gwt/dev/About.java
+++ b/dev/core/src/com/google/gwt/dev/About.java
@@ -129,7 +129,7 @@
* couldn't be determined at build time.
*/
public static GwtVersion getGwtVersionObject() {
- // This is public because CheckForUpdates and WebAppCreator need access.
+ // This is public because WebAppCreator needs access.
return gwtVersion;
}
diff --git a/dev/core/src/com/google/gwt/dev/Compiler.java b/dev/core/src/com/google/gwt/dev/Compiler.java
index 3e4f0a7..6e12204 100644
--- a/dev/core/src/com/google/gwt/dev/Compiler.java
+++ b/dev/core/src/com/google/gwt/dev/Compiler.java
@@ -25,8 +25,6 @@
import com.google.gwt.dev.javac.UnitCacheSingleton;
import com.google.gwt.dev.jjs.PermutationResult;
import com.google.gwt.dev.js.JsNamespaceOption;
-import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
import com.google.gwt.dev.util.Memory;
import com.google.gwt.dev.util.PersistenceBackedObject;
import com.google.gwt.dev.util.Util;
@@ -48,7 +46,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.FutureTask;
/**
* The main executable entry point for the GWT Java to JavaScript compiler.
@@ -110,16 +107,7 @@
CompileTask task = new CompileTask() {
@Override
public boolean run(TreeLogger logger) throws UnableToCompleteException {
- FutureTask<UpdateResult> updater = null;
- if (!options.isUpdateCheckDisabled()) {
- updater = CheckForUpdates.checkForUpdatesInBackgroundThread(logger,
- CheckForUpdates.ONE_DAY);
- }
- boolean success = Compiler.compile(logger, options);
- if (success) {
- CheckForUpdates.logUpdateAvailable(logger, updater);
- }
- return success;
+ return Compiler.compile(logger, options);
}
};
if (CompileTaskRunner.runWithAppropriateLogger(options, task)) {
diff --git a/dev/core/src/com/google/gwt/dev/DevMode.java b/dev/core/src/com/google/gwt/dev/DevMode.java
index 6ac2f37..8c0d7a4 100644
--- a/dev/core/src/com/google/gwt/dev/DevMode.java
+++ b/dev/core/src/com/google/gwt/dev/DevMode.java
@@ -33,7 +33,7 @@
import com.google.gwt.dev.util.InstalledHelpInfo;
import com.google.gwt.dev.util.Util;
import com.google.gwt.dev.util.arg.ArgHandlerDeployDir;
-import com.google.gwt.dev.util.arg.ArgHandlerDisableUpdateCheck;
+import com.google.gwt.dev.util.arg.ArgHandlerDeprecatedDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerExtraDir;
import com.google.gwt.dev.util.arg.ArgHandlerFilterJsInteropExports;
import com.google.gwt.dev.util.arg.ArgHandlerGenerateJsInteropExports;
@@ -246,7 +246,7 @@
registerHandler(new ArgHandlerExtraDir(options));
registerHandler(new ArgHandlerModulePathPrefix(options));
registerHandler(new ArgHandlerWorkDirOptional(options));
- registerHandler(new ArgHandlerDisableUpdateCheck(options));
+ registerHandler(new ArgHandlerDeprecatedDisableUpdateCheck());
registerHandler(new ArgHandlerMethodNameDisplayMode(options));
registerHandler(new ArgHandlerSourceLevel(options));
registerHandler(new ArgHandlerGenerateJsInteropExports(options));
diff --git a/dev/core/src/com/google/gwt/dev/DevModeBase.java b/dev/core/src/com/google/gwt/dev/DevModeBase.java
index b7cc46d..cbc56d5 100644
--- a/dev/core/src/com/google/gwt/dev/DevModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/DevModeBase.java
@@ -26,7 +26,6 @@
import com.google.gwt.dev.shell.ArtifactAcceptor;
import com.google.gwt.dev.shell.BrowserChannelServer;
import com.google.gwt.dev.shell.BrowserWidgetHost;
-import com.google.gwt.dev.shell.CheckForUpdates;
import com.google.gwt.dev.shell.ModuleSpaceHost;
import com.google.gwt.dev.shell.ShellModuleSpaceHost;
import com.google.gwt.dev.shell.remoteui.RemoteUI;
@@ -724,13 +723,6 @@
options.setNoServer(!run);
}
- /**
- * Derived classes can override to lengthen ping delay.
- */
- protected long checkForUpdatesInterval() {
- return CheckForUpdates.ONE_MINUTE;
- }
-
protected abstract HostedModeBaseOptions createOptions();
/**
@@ -789,23 +781,6 @@
// Set done callback
ui.setCallback(DoneEvent.getType(), this);
- // Check for updates
- if (!options.isUpdateCheckDisabled()) {
- final TreeLogger logger = getTopLogger();
- final CheckForUpdates updateChecker = CheckForUpdates.createUpdateChecker(logger);
- if (updateChecker != null) {
- Thread checkerThread = new Thread("GWT Update Checker") {
- @Override
- public void run() {
- CheckForUpdates.logUpdateAvailable(logger, updateChecker
- .check(checkForUpdatesInterval()));
- }
- };
- checkerThread.setDaemon(true);
- checkerThread.start();
- }
- }
-
// Accept connections from OOPHM clients
ensureCodeServerListener();
diff --git a/dev/core/src/com/google/gwt/dev/Precompile.java b/dev/core/src/com/google/gwt/dev/Precompile.java
index f21650c..a81bdc8 100644
--- a/dev/core/src/com/google/gwt/dev/Precompile.java
+++ b/dev/core/src/com/google/gwt/dev/Precompile.java
@@ -31,8 +31,6 @@
import com.google.gwt.dev.jjs.JavaToJavaScriptCompiler;
import com.google.gwt.dev.jjs.PrecompilationContext;
import com.google.gwt.dev.jjs.UnifiedAst;
-import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
import com.google.gwt.dev.util.CollapsedPropertyKey;
import com.google.gwt.dev.util.Memory;
import com.google.gwt.dev.util.Util;
@@ -52,7 +50,6 @@
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
-import java.util.concurrent.FutureTask;
/**
* Performs the first phase of compilation, generating the set of permutations
@@ -100,16 +97,7 @@
CompileTask task = new CompileTask() {
@Override
public boolean run(TreeLogger logger) throws UnableToCompleteException {
- FutureTask<UpdateResult> updater = null;
- if (!options.isUpdateCheckDisabled()) {
- updater =
- CheckForUpdates.checkForUpdatesInBackgroundThread(logger, CheckForUpdates.ONE_DAY);
- }
- boolean success = new Precompile(options).run(logger);
- if (success) {
- CheckForUpdates.logUpdateAvailable(logger, updater);
- }
- return success;
+ return new Precompile(options).run(logger);
}
};
if (CompileTaskRunner.runWithAppropriateLogger(options, task)) {
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileOnePerm.java b/dev/core/src/com/google/gwt/dev/PrecompileOnePerm.java
index 01dff5c..dd679c6 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileOnePerm.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileOnePerm.java
@@ -22,8 +22,6 @@
import com.google.gwt.dev.cfg.ModuleDef;
import com.google.gwt.dev.cfg.ModuleDefLoader;
import com.google.gwt.dev.cfg.PropertyCombinations;
-import com.google.gwt.dev.shell.CheckForUpdates;
-import com.google.gwt.dev.shell.CheckForUpdates.UpdateResult;
import com.google.gwt.dev.util.Memory;
import com.google.gwt.dev.util.Util;
import com.google.gwt.dev.util.arg.ArgHandlerPerm;
@@ -34,7 +32,6 @@
import java.io.File;
import java.util.List;
-import java.util.concurrent.FutureTask;
/**
* Creates a ready-to-compile AST for a single permutation.
@@ -115,16 +112,7 @@
CompileTask task = new CompileTask() {
@Override
public boolean run(TreeLogger logger) throws UnableToCompleteException {
- FutureTask<UpdateResult> updater = null;
- if (!options.isUpdateCheckDisabled()) {
- updater = CheckForUpdates.checkForUpdatesInBackgroundThread(logger,
- CheckForUpdates.ONE_DAY);
- }
- boolean success = new PrecompileOnePerm(options).run(logger);
- if (success) {
- CheckForUpdates.logUpdateAvailable(logger, updater);
- }
- return success;
+ return new PrecompileOnePerm(options).run(logger);
}
};
if (CompileTaskRunner.runWithAppropriateLogger(options, task)) {
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
index 3dc0c9c..d262be9 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
@@ -19,6 +19,7 @@
import com.google.gwt.dev.util.arg.ArgHandlerClosureFormattedOutput;
import com.google.gwt.dev.util.arg.ArgHandlerCompileReport;
import com.google.gwt.dev.util.arg.ArgHandlerCompilerMetrics;
+import com.google.gwt.dev.util.arg.ArgHandlerDeprecatedDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerDeprecatedOptimizeDataflow;
import com.google.gwt.dev.util.arg.ArgHandlerDisableCastChecking;
import com.google.gwt.dev.util.arg.ArgHandlerDisableClassMetadata;
@@ -29,7 +30,6 @@
import com.google.gwt.dev.util.arg.ArgHandlerDisableRemoveDuplicateFunctions;
import com.google.gwt.dev.util.arg.ArgHandlerDisableRunAsync;
import com.google.gwt.dev.util.arg.ArgHandlerDisableSoycHtml;
-import com.google.gwt.dev.util.arg.ArgHandlerDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerDraftCompile;
import com.google.gwt.dev.util.arg.ArgHandlerDumpSignatures;
import com.google.gwt.dev.util.arg.ArgHandlerEnableAssertions;
@@ -71,7 +71,7 @@
registerHandler(new ArgHandlerDisableOrdinalizeEnums(options));
registerHandler(new ArgHandlerDisableRunAsync(options));
registerHandler(new ArgHandlerDisableSoycHtml(options));
- registerHandler(new ArgHandlerDisableUpdateCheck(options));
+ registerHandler(new ArgHandlerDeprecatedDisableUpdateCheck());
registerHandler(new ArgHandlerDraftCompile(options));
registerHandler(new ArgHandlerDumpSignatures());
registerHandler(new ArgHandlerEnableAssertions(options));
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptions.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptions.java
index 1c5f4f2..ec3e703 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptions.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptions.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev;
import com.google.gwt.dev.jjs.JJSOptions;
-import com.google.gwt.dev.util.arg.OptionDisableUpdateCheck;
import com.google.gwt.dev.util.arg.OptionEnableGeneratingOnShards;
import com.google.gwt.dev.util.arg.OptionGenDir;
import com.google.gwt.dev.util.arg.OptionSaveSource;
@@ -28,6 +27,6 @@
* The set of options for the Precompiler.
*/
public interface PrecompileTaskOptions extends JJSOptions, CompileTaskOptions, OptionGenDir,
- OptionSaveSource, OptionSourceMapFilePrefix, OptionValidateOnly, OptionDisableUpdateCheck,
- OptionEnableGeneratingOnShards, PrecompilationResult, OptionSetProperties {
+ OptionSaveSource, OptionSourceMapFilePrefix, OptionValidateOnly, OptionEnableGeneratingOnShards,
+ PrecompilationResult, OptionSetProperties {
}
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
index af48c7d..b8a38e1 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
@@ -33,7 +33,6 @@
*/
public class PrecompileTaskOptionsImpl extends CompileTaskOptionsImpl
implements PrecompileTaskOptions {
- private boolean disableUpdateCheck;
private boolean enableGeneratingOnShards = true;
private File genDir;
private final JJSOptionsImpl jjsOptions = new JJSOptionsImpl();
@@ -66,7 +65,6 @@
jjsOptions.copyFrom(other);
- setDisableUpdateCheck(other.isUpdateCheckDisabled());
setGenDir(other.getGenDir());
setSaveSource(other.shouldSaveSource());
setSourceMapFilePrefix(other.getSourceMapFilePrefix());
@@ -195,11 +193,6 @@
}
@Override
- public boolean isUpdateCheckDisabled() {
- return disableUpdateCheck;
- }
-
- @Override
public boolean isValidateOnly() {
return validateOnly;
}
@@ -225,11 +218,6 @@
}
@Override
- public void setDisableUpdateCheck(boolean disabled) {
- disableUpdateCheck = disabled;
- }
-
- @Override
public void setEnableAssertions(boolean enableAssertions) {
jjsOptions.setEnableAssertions(enableAssertions);
}
diff --git a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java b/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
deleted file mode 100644
index 5ac6c00..0000000
--- a/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * Copyright 2006 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.dev.shell;
-
-import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.TreeLogger.HelpInfo;
-import com.google.gwt.dev.About;
-import com.google.gwt.dev.GwtVersion;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Date;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.prefs.Preferences;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-/**
- * Orchestrates a best-effort attempt to find out if a new version of GWT is
- * available.
- */
-public final class CheckForUpdates {
-
- /**
- * Returns the result of an update check.
- */
- public interface UpdateResult {
- /**
- * @return the new version of GWT available.
- */
- GwtVersion getNewVersion();
-
- /**
- * @return the URL for details about the new version.
- */
- URL getURL();
- }
-
- public static final long ONE_DAY = 24 * 60 * 60 * 1000;
- public static final long ONE_MINUTE = 60 * 1000;
-
- // System properties used by CheckForUpdates
- protected static final String PROPERTY_DEBUG_HTTP_GET = "gwt.debugLowLevelHttpGet";
- protected static final String PROPERTY_PREFS_NAME = "gwt.prefsPathName";
- protected static final String PROPERTY_QUERY_URL = "gwt.forceVersionCheckURL";
-
- // Log levels -- in general we want the logging of the update process
- // to not be visible to normal users.
- private static final TreeLogger.Type CHECK_ERROR = TreeLogger.DEBUG;
- private static final TreeLogger.Type CHECK_INFO = TreeLogger.SPAM;
- private static final TreeLogger.Type CHECK_SPAM = TreeLogger.SPAM;
- private static final TreeLogger.Type CHECK_WARN = TreeLogger.SPAM;
-
- // Preferences keys
- private static final String FIRST_LAUNCH = "firstLaunch";
- private static final String HIGHEST_RUN_VERSION = "highestRunVersion";
- private static final String LAST_PING = "lastPing";
- private static final String NEXT_PING = "nextPing";
-
- // Uncomment one of constants below to try different variations of failure to
- // make sure we never interfere with the app running.
-
- // Check against a fake server to see failure to contact server.
- // protected static final String QUERY_URL =
- // "http://nonexistenthost:1111/gwt/currentversion.xml";
-
- // Check 404 on a real location that doesn't have the file.
- // protected static final String QUERY_URL =
- // "http://www.google.com/gwt/currentversion.xml";
-
- // A test URL for seeing it actually work in a sandbox.
- // protected static final String QUERY_URL =
- // "http://localhost/gwt/currentversion.xml";
-
- // The real URL that should be used.
- private static final String QUERY_URL = "http://tools.google.com/webtoolkit/currentversion.xml";
-
- public static FutureTask<UpdateResult> checkForUpdatesInBackgroundThread(
- final TreeLogger logger, final long minCheckMillis) {
- final String entryPoint = computeEntryPoint();
- FutureTask<UpdateResult> task = new FutureTask<UpdateResult>(
- new Callable<UpdateResult>() {
- @Override
- public UpdateResult call() throws Exception {
- final CheckForUpdates updateChecker = createUpdateChecker(logger,
- entryPoint);
- return updateChecker == null ? null
- : updateChecker.check(minCheckMillis);
- }
- });
- Thread checkerThread = new Thread(task, "GWT Update Checker");
- checkerThread.setDaemon(true);
- checkerThread.start();
- return task;
- }
-
- /**
- * Find the first method named "main" on the call stack and use its class as
- * the entry point.
- */
- public static String computeEntryPoint() {
- Throwable t = new Throwable();
- for (StackTraceElement stackTrace : t.getStackTrace()) {
- if (stackTrace.getMethodName().equals("main")) {
- // Strip package name from main's class
- String className = stackTrace.getClassName();
- int i = className.lastIndexOf('.');
- if (i >= 0) {
- return className.substring(i + 1);
- }
- return className;
- }
- }
- return null;
- }
-
- public static CheckForUpdates createUpdateChecker(TreeLogger logger) {
- return createUpdateChecker(logger, computeEntryPoint());
- }
-
- public static CheckForUpdates createUpdateChecker(TreeLogger logger,
- String entryPoint) {
- return new CheckForUpdates(logger, entryPoint);
- }
-
- public static void logUpdateAvailable(TreeLogger logger,
- FutureTask<UpdateResult> updater) {
- if (updater != null && updater.isDone()) {
- UpdateResult result = null;
- try {
- result = updater.get(0, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- // Silently ignore exception
- } catch (ExecutionException e) {
- // Silently ignore exception
- } catch (TimeoutException e) {
- // Silently ignore exception
- }
- logUpdateAvailable(logger, result);
- }
- }
-
- public static void logUpdateAvailable(TreeLogger logger,
- UpdateResult result) {
- if (result != null) {
- final URL url = result.getURL();
- logger.log(TreeLogger.WARN, "A new version of GWT ("
- + result.getNewVersion() + ") is available", null, new HelpInfo() {
- @Override
- public String getAnchorText() {
- return "Release Notes";
- }
-
- @Override
- public URL getURL() {
- return url;
- }
- });
- }
- }
-
- private static String getTextOfLastElementHavingTag(Document doc,
- String tagName) {
- NodeList nodeList = doc.getElementsByTagName(tagName);
- int n = nodeList.getLength();
- if (n > 0) {
- Element elem = (Element) nodeList.item(n - 1);
- // Assume the first child is the value.
- //
- Node firstChild = elem.getFirstChild();
- if (firstChild != null) {
- String text = firstChild.getNodeValue();
- return text;
- }
- }
-
- return null;
- }
-
- private String entryPoint;
-
- private TreeLogger logger;
-
- private GwtVersion myVersion;
-
- /**
- * Create an update checker which will poll a server URL and log a message
- * about an update if available.
- *
- * @param logger TreeLogger to use
- * @param entryPoint the name of the main entry point used for this execution
- */
- public CheckForUpdates(TreeLogger logger, String entryPoint) {
- this.logger = logger;
- this.entryPoint = entryPoint;
- myVersion = About.getGwtVersionObject();
- }
-
- /**
- * Check for updates and log to the logger if they are available.
- *
- * @return an UpdateResult or null if there is no new update
- */
- public UpdateResult check(long minCheckMillis) {
- TreeLogger branch = logger.branch(CHECK_INFO, "Checking for updates");
- try {
- String prefsName = System.getProperty(PROPERTY_PREFS_NAME);
- Preferences prefs;
- if (prefsName != null) {
- prefs = Preferences.userRoot().node(prefsName);
- } else {
- prefs = Preferences.userNodeForPackage(CheckForUpdates.class);
- }
-
- String queryURL = QUERY_URL;
- String forceCheckURL = System.getProperty(PROPERTY_QUERY_URL);
-
- if (forceCheckURL != null) {
- branch.log(CHECK_INFO, "Explicit version check URL: " + forceCheckURL);
- queryURL = forceCheckURL;
- }
-
- // Get our unique user id (based on absolute timestamp).
- //
- long currentTimeMillis = System.currentTimeMillis();
- String firstLaunch = prefs.get(FIRST_LAUNCH, null);
- if (firstLaunch == null) {
- firstLaunch = Long.toHexString(currentTimeMillis);
- prefs.put(FIRST_LAUNCH, firstLaunch);
- branch.log(CHECK_SPAM, "Setting first launch to " + firstLaunch);
- } else {
- branch.log(CHECK_SPAM, "First launch was " + firstLaunch);
- }
-
- // See if enough time has passed.
- //
- String lastPing = prefs.get(LAST_PING, "0");
- if (lastPing != null) {
- try {
- long lastPingTime = Long.parseLong(lastPing);
- if (currentTimeMillis < lastPingTime + minCheckMillis) {
- // it's not time yet
- branch.log(CHECK_INFO, "Last ping was " + new Date(lastPingTime)
- + ", min wait is " + minCheckMillis + "ms");
- return null;
- }
- } catch (NumberFormatException e) {
- branch.log(CHECK_WARN, "Error parsing last ping time", e);
- }
- }
-
- // See if it's time for our next ping yet.
- //
- String nextPing = prefs.get(NEXT_PING, "0");
- if (nextPing != null) {
- try {
- long nextPingTime = Long.parseLong(nextPing);
- if (currentTimeMillis < nextPingTime) {
- // it's not time yet
- branch.log(CHECK_INFO, "Next ping is not until "
- + new Date(nextPingTime));
- return null;
- }
- } catch (NumberFormatException e) {
- branch.log(CHECK_WARN, "Error parsing next ping time", e);
- }
- }
-
- // See if new version is available.
- //
- String url = queryURL + "?v=" + myVersion.toString() + "&id="
- + firstLaunch + "&r=" + About.getGwtGitRev();
- if (entryPoint != null) {
- url += "&e=" + entryPoint;
- }
-
- branch.log(CHECK_INFO, "Checking for new version at " + url);
-
- // Do the HTTP GET.
- //
- String fullUserAgent = makeUserAgent();
- byte[] response = doHttpGet(branch, fullUserAgent, url);
-
- if (response == null || response.length == 0) {
- // Problem. Quietly fail.
- //
- branch.log(CHECK_ERROR,
- "Failed to obtain current version info via HTTP");
- return null;
- }
-
- // Parse and process the response.
- // Bad responses will be silently ignored.
- //
- return parseResponse(branch, prefs, response);
-
- } catch (Throwable e) {
- // Always silently ignore any errors.
- //
- branch.log(CHECK_INFO, "Exception while processing version info", e);
- }
- return null;
- }
-
- private byte[] doHttpGet(TreeLogger branch, String userAgent, String url) {
- Throwable caught;
- InputStream is = null;
- try {
- URL urlToGet = new URL(url);
- URLConnection conn = urlToGet.openConnection();
- conn.setRequestProperty("User-Agent", userAgent);
- is = conn.getInputStream();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buffer = new byte[4096];
- int bytesRead;
- while ((bytesRead = is.read(buffer)) != -1) {
- baos.write(buffer, 0, bytesRead);
- }
- byte[] response = baos.toByteArray();
- return response;
- } catch (MalformedURLException e) {
- caught = e;
- } catch (IOException e) {
- caught = e;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- }
-
- if (System.getProperty(PROPERTY_DEBUG_HTTP_GET) != null) {
- branch.log(CHECK_ERROR, "Exception in HTTP request", caught);
- }
-
- return null;
- }
-
- private void appendUserAgentProperty(StringBuffer sb, String propName) {
- String propValue = System.getProperty(propName);
- if (propValue != null) {
- if (sb.length() > 0) {
- sb.append("; ");
- }
- sb.append(propName);
- sb.append("=");
- sb.append(propValue);
- }
- }
-
- /**
- * Creates a user-agent string by combining standard Java properties.
- */
- private String makeUserAgent() {
- String ua = "GWT Freshness Checker";
-
- StringBuffer extra = new StringBuffer();
- appendUserAgentProperty(extra, "java.vendor");
- appendUserAgentProperty(extra, "java.version");
- appendUserAgentProperty(extra, "os.arch");
- appendUserAgentProperty(extra, "os.name");
- appendUserAgentProperty(extra, "os.version");
-
- if (extra.length() > 0) {
- ua += " (" + extra.toString() + ")";
- }
-
- return ua;
- }
-
- private UpdateResult parseResponse(TreeLogger branch, Preferences prefs,
- byte[] response) throws IOException, ParserConfigurationException,
- SAXException {
-
- branch.log(CHECK_SPAM, "Parsing response (length " + response.length + ")");
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- ByteArrayInputStream bais = new ByteArrayInputStream(response);
-
- // Parse the XML.
- //
- builder.setErrorHandler(new ErrorHandler() {
-
- @Override
- public void error(SAXParseException exception) throws SAXException {
- // fail quietly
- }
-
- @Override
- public void fatalError(SAXParseException exception) throws SAXException {
- // fail quietly
- }
-
- @Override
- public void warning(SAXParseException exception) throws SAXException {
- // fail quietly
- }
- });
- Document doc = builder.parse(bais);
-
- // The latest version number.
- //
- String versionString = getTextOfLastElementHavingTag(doc, "latest-version");
- if (versionString == null) {
- // Not valid; quietly fail.
- //
- branch.log(CHECK_ERROR, "Failed to find <latest-version>");
- return null;
- }
- GwtVersion currentReleasedVersion;
- try {
- currentReleasedVersion = new GwtVersion(versionString.trim());
- } catch (NumberFormatException e) {
- branch.log(CHECK_ERROR, "Bad version: " + versionString, e);
- return null;
- }
-
- // Ping delay for server-controlled throttling.
- //
- String pingDelaySecsStr = getTextOfLastElementHavingTag(doc,
- "min-wait-seconds");
- int pingDelaySecs = 0;
- if (pingDelaySecsStr == null) {
- // Not valid; quietly fail.
- //
- branch.log(CHECK_ERROR, "Missing <min-wait-seconds>");
- return null;
- }
- try {
- pingDelaySecs = Integer.parseInt(pingDelaySecsStr.trim());
- } catch (NumberFormatException e) {
- // Not a valid number; quietly fail.
- //
- branch.log(CHECK_ERROR, "Bad min-wait-seconds number: "
- + pingDelaySecsStr);
- return null;
- }
-
- String url = getTextOfLastElementHavingTag(doc, "notification-url");
-
- if (url == null) {
- // no URL, so write the HTML locally and provide a URL from that
-
- // Read the HTML.
- //
- String html = getTextOfLastElementHavingTag(doc, "notification");
-
- if (html == null) {
- // Not valid; quietly fail.
- //
- branch.log(CHECK_ERROR, "Missing <notification>");
- return null;
- }
- PrintWriter writer = null;
- try {
- String tempDir = System.getProperty("java.io.tmpdir");
- File updateHtml = new File(tempDir, "gwt-update-"
- + currentReleasedVersion + ".html");
- writer = new PrintWriter(new FileOutputStream(updateHtml));
- writer.print(html);
- url = "file://" + updateHtml.getAbsolutePath();
- } finally {
- if (writer != null) {
- writer.close();
- }
- }
- }
-
- // Okay -- this is a valid response.
- //
- return processResponse(branch, prefs, currentReleasedVersion,
- pingDelaySecs, url);
- }
-
- private UpdateResult processResponse(TreeLogger branch, Preferences prefs,
- final GwtVersion serverVersion, int pingDelaySecs, final String notifyUrl) {
-
- // Record a ping; don't ping again until the delay is up.
- //
- long currentTimeMillis = System.currentTimeMillis();
- long nextPingTime = currentTimeMillis + pingDelaySecs * 1000;
- prefs.put(NEXT_PING, String.valueOf(nextPingTime));
- prefs.put(LAST_PING, String.valueOf(currentTimeMillis));
-
- branch.log(CHECK_INFO, "Ping delay is " + pingDelaySecs + "; next ping at "
- + new Date(nextPingTime));
-
- if (myVersion.isNoNagVersion()) {
- // If the version number indicates no nagging about updates, exit here
- // once we have recorded the next ping time. No-nag versions (ie,
- // trunk builds) should also not update the highest version that has been
- // run.
- return null;
- }
-
- // Update the highest version of GWT that has been run if we are later.
- GwtVersion highestRunVersion = new GwtVersion(prefs.get(
- HIGHEST_RUN_VERSION, null));
- if (myVersion.compareTo(highestRunVersion) > 0) {
- highestRunVersion = myVersion;
- prefs.put(HIGHEST_RUN_VERSION, highestRunVersion.toString());
- }
-
- // Are we up to date already?
- //
- if (highestRunVersion.compareTo(serverVersion) >= 0) {
- // Yes, we are.
- //
- branch.log(CHECK_INFO, "Server version (" + serverVersion
- + ") is not newer than " + highestRunVersion);
- return null;
- }
-
- // Commence nagging.
- //
- URL url = null;
- try {
- url = new URL(notifyUrl);
- } catch (MalformedURLException e) {
- logger.log(CHECK_ERROR, "Malformed notify URL: " + notifyUrl, e);
- }
- final URL finalUrl = url;
- return new UpdateResult() {
- @Override
- public GwtVersion getNewVersion() {
- return serverVersion;
- }
-
- @Override
- public URL getURL() {
- return finalUrl;
- }
- };
- }
-}
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableUpdateCheck.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDeprecatedDisableUpdateCheck.java
similarity index 76%
rename from dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableUpdateCheck.java
rename to dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDeprecatedDisableUpdateCheck.java
index ff9cd48..bb12f79 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableUpdateCheck.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDeprecatedDisableUpdateCheck.java
@@ -20,19 +20,16 @@
/**
* Checks to see if an updated version of GWT is available.
*/
-public final class ArgHandlerDisableUpdateCheck extends ArgHandlerFlag {
+@Deprecated
+public final class ArgHandlerDeprecatedDisableUpdateCheck extends ArgHandlerFlag {
- private final OptionDisableUpdateCheck option;
-
- public ArgHandlerDisableUpdateCheck(OptionDisableUpdateCheck option) {
- this.option = option;
-
+ public ArgHandlerDeprecatedDisableUpdateCheck() {
addTagValue("-XdisableUpdateCheck", false);
}
@Override
public String getPurposeSnippet() {
- return "Check to see if an updated version of GWT is available.";
+ return "Deprecated flag.";
}
@Override
@@ -47,7 +44,6 @@
@Override
public boolean setFlag(boolean value) {
- option.setDisableUpdateCheck(!value);
return true;
}
@@ -58,6 +54,6 @@
@Override
public boolean getDefaultValue() {
- return !option.isUpdateCheckDisabled();
+ return true;
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/OptionDisableUpdateCheck.java b/dev/core/src/com/google/gwt/dev/util/arg/OptionDisableUpdateCheck.java
deleted file mode 100644
index 4046ce2..0000000
--- a/dev/core/src/com/google/gwt/dev/util/arg/OptionDisableUpdateCheck.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2009 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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.dev.util.arg;
-
-/**
- * Option to set the compiler working directory.
- */
-public interface OptionDisableUpdateCheck {
-
- /**
- * Check to see if update checks are disabled.
- */
- boolean isUpdateCheckDisabled();
-
- /**
- * Sets the disable update check flag.
- */
- void setDisableUpdateCheck(boolean disabled);
-}
diff --git a/dev/core/test/com/google/gwt/dev/PrecompileTaskArgProcessorTest.java b/dev/core/test/com/google/gwt/dev/PrecompileTaskArgProcessorTest.java
index e182dc1..6a07ff4 100644
--- a/dev/core/test/com/google/gwt/dev/PrecompileTaskArgProcessorTest.java
+++ b/dev/core/test/com/google/gwt/dev/PrecompileTaskArgProcessorTest.java
@@ -60,7 +60,6 @@
handledOptions.shouldRemoveDuplicateFunctions());
assertNotEquals(defaultOptions.isRunAsyncEnabled(), handledOptions.isRunAsyncEnabled());
assertNotEquals(defaultOptions.isSoycHtmlDisabled(), handledOptions.isSoycHtmlDisabled());
- assertNotEquals(defaultOptions.isUpdateCheckDisabled(), handledOptions.isUpdateCheckDisabled());
assertNotEquals(defaultOptions.isEnableAssertions(), handledOptions.isEnableAssertions());
assertNotEquals(defaultOptions.isSoycEnabled(), handledOptions.isSoycEnabled());
assertNotEquals(defaultOptions.isSoycExtra(), handledOptions.isSoycExtra());
diff --git a/user/src/com/google/gwt/junit/JUnitShell.java b/user/src/com/google/gwt/junit/JUnitShell.java
index e0f228c..dd4a3d0 100644
--- a/user/src/com/google/gwt/junit/JUnitShell.java
+++ b/user/src/com/google/gwt/junit/JUnitShell.java
@@ -36,10 +36,10 @@
import com.google.gwt.dev.javac.CompilationState;
import com.google.gwt.dev.javac.CompilationUnit;
import com.google.gwt.dev.jjs.JsOutputOption;
-import com.google.gwt.dev.shell.CheckForUpdates;
import com.google.gwt.dev.shell.jetty.JettyLauncher;
import com.google.gwt.dev.util.arg.ArgHandlerClosureFormattedOutput;
import com.google.gwt.dev.util.arg.ArgHandlerDeployDir;
+import com.google.gwt.dev.util.arg.ArgHandlerDeprecatedDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerDeprecatedOptimizeDataflow;
import com.google.gwt.dev.util.arg.ArgHandlerDisableCastChecking;
import com.google.gwt.dev.util.arg.ArgHandlerDisableClassMetadata;
@@ -48,7 +48,6 @@
import com.google.gwt.dev.util.arg.ArgHandlerDisableOrdinalizeEnums;
import com.google.gwt.dev.util.arg.ArgHandlerDisableRemoveDuplicateFunctions;
import com.google.gwt.dev.util.arg.ArgHandlerDisableRunAsync;
-import com.google.gwt.dev.util.arg.ArgHandlerDisableUpdateCheck;
import com.google.gwt.dev.util.arg.ArgHandlerDraftCompile;
import com.google.gwt.dev.util.arg.ArgHandlerEnableAssertions;
import com.google.gwt.dev.util.arg.ArgHandlerExtraDir;
@@ -292,7 +291,7 @@
registerHandler(new ArgHandlerDisableOrdinalizeEnums(options));
registerHandler(new ArgHandlerDisableRemoveDuplicateFunctions(options));
registerHandler(new ArgHandlerDisableRunAsync(options));
- registerHandler(new ArgHandlerDisableUpdateCheck(options));
+ registerHandler(new ArgHandlerDeprecatedDisableUpdateCheck());
registerHandler(new ArgHandlerDraftCompile(options));
registerHandler(new ArgHandlerLocalWorkers(options));
registerHandler(new ArgHandlerNamespace(options));
@@ -928,14 +927,6 @@
return compilerContext;
}
- /**
- * Check for updates once a minute.
- */
- @Override
- protected long checkForUpdatesInterval() {
- return CheckForUpdates.ONE_MINUTE;
- }
-
@Override
protected HostedModeOptions createOptions() {
HostedModeOptions options = super.createOptions();