For public GWT builds, application creator now generates a DTD reference in the GWT module.
Review by: bobv
Issue: 2190
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@4442 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/tools/.classpathsrc b/user/src/com/google/gwt/user/tools/.classpathsrc
index 3f02e5c..7b82224 100644
--- a/user/src/com/google/gwt/user/tools/.classpathsrc
+++ b/user/src/com/google/gwt/user/tools/.classpathsrc
@@ -4,6 +4,5 @@
<classpathentry kind="lib" path="@gwtUserPath"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <classpathentry kind="output" path="war/WEB-INF/classes"/>
-@eclipseClassPathEntries
+ <classpathentry kind="output" path="war/WEB-INF/classes"/>@eclipseClassPathEntries
</classpath>
diff --git a/user/src/com/google/gwt/user/tools/ApplicationCreator.java b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
index 8a82145..90e1092 100644
--- a/user/src/com/google/gwt/user/tools/ApplicationCreator.java
+++ b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
@@ -15,6 +15,7 @@
*/
package com.google.gwt.user.tools;
+import com.google.gwt.dev.About;
import com.google.gwt.dev.Compiler;
import com.google.gwt.dev.HostedMode;
import com.google.gwt.dev.cfg.ModuleDefLoader;
@@ -237,40 +238,31 @@
String gwtDevPath = installPath + '/' + Utility.getDevJarName();
String gwtServletPath = installPath + '/' + "gwt-servlet.jar";
+ // Public builds generate a DTD reference.
+ String gwtModuleDtd = "";
+ if (!About.GWT_VERSION_NUM.endsWith(".999")
+ && !About.GWT_VERSION_NUM.startsWith("0.0")) {
+ gwtModuleDtd = "\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit "
+ + About.GWT_VERSION_NUM
+ + "//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/"
+ + About.GWT_VERSION_NUM + "/distro-source/core/src/gwt-module.dtd\">";
+ }
+
// Validate the arguments for extra class path entries and modules.
if (!CreatorUtilities.validatePathsAndModules(gwtUserPath, extraClassPaths,
extraModules)) {
return;
}
// Figure out what platform we're on
- //
- boolean isWindows = gwtDevPath.substring(gwtDevPath.lastIndexOf('/') + 1).indexOf(
- "windows") >= 0;
boolean isMacOsX = gwtDevPath.substring(gwtDevPath.lastIndexOf('/') + 1).indexOf(
"mac") >= 0;
- // If the path from here to the install directory is relative, we need to
- // set specific "base" directory tags; this is for sample generation during
- // the build.
- String basePathEnv;
- if (!new File(installPath).isAbsolute()) {
- if (isWindows) {
- basePathEnv = "%~dp0\\";
- } else {
- basePathEnv = "$APPDIR/";
- }
- } else {
- basePathEnv = "";
- }
-
// Check out the class and package names.
- //
int pos = fullClassName.lastIndexOf('.');
String clientPackageName = fullClassName.substring(0, pos);
String className = fullClassName.substring(pos + 1);
// Compute module name and directories
- //
pos = clientPackageName.lastIndexOf('.');
File basePackageDir;
String moduleName;
@@ -300,8 +292,10 @@
replacements.put("@moduleName", moduleName);
replacements.put("@clientPackage", clientPackageName);
replacements.put("@serverPackage", serverPackageName);
- replacements.put("@gwtUserPath", basePathEnv + gwtUserPath);
- replacements.put("@gwtDevPath", basePathEnv + gwtDevPath);
+ replacements.put("@gwtUserPath", gwtUserPath);
+ replacements.put("@gwtDevPath", gwtDevPath);
+ replacements.put("@gwtVersion", About.GWT_VERSION_NUM);
+ replacements.put("@gwtModuleDtd", gwtModuleDtd);
replacements.put("@shellClass", HostedMode.class.getName());
replacements.put("@compileClass", Compiler.class.getName());
replacements.put("@startupUrl", startupUrl);
@@ -364,7 +358,7 @@
if (eclipse != null) {
replacements.put("@projectName", eclipse);
// Build the list of extra paths
- replacements.put("@gwtServletPath", basePathEnv + gwtServletPath);
+ replacements.put("@gwtServletPath", gwtServletPath);
StringBuilder buf = new StringBuilder();
if (extraClassPaths != null) {
for (String path : extraClassPaths) {
@@ -392,11 +386,11 @@
throw new RuntimeException("Don't know how to handle path: " + path
+ ". It doesn't appear to be a directory or a .jar file");
}
- classpathEntries.append(" <classpathentry kind=\"");
+ classpathEntries.append("\n <classpathentry kind=\"");
classpathEntries.append(kindString);
classpathEntries.append("\" path=\"");
classpathEntries.append(path);
- classpathEntries.append("\"/>\n");
+ classpathEntries.append("\"/>");
}
}
replacements.put("@eclipseClassPathEntries", classpathEntries.toString());
@@ -429,9 +423,9 @@
// Create an <inherits> tag in the gwt.xml file for each extra module
StringBuilder buf = new StringBuilder();
for (String module : modules) {
- buf.append(" <inherits name=\"");
+ buf.append("\n <inherits name=\"");
buf.append(module);
- buf.append("\" />\n");
+ buf.append("\" />");
}
return buf.toString();
}
diff --git a/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc b/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
index 51c660a..4f6fcaf 100644
--- a/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/Module.gwt.xmlsrc
@@ -1,18 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>@gwtModuleDtd
<module rename-to='@newModuleName'>
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
- <!-- Inherit the core Web Toolkit stuff. -->
- <inherits name='com.google.gwt.user.User'/>
-
- <!-- Inherit the default GWT style sheet. You can change -->
- <!-- the theme of your GWT application by uncommenting -->
- <!-- any one of the following lines. -->
- <inherits name='com.google.gwt.user.theme.standard.Standard'/>
- <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
- <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
+ <!-- Inherit the default GWT style sheet. You can change -->
+ <!-- the theme of your GWT application by uncommenting -->
+ <!-- any one of the following lines. -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+ <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
- <!-- Other module inherits -->
-@extraModuleInherits
+ <!-- Other module inherits -->@extraModuleInherits
- <!-- Specify the app entry point class. -->
- <entry-point class='@clientPackage.@className'/>
+ <!-- Specify the app entry point class. -->
+ <entry-point class='@clientPackage.@className'/>
</module>