Deprecate IFrameLinker and XSLinker They'll also emit a warning at compile-time, unless suppressed by setting the iframe.linker.suppressDeprecationWarning configuration property to true. Bug: issue 8578 Change-Id: I7a119390240130f6846c11d14424d2eaa8e51061
diff --git a/dev/core/src/com/google/gwt/core/linker/IFrameLinker.java b/dev/core/src/com/google/gwt/core/linker/IFrameLinker.java index fae5c92..be81b4d 100644 --- a/dev/core/src/com/google/gwt/core/linker/IFrameLinker.java +++ b/dev/core/src/com/google/gwt/core/linker/IFrameLinker.java
@@ -18,6 +18,8 @@ import com.google.gwt.core.ext.LinkerContext; import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.linker.ArtifactSet; +import com.google.gwt.core.ext.linker.ConfigurationProperty; import com.google.gwt.core.ext.linker.LinkerOrder; import com.google.gwt.core.ext.linker.LinkerOrder.Order; import com.google.gwt.core.ext.linker.Shardable; @@ -28,19 +30,46 @@ /** * Implements the canonical GWT bootstrap sequence that loads the GWT module in * a separate iframe. + * + * @deprecated use {@link CrossSiteIframeLinker} instead. */ @LinkerOrder(Order.PRIMARY) @Shardable +@Deprecated public class IFrameLinker extends SelectionScriptLinker { + private static final String SUPPRESS_DEPRECATION_WARNING_PROPERTY = "iframe.linker.suppressDeprecationWarning"; + /** * This string is inserted between script chunks. It is made default access * for testing. */ static final String SCRIPT_CHUNK_SEPARATOR = "--></script>\n<script><!--\n"; + // Also used by the XSLinker. + static void maybeEmitDeprecationWarning(String linkerName, TreeLogger logger, LinkerContext context) { + boolean suppressDeprecationWarning = false; + for (ConfigurationProperty prop : context.getConfigurationProperties()) { + if (SUPPRESS_DEPRECATION_WARNING_PROPERTY.equals(prop.getName())) { + suppressDeprecationWarning = Boolean.parseBoolean(prop.getValues().get(0)); + break; + } + } + if (!suppressDeprecationWarning) { + logger.log(TreeLogger.WARN, + linkerName + " linker is deprecated; consider switching to the xsiframe linker"); + } + } + @Override public String getDescription() { - return "Standard"; + return "IFrame"; + } + + @Override + public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, + boolean onePermutation) throws UnableToCompleteException { + maybeEmitDeprecationWarning(getDescription(), logger, context); + return super.link(logger, context, artifacts, onePermutation); } @Override @@ -179,5 +208,4 @@ out.newline(); return out.toString(); } - }
diff --git a/dev/core/src/com/google/gwt/core/linker/XSLinker.java b/dev/core/src/com/google/gwt/core/linker/XSLinker.java index d379794..be23647 100644 --- a/dev/core/src/com/google/gwt/core/linker/XSLinker.java +++ b/dev/core/src/com/google/gwt/core/linker/XSLinker.java
@@ -17,6 +17,7 @@ import com.google.gwt.core.ext.LinkerContext; import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.linker.ArtifactSet; import com.google.gwt.core.ext.linker.LinkerOrder; import com.google.gwt.core.ext.linker.LinkerOrder.Order; @@ -28,9 +29,12 @@ /** * Generates a cross-site compatible bootstrap sequence. + * + * @deprecated use {@link CrossSiteIframeLinker} instead. */ @LinkerOrder(Order.PRIMARY) @Shardable +@Deprecated public class XSLinker extends SelectionScriptLinker { @Override public String getDescription() { @@ -38,6 +42,13 @@ } @Override + public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, + boolean onePermutation) throws UnableToCompleteException { + IFrameLinker.maybeEmitDeprecationWarning(getDescription(), logger, context); + return super.link(logger, context, artifacts, onePermutation); + } + + @Override protected String getCompilationExtension(TreeLogger logger, LinkerContext context) { return ".cache.js";
diff --git a/user/src/com/google/gwt/core/Core.gwt.xml b/user/src/com/google/gwt/core/Core.gwt.xml index 8196234..55d11bf 100644 --- a/user/src/com/google/gwt/core/Core.gwt.xml +++ b/user/src/com/google/gwt/core/Core.gwt.xml
@@ -43,6 +43,10 @@ <inherits name="com.google.gwt.core.XSLinker" /> <inherits name="com.google.gwt.core.CrossSiteIframeLinker" /> + <!-- std and xs linkers are deprecated and will emit a warning, which can be turned off --> + <define-configuration-property name="iframe.linker.suppressDeprecationWarning" is-multi-valued="false" /> + <set-configuration-property name="iframe.linker.suppressDeprecationWarning" value="false" /> + <!-- When true, compiles in support for GWT.unloadModule(), otherwise it is a no-op. --> <define-property name="gwt.unloadEnabled" values="false, true"/> <set-property name="gwt.unloadEnabled" value="false"/>