Revision: 5849 Author: [email protected] Date: Thu Jul 30 15:44:00 2009 Log: Fix ModuleDefSchema changes that got dropped in an earlier merge.
http://code.google.com/p/google-web-toolkit/source/detail?r=5849 Modified: /changes/jat/ihm/dev/core/src/com/google/gwt/dev/cfg/ModuleDefSchema.java ======================================= --- /changes/jat/ihm/dev/core/src/com/google/gwt/dev/cfg/ModuleDefSchema.java Wed Jul 29 15:12:22 2009 +++ /changes/jat/ihm/dev/core/src/com/google/gwt/dev/cfg/ModuleDefSchema.java Thu Jul 30 15:44:00 2009 @@ -55,6 +55,16 @@ protected final String __define_configuration_property_1_name = null; + protected final String __binary_1_path = ""; + + protected final String __binary_2_includes = ""; + + protected final String __binary_3_excludes = ""; + + protected final String __binary_4_defaultexcludes = "yes"; + + protected final String __binary_5_casesensitive = "true"; + protected final String __define_configuration_property_2_is_multi_valued = null; protected final String __define_linker_1_name = null; @@ -144,7 +154,23 @@ moduleDef.addLinker(name.name); return null; } - + + /** + * Indicates which subdirectories contain class files without + * necessarily adding a sourcepath entry. + */ + protected Schema __binary_begin(String path, String includes, + String excludes, String defaultExcludes, String caseSensitive) { + return fChild = new IncludeExcludeSchema(); + } + + protected void __binary_end(String path, String includes, String excludes, + String defaultExcludes, String caseSensitive) { + foundAnyBinary = true; + addBinaryPackage(path, includes, excludes, defaultExcludes, + caseSensitive); + } + protected Schema __clear_configuration_property_begin(PropertyName name) throws UnableToCompleteException { // Don't allow configuration properties with the same name as a @@ -174,7 +200,7 @@ protected Schema __define_configuration_property_begin(PropertyName name, String is_multi_valued) throws UnableToCompleteException { boolean isMultiValued = toPrimitiveBoolean(is_multi_valued); - + // Don't allow configuration properties with the same name as a // deferred-binding property. Property existingProperty = moduleDef.getProperties().find(name.token); @@ -233,7 +259,7 @@ } throw new UnableToCompleteException(); } - + // No children. return null; } @@ -559,7 +585,50 @@ caseSensitive, true); } - private void addDelimitedStringToSet(String delimited, String delimiter, + private void addBinaryPackage(String relDir, String includes, + String excludes, String defaultExcludes, String caseSensitive) { + IncludeExcludeSchema childSchema = ((IncludeExcludeSchema) fChild); + + Set<String> includeSet = childSchema.getIncludes(); + addDelimitedStringToSet(includes, "[ ,]", includeSet); + String[] includeList = includeSet.toArray(new String[includeSet.size()]); + + Set<String> excludeSet = childSchema.getExcludes(); + addDelimitedStringToSet(excludes, "[ ,]", excludeSet); + String[] excludeList = excludeSet.toArray(new String[excludeSet.size()]); + + boolean doDefaultExcludes = toPrimitiveBoolean(defaultExcludes); + boolean doCaseSensitive = toPrimitiveBoolean(caseSensitive); + + addBinaryPackage(modulePackageAsPath, relDir, includeList, excludeList, + doDefaultExcludes, doCaseSensitive); + } + + private void addBinaryPackage(String parentDir, String relDir, + String[] includeList, String[] excludeList, boolean defaultExcludes, + boolean caseSensitive) { + String normChildDir = normalizePathEntry(relDir); + if (normChildDir.startsWith("/")) { + logger.log(TreeLogger.WARN, "Non-relative public package: " + + normChildDir, null); + return; + } + if (normChildDir.startsWith("./") || normChildDir.indexOf("/./") >= 0) { + logger.log(TreeLogger.WARN, "Non-canonical public package: " + + normChildDir, null); + return; + } + if (normChildDir.startsWith("../") || normChildDir.indexOf("/../") >= 0) { + logger.log(TreeLogger.WARN, "Non-canonical public package: " + + normChildDir, null); + return; + } + String fullDir = parentDir + normChildDir; + moduleDef.addBinaryPackage(fullDir, includeList, excludeList, + defaultExcludes, caseSensitive); + } + + private void addDelimitedStringToSet(String delimited, String delimiter, Set<String> toSet) { if (delimited.length() > 0) { String[] split = delimited.split(delimiter); @@ -804,6 +873,7 @@ */ private final class LinkerNameAttrCvt extends AttributeConverter { + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { // Ensure the value is a valid Java identifier @@ -834,6 +904,7 @@ */ private final class NullableNameAttrCvt extends AttributeConverter { + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { if (value == null || value.length() == 0) { @@ -869,6 +940,7 @@ fReqdSuperclass = reqdSuperclass; } + @Override public Object convertToArg(Schema schema, int lineNumber, String elemName, String attrName, String attrValue) throws UnableToCompleteException { @@ -917,6 +989,7 @@ this.concreteType = concreteType; } + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { // Find the named property. @@ -955,6 +1028,7 @@ */ private final class PropertyNameAttrCvt extends AttributeConverter { + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { // Ensure each part of the name is valid. @@ -1012,6 +1086,8 @@ * Converts a comma-separated string into an array of property value tokens. */ private final class PropertyValueArrayAttrCvt extends AttributeConverter { + + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { String[] tokens = value.split(","); @@ -1032,6 +1108,8 @@ * Converts a string into a property value, validating it in the process. */ private final class PropertyValueAttrCvt extends AttributeConverter { + + @Override public Object convertToArg(Schema schema, int line, String elem, String attr, String value) throws UnableToCompleteException { @@ -1108,6 +1186,7 @@ private final ClassAttrCvt classAttrCvt = new ClassAttrCvt(); private final PropertyAttrCvt configurationPropAttrCvt = new PropertyAttrCvt( ConfigurationProperty.class); + private boolean foundAnyBinary; private boolean foundAnyPublic; private boolean foundExplicitSourceOrSuperSource; private final ObjAttrCvt<Generator> genAttrCvt = new ObjAttrCvt<Generator>( @@ -1164,6 +1243,11 @@ bodySchema.addPublicPackage(modulePackageAsPath, "public", Empty.STRINGS, Empty.STRINGS, true, true); } + + if (!foundAnyBinary) { + bodySchema.addBinaryPackage(modulePackageAsPath, "", Empty.STRINGS, + Empty.STRINGS, true, true); + } // We do this in __module_end so this value is never inherited moduleDef.setNameOverride(renameTo.token); --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
