Revision: 6466 Author: [email protected] Date: Mon Oct 26 11:51:28 2009 Log: Checkin first cut of polishing off Sam's single-XPI work. I haven't fixed the MSVC project files, and I haven't rebuilt all the plugins yet (many of them are just moving around previously compiled versions).
http://code.google.com/p/google-web-toolkit/source/detail?r=6466 Added: /changes/jat/single-xpi/branch-info.txt /changes/jat/single-xpi/dev/core/src/com/google/gwt/dev/GwtVersion.java /changes/jat/single-xpi/dev/core/test/com/google/gwt/dev/GwtVersionTest.java /changes/jat/single-xpi/plugins/xpcom/install-template.rdf /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/components/stub.js /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/install.rdf /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff2 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff2/libgwt_dmp_ff2.dylib /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff3/libgwt_dmp_ff3.dylib /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff35 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff35/libgwt_dmp_ff35.dylib /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff2 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff2/libgwt_dmp_ff2.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3/libgwt_dmp_ff3.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3+ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3+/libgwt_dmp_ff3+.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff35 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff35/libgwt_dmp_ff35.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff2 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff2/libgwt_dmp_ff2.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3/libgwt_dmp_ff3.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3+ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3+/libgwt_dmp_ff3+.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff35 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff35/libgwt_dmp_ff35.so /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff2 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff3/xpOOPHM.dll /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff35 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff35/xpOOPHM.dll Deleted: /changes/jat/single-xpi/distro-source/linux /changes/jat/single-xpi/distro-source/mac /changes/jat/single-xpi/distro-source/windows /changes/jat/single-xpi/plugins/xpcom/install-template-ff2.rdf /changes/jat/single-xpi/plugins/xpcom/install-template-ff3+.rdf /changes/jat/single-xpi/plugins/xpcom/install-template-ff3.rdf /changes/jat/single-xpi/plugins/xpcom/install-template-ff35.rdf /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension-ff2 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension-ff3 /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension-ff3+ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension-ff35 /changes/jat/single-xpi/plugins/xpcom/prebuilt/gwt-dmp-ff2.xpi /changes/jat/single-xpi/plugins/xpcom/prebuilt/gwt-dmp-ff3+.xpi /changes/jat/single-xpi/plugins/xpcom/prebuilt/gwt-dmp-ff3.xpi /changes/jat/single-xpi/plugins/xpcom/prebuilt/gwt-dmp-ff35.xpi Modified: /changes/jat/single-xpi/dev/core/src/com/google/gwt/dev/About.java /changes/jat/single-xpi/dev/core/src/com/google/gwt/dev/shell/CheckForUpdates.java /changes/jat/single-xpi/dev/core/test/com/google/gwt/dev/AboutTest.java /changes/jat/single-xpi/dev/core/test/com/google/gwt/dev/shell/CheckForUpdatesTest.java /changes/jat/single-xpi/distro-source/build.xml /changes/jat/single-xpi/plugins/xpcom/Makefile /changes/jat/single-xpi/plugins/xpcom/ModuleOOPHM.cpp /changes/jat/single-xpi/user/src/com/google/gwt/user/tools/WebAppCreator.java ======================================= --- /dev/null +++ /changes/jat/single-xpi/branch-info.txt Mon Oct 26 11:51:28 2009 @@ -0,0 +1,8 @@ +Created from trunk @6464 +======================== +svn copy \ + https://google-web-toolkit.googlecode.com/svn/tr...@6464 \ + https://google-web-toolkit.googlecode.com/svn/changes/jat/single-xpi + +Merged from trunk +================ ======================================= --- /dev/null +++ /changes/jat/single-xpi/dev/core/src/com/google/gwt/dev/GwtVersion.java Mon Oct 26 11:51:28 2009 @@ -0,0 +1,314 @@ +/* + * 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; + +import java.util.Arrays; + +/** + * Represents a GWT version. + */ +public final class GwtVersion implements Comparable<GwtVersion> { + + /** + * Represents the release type and number, such as milestone 1, release + * candidate 3, or just release (no number). Immutable. + */ + public static final class ReleaseNumber + implements Comparable<ReleaseNumber> { + + public static final ReleaseNumber RELEASE = new ReleaseNumber( + ReleaseType.Release, 0); + + /** + * Parse a release number from a string. + * + * <p>Acceptable formats: + * <ul> + * <li>optional leading hyphen + * <li>ms\d+ for milestone + * <li>rc\d+ for release candidate + * <li>trailing garbage is ignored + * <li>if no suffix (or an invalid suffix is detected), it is treated as a + * released version + * <li>case is ignore for matching release type tags + * </ul> + * @param value the string to parse + * @return a ReleaseNumber instance + */ + public static ReleaseNumber parse(String value) { + value = value.toLowerCase(); + if (value.startsWith("-")) { + value = value.substring(1); + } + ReleaseType releaseType = ReleaseType.Release; + int releaseNumberStart = -1; + if (value.startsWith("ms")) { + releaseType = ReleaseType.Milestone; + releaseNumberStart = 2; + } else if (value.startsWith("rc")) { + releaseType = ReleaseType.ReleaseCandidate; + releaseNumberStart = 2; + } + int releaseNumber = 0; + if (releaseNumberStart >= 0) { + int releaseNumberEnd = releaseNumberStart; + int len = value.length(); + while (releaseNumberEnd < len && Character.isDigit(value.charAt( + releaseNumberEnd))) { + ++releaseNumberEnd; + } + try { + releaseNumber = Integer.parseInt(value.substring(releaseNumberStart, + releaseNumberEnd)); + } catch (NumberFormatException e) { + // leave releaseNumber at 0 if we can't parse the value + } + } + return new ReleaseNumber(releaseType, releaseNumber); + } + private final int releaseNumber; + + private final ReleaseType releaseType; + + public ReleaseNumber(ReleaseType releaseType, int releaseNumber) { + this.releaseType = releaseType; + this.releaseNumber = releaseNumber; + } + + public int compareTo(ReleaseNumber other) { + int c = releaseType.compareTo(other.releaseType); + if (c == 0) { + c = releaseNumber - other.releaseNumber; + } + return c; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ReleaseNumber other = (ReleaseNumber) obj; + return releaseType.equals(other.releaseType) + && releaseNumber == other.releaseNumber; + } + + public int getReleaseNumber() { + return releaseNumber; + } + + public ReleaseType getReleaseType() { + return releaseType; + } + + @Override + public int hashCode() { + return releaseType.ordinal() + + ReleaseType.values().length * releaseNumber; + } + + @Override + public String toString() { + return releaseType.getSuffix(releaseNumber); + } + } + + /** + * Represents the type of a GWT release. + */ + public enum ReleaseType { + Milestone { + @Override + public String getSuffix(int releaseNumber) { + return "-ms" + releaseNumber; + } + }, + + Release, + + ReleaseCandidate { + @Override + public String getSuffix(int releaseNumber) { + return "-rc" + releaseNumber; + } + }; + + public String getSuffix(int releaseNumber) { + return ""; + } + } + + private static final String DEFAULT_NO_NAG_VERSION = "0.0.999"; + + private static final int COMPONENT_COUNT = 3; + + /** + * Array of 3 integers. + */ + private final int[] components = new int[COMPONENT_COUNT]; + + /** + * The release type/number. + */ + // TODO(jat): make final + private ReleaseNumber releaseNumber; + + /** + * Create a version that avoids any nagging -- "0.0.999". + */ + public GwtVersion() { + this(DEFAULT_NO_NAG_VERSION); + } + + /** + * Parse a version number as a string. An empty or null string are + * explicitly allowed and are equivalent to "0.0.0". + * + * <p>Acceptable format: + * <ul> + * <li>prefix before first digit is ignored + * <li>one or more digits or strings separated by a period + * <li>optional release number suffix, such as -ms1, -rc3, etc. + * <li>stops parsing at first space or dash + * </ul> + * + * <p>The returned version always contains at least 3 components (padding with + * "0" to 3 components) followed by a release number (which is always last). + * + * @param versionString GWT version in string form, ex: "2.1.0-rc2" + * @throws NumberFormatException + */ + public GwtVersion(String versionString) throws NumberFormatException { + parse(versionString); + } + + public int compareTo(GwtVersion other) { + for (int i = 0; i < COMPONENT_COUNT; ++i) { + int c = components[i] - other.components[i]; + if (c != 0) { + return c; + } + } + return releaseNumber.compareTo(other.releaseNumber); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GwtVersion)) { + return false; + } + GwtVersion other = (GwtVersion) o; + if (!Arrays.equals(components, other.components)) { + return false; + } + return releaseNumber.equals(other.releaseNumber); + } + + /** + * @return a copy of the array of version components, always exactly length 3. + */ + public int[] getComponents() { + return Arrays.copyOf(components, COMPONENT_COUNT); + } + + public ReleaseNumber getReleaseNumber() { + return releaseNumber; + } + + @Override + public int hashCode() { + return Arrays.hashCode(components) * 31 + releaseNumber.hashCode(); + } + + /** + * @return true if this version is a special no-nag version (where the user + * isn't notified that a newer version is available). This is defined as any + * version number with 999 in the third component. + */ + public boolean isNoNagVersion() { + return components[2] == 999; + } + + /** + * @return true if this version is a released version. + */ + public boolean isReleased() { + return releaseNumber.getReleaseType() == ReleaseType.Release; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(); + String prefix = ""; + for (int i = 0; i < COMPONENT_COUNT; ++i) { + buf.append(prefix).append(components[i]); + prefix = "."; + } + buf.append(releaseNumber.toString()); + return buf.toString(); + } + + /** + * Parse a string containing a GwtVersion. + * + * <p>Acceptable format: + * <ul> + * <li>prefix before first digit is ignored + * <li>one or more digits or strings separated by a period + * <li>optional release number suffix, such as -ms1, -rc3, etc. + * <li>stops parsing at first space or dash + * </ul> + * + * <p>The returned version always contains at least 3 components (padding with + * "0" to 3 components) followed by a release number (which is always last). + * + * @param versionString GWT version in string form, ex: "2.1.0-rc2" + */ + private void parse(String versionString) { + components[0] = components[1] = components[2] = 0; + releaseNumber = ReleaseNumber.RELEASE; + int len = versionString == null ? 0 : versionString.length(); + // Skip leading characters that are not digits to support a + // non-numeric prefix on a version string. + int index = 0; + for (; index < len; ++index) { + if (Character.isDigit(versionString.charAt(index))) { + break; + } + } + for (int component = 0; component < COMPONENT_COUNT; ++component) { + int componentStart = index; + while (index < len && Character.isDigit(versionString.charAt(index))) { + ++index; + } + if (index > componentStart) { + components[component] = Integer.parseInt(versionString.substring( + componentStart, index)); + } + if (index >= len || versionString.charAt(index) != '.') { + break; + } + ++index; + } + if (index < len) { + releaseNumber = ReleaseNumber.parse(versionString.substring(index)); + } + return; + } +} ======================================= --- /dev/null +++ /changes/jat/single-xpi/dev/core/test/com/google/gwt/dev/GwtVersionTest.java Mon Oct 26 11:51:28 2009 @@ -0,0 +1,260 @@ +/* + * 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; + +import com.google.gwt.dev.GwtVersion.ReleaseNumber; +import com.google.gwt.dev.GwtVersion.ReleaseType; + +import junit.framework.TestCase; + +/** + * Tests GwtVersion. + */ +public class GwtVersionTest extends TestCase { + + /** + * Check for compatibility between compareTo, equals, and hashCode. + */ + public void testCompareEqualsHashCode() { + checkCompareEqualsHashCode("0.0.0", "0.0.0"); + checkCompareEqualsHashCode("0.0.0", "0"); + checkCompareEqualsHashCode("1.2.3", "001.002.003"); + checkCompareEqualsHashCode("1.2.3", "001.002.004"); + checkCompareEqualsHashCode("1.2.4", "001.002.003"); + checkCompareEqualsHashCode("1.2.4-ms1", "1.2.4-ms1"); + checkCompareEqualsHashCode("1.2.4-ms2", "1.2.4-ms2"); + checkCompareEqualsHashCode("1.2.4-ms2", "1.2.4-rc1"); + } + + /** + * Test that GwtVersion.compareTo produced expected results. + */ + public void testCompareTo() { + GwtVersion v1 = new GwtVersion("0.0.0"); + assertEquals(0, v1.compareTo(v1)); + GwtVersion v2 = new GwtVersion("0.0.0"); + assertEquals(0, v1.compareTo(v2)); + assertEquals(0, v2.compareTo(v1)); + v2 = new GwtVersion("0.0.0b"); + assertTrue(v1.compareTo(v2) == 0); + assertTrue(v2.compareTo(v1) == 0); + v1 = new GwtVersion("0.0.0c"); + v2 = new GwtVersion("0.0.0b"); + assertTrue(v1.compareTo(v2) == 0); + assertTrue(v2.compareTo(v1) == 0); + v1 = new GwtVersion("1.9.41"); + v2 = new GwtVersion("1.11.12"); + assertTrue(v1.compareTo(v2) < 0); + assertTrue(v2.compareTo(v1) > 0); + v1 = new GwtVersion("1.9.41"); + v2 = new GwtVersion("1.4.12"); + assertTrue(v1.compareTo(v2) > 0); + assertTrue(v2.compareTo(v1) < 0); + v1 = new GwtVersion("1.9.41"); + v2 = new GwtVersion("2.0.0-ms1"); + assertTrue(v1.compareTo(v2) < 0); + assertTrue(v2.compareTo(v1) > 0); + v1 = new GwtVersion("2.0.0-ms2"); + v2 = new GwtVersion("2.0.0-rc1"); + assertTrue(v1.compareTo(v2) < 0); + assertTrue(v2.compareTo(v1) > 0); + v1 = new GwtVersion("001.002.099"); + v2 = new GwtVersion("1.2.99"); + assertEquals(0, v1.compareTo(v2)); + assertEquals(0, v2.compareTo(v1)); + } + + /** + * Test that GwtVersion.equals produced expected results. + */ + public void testEquals() { + GwtVersion v1 = new GwtVersion("0.0.0"); + assertEquals(v1, v1); + GwtVersion v2 = new GwtVersion("0.0.0"); + assertEquals(v1, v2); + assertEquals(v2, v1); + v2 = new GwtVersion(""); + assertEquals(v1, v2); + assertEquals(v2, v1); + v2 = new GwtVersion("1.2.3"); + assertFalse(v1.equals(v2)); + assertFalse(v2.equals(v1)); + } + + /** + * Test that various versions are properly detected as to whether or not they + * are "no-nag" versions. + */ + public void testIsNoNagVersion() { + GwtVersion version = new GwtVersion("0.0.0"); + assertFalse(version.isNoNagVersion()); + version = new GwtVersion("0.0.999"); + assertTrue(version.isNoNagVersion()); + version = new GwtVersion("2.0.999"); + assertTrue(version.isNoNagVersion()); + version = new GwtVersion("2.0.999-rc1"); + assertTrue(version.isNoNagVersion()); + version = new GwtVersion("2.0.999-ms2"); + assertTrue(version.isNoNagVersion()); + version = new GwtVersion("0.999.0"); + assertFalse(version.isNoNagVersion()); + version = new GwtVersion("2.999.0-rc1"); + assertFalse(version.isNoNagVersion()); + } + + /** + * Verify that bogus version numbers don't fail. + */ + public void testParseBad() { + checkAllZerosVersion(""); + checkAllZerosVersion("bogus"); + checkAllZerosVersion("0.x.x"); + GwtVersion version = new GwtVersion("1.x.x"); + int[] components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(0, components[1]); + assertEquals(0, components[2]); + version = new GwtVersion("1.2.x"); + components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(0, components[2]); + version = new GwtVersion("1.2.3x"); + components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(3, components[2]); + } + + /** + * Tests parsing various version numbers. + */ + public void testParseBasic() { + GwtVersion version = new GwtVersion("1.2.3"); + int[] components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(3, components[2]); + ReleaseNumber releaseNumber = version.getReleaseNumber(); + assertEquals(ReleaseType.Release, releaseNumber.getReleaseType()); + version = new GwtVersion("1.2.3-ms1"); + components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(3, components[2]); + releaseNumber = version.getReleaseNumber(); + assertEquals(ReleaseType.Milestone, releaseNumber.getReleaseType()); + assertEquals(1, releaseNumber.getReleaseNumber()); + version = new GwtVersion("1.2.3-rc2"); + components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(3, components[2]); + releaseNumber = version.getReleaseNumber(); + assertEquals(ReleaseType.ReleaseCandidate, releaseNumber.getReleaseType()); + assertEquals(2, releaseNumber.getReleaseNumber()); + version = new GwtVersion("1.2.3-RC1"); + components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(1, components[0]); + assertEquals(2, components[1]); + assertEquals(3, components[2]); + releaseNumber = version.getReleaseNumber(); + assertEquals(ReleaseType.ReleaseCandidate, releaseNumber.getReleaseType()); + assertEquals(1, releaseNumber.getReleaseNumber()); + } + + /** + * Tests various ways you can get a version number of 0.0.0. + */ + public void testParseZeros() { + checkAllZerosVersion("0.0.0"); + checkAllZerosVersion("0.0"); + checkAllZerosVersion("0"); + checkAllZerosVersion(""); + checkAllZerosVersion(null); + checkAllZerosVersion("foo0.0.0"); + checkAllZerosVersion("foo0.0.0 bar"); + } + + /** + * Test that GwtVersion.toString() returns expected results. + */ + public void testToString() { + String versionString = "0.0.0"; + GwtVersion version = new GwtVersion(versionString); + assertEquals(versionString, version.toString()); + versionString = "0.0.0a"; + version = new GwtVersion(versionString); + assertEquals("0.0.0", version.toString()); + versionString = "foo 0.0.0a"; + version = new GwtVersion(versionString); + assertEquals("0.0.0", version.toString()); + versionString = "1.2.3"; + version = new GwtVersion(versionString); + assertEquals(versionString, version.toString()); + versionString = "1.2.3-rc1"; + version = new GwtVersion(versionString); + assertEquals(versionString, version.toString()); + versionString = "1.2.3-ms2"; + version = new GwtVersion(versionString); + assertEquals(versionString, version.toString()); + } + + /** + * Verify that the version string is treated equivalently to 0.0.0. + * + * @param versionString version number in string form + */ + private void checkAllZerosVersion(String versionString) { + GwtVersion version = new GwtVersion(versionString); + int[] components = version.getComponents(); + assertEquals(3, components.length); + assertEquals(0, components[0]); + assertEquals(0, components[1]); + assertEquals(0, components[2]); + ReleaseNumber releaseNumber = version.getReleaseNumber(); + assertEquals(ReleaseType.Release, releaseNumber.getReleaseType()); + } + + /** + * Check that compareTo, equals, and hashCode are compatible for a pair of + * versions. + * + * @param v1String string format version number to test + * @param v2String string format version number to test + */ + private void checkCompareEqualsHashCode(String v1String, String v2String) { + GwtVersion v1 = new GwtVersion(v1String); + GwtVersion v2 = new GwtVersion(v2String); + int h1 = v1.hashCode(); + int h2 = v2.hashCode(); + int c12 = v1.compareTo(v2); + int c21 = v2.compareTo(v1); + boolean e12 = v1.equals(v2); + boolean e21 = v2.equals(v1); + assertEquals("equals not symmetric", e12, e21); + assertEquals("compareTo not symmetric", c12, -c21); + assertEquals("compareTo/equals don't match", e12, c12 == 0); + assertEquals("hashCode/equals don't match", e12, h1 == h2); + } +} ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/install-template.rdf Mon Oct 26 11:51:28 2009 @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:id>[email protected]</em:id> + <em:name>GWT Development Mode Plugin (XPCOM) for Firefox</em:name> + <em:version>GWT_OOPHM_VERSION</em:version> + <em:type>2</em:type> + <em:targetApplication> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>1.5</em:minVersion> + <em:maxVersion>3.5.*</em:maxVersion> + </Description> + </em:targetApplication> + + <!-- Front End MetaData --> + <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> + <em:creator>Google, Inc.</em:creator> + <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> + <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> + + <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> + <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> + <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> + + <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> + + <!-- TODO + # prefs dialog + + # replace default about dialog + <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> + + # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format + <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> + <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> + + # platforms - any others? + <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> + <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> + <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> + <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> + --> + + </Description> +</RDF> ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/components/stub.js Mon Oct 26 11:51:28 2009 @@ -0,0 +1,103 @@ +// Copyright 2009, Google Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// 3. Neither the name of Google Inc. nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Our binary is compiled against different versions of the Gecko SDK for +// different versions of Firefox. But we want a single XPI so that users can +// switch between versions of Firefox without having to change their Gears +// version. + +// This JavaScript file is detected and loaded by Gecko when our extension is +// installed. We then use nsIComponentRegistrar to tell Gecko where our real +// components are located, depending on what version of Firefox we detect we are +// running in. + +const Cc = Components.classes; +const Ci = Components.interfaces; + +// Detect which version of our lib we should use. +function getLibFileName() { + var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo); + var geckoVersion = appInfo.platformVersion.substring(0, 3); + + if (geckoVersion == "1.8") { + return "ff2"; + } + + if (geckoVersion.substring(0, 3) == "1.9") { + var firefoxVersion = appInfo.version.substring(0, 3); + + if (firefoxVersion == "3.0") { + if (isFedora()) { + return "ff3+"; + } + return "ff3"; + } + + if (firefoxVersion == "3.5") { + return "ff35"; + } + + throw "Unexpected Firefox version: " + firefoxVersion; + } + + throw "Unexpected Gecko version: " + geckoVersion; +} + +function getPlatform() { + var runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime); + + if (runtime.OS == "Darwin") { + return runtime.OS + "-gcc3"; + } + + return runtime.OS + "_" + runtime.XPCOMABI; +} + +function isFedora() { + var navigator = Cc["@mozilla.org/network/protocol;1?name=http"]. + getService(Ci.nsIHttpProtocolHandler); + + return navigator.userAgent.indexOf("Fedora") != -1; +} + +// This function is called by Firefox at installation time. +function NSGetModule() { + return { + registerSelf: function(compMgr, location, loaderStr, type) { + var libFile = location.parent.parent; + libFile.append("lib"); + libFile.append(getPlatform()); + libFile.append(getLibFileName()); + + // Note: we register a directory instead of an individual file because + // Gecko will only load components with a specific file name pattern. We + // don't want this file to have to know about that. Luckily, if you + // register a directory, Gecko will look inside the directory for files + // to load. + var compMgr = compMgr.QueryInterface(Ci.nsIComponentRegistrar); + compMgr.autoRegister(libFile); + } + } +} ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/install.rdf Mon Oct 26 11:51:28 2009 @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:id>[email protected]</em:id> + <em:name>GWT Development Mode Plugin (XPCOM) for Firefox</em:name> + <em:version>0.9.6446M.20091024085802</em:version> + <em:type>2</em:type> + <em:targetApplication> + <Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>1.5</em:minVersion> + <em:maxVersion>3.5.*</em:maxVersion> + </Description> + </em:targetApplication> + + <!-- Front End MetaData --> + <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> + <em:creator>Google, Inc.</em:creator> + <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> + <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> + + <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> + <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> + <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> + + <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> + + <!-- TODO + # prefs dialog + + # replace default about dialog + <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> + + # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format + <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> + <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> + + # platforms - any others? + <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> + <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> + <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> + <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> + <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> + --> + + </Description> +</RDF> ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff2/libgwt_dmp_ff2.dylib Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff3/libgwt_dmp_ff3.dylib Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Darwin-gcc3/ff35/libgwt_dmp_ff35.dylib Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff2/libgwt_dmp_ff2.so Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3/libgwt_dmp_ff3.so Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff3+/libgwt_dmp_ff3+.so Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86-gcc3/ff35/libgwt_dmp_ff35.so Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff2/libgwt_dmp_ff2.so Mon Oct 26 11:51:28 2009 File is too large to display a diff. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3/libgwt_dmp_ff3.so Mon Oct 26 11:51:28 2009 File is too large to display a diff. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff3+/libgwt_dmp_ff3+.so Mon Oct 26 11:51:28 2009 File is too large to display a diff. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/Linux_x86_64-gcc3/ff35/libgwt_dmp_ff35.so Mon Oct 26 11:51:28 2009 File is too large to display a diff. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff3/xpOOPHM.dll Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /dev/null +++ /changes/jat/single-xpi/plugins/xpcom/prebuilt/extension/lib/WINNT_x86-msvc/ff35/xpOOPHM.dll Mon Oct 26 11:51:28 2009 Binary file, no diff available. ======================================= --- /changes/jat/single-xpi/plugins/xpcom/install-template-ff2.rdf Thu Sep 3 15:22:56 2009 +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0"?> -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - - <Description about="urn:mozilla:install-manifest"> - <em:id>[email protected]</em:id> - <em:name>GWT Development Mode Plugin (XPCOM) for FF v1.5-2.x</em:name> - <em:version>GWT_OOPHM_VERSION</em:version> - <em:type>2</em:type> - <em:targetApplication> - <Description> - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>1.5</em:minVersion> - <em:maxVersion>2.*</em:maxVersion> - </Description> - </em:targetApplication> - - <!-- Front End MetaData --> - <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> - <em:creator>Google, Inc.</em:creator> - <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> - <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> - - <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> - <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> - - <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> - - <!-- TODO - - # replace default about dialog - <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> - - # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format - <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> - <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> - - # platforms - any others? - <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> - <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> - <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> - --> - - </Description> -</RDF> ======================================= --- /changes/jat/single-xpi/plugins/xpcom/install-template-ff3+.rdf Thu Sep 3 15:22:56 2009 +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - - <Description about="urn:mozilla:install-manifest"> - <em:id>[email protected]</em:id> - <em:name>GWT Development Mode Plugin (XPCOM) for FF v3.x (alt libraries)</em:name> - <em:version>GWT_OOPHM_VERSION</em:version> - <em:type>2</em:type> - <em:targetApplication> - <Description> - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>3</em:minVersion> - <em:maxVersion>3.3.*</em:maxVersion> - </Description> - </em:targetApplication> - - <!-- Front End MetaData --> - <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> - <em:creator>Google, Inc.</em:creator> - <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> - <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> - - <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> - - <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> - - <!-- TODO - # prefs dialog - - # replace default about dialog - <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> - - # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format - <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> - <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> - - # platforms - any others? - <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> - <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> - <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> - <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> - --> - - </Description> -</RDF> ======================================= --- /changes/jat/single-xpi/plugins/xpcom/install-template-ff3.rdf Thu Sep 3 15:22:56 2009 +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0"?> -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - - <Description about="urn:mozilla:install-manifest"> - <em:id>[email protected]</em:id> - <em:name>GWT Development Mode Plugin (XPCOM) for FF v3.x</em:name> - <em:version>GWT_OOPHM_VERSION</em:version> - <em:type>2</em:type> - <em:targetApplication> - <Description> - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>3</em:minVersion> - <em:maxVersion>3.3.*</em:maxVersion> - </Description> - </em:targetApplication> - - <!-- Front End MetaData --> - <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> - <em:creator>Google, Inc.</em:creator> - <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> - <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> - - <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> - <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> - <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> - - <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> - - <!-- TODO - - # replace default about dialog - <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> - - # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format - <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> - <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> - - # platforms - any others? - <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> - <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> - --> - - </Description> -</RDF> ======================================= --- /changes/jat/single-xpi/plugins/xpcom/install-template-ff35.rdf Thu Sep 3 15:22:56 2009 +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0"?> -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - - <Description about="urn:mozilla:install-manifest"> - <em:id>[email protected]</em:id> - <em:name>GWT Development Mode Plugin (XPCOM) for FF v3.5+</em:name> - <em:version>GWT_OOPHM_VERSION</em:version> - <em:type>2</em:type> - <em:targetApplication> - <Description> - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>3.4</em:minVersion> - <em:maxVersion>3.*</em:maxVersion> - </Description> - </em:targetApplication> - - <!-- Front End MetaData --> - <em:description>A plugin to support GWT development-mode in XPCOM-based browsers</em:description> - <em:creator>Google, Inc.</em:creator> - <em:homepageURL>http://code.google.com/webtoolkit/</em:homepageURL> - <em:iconURL>chrome://gwt-dmp/skin/icon.png</em:iconURL> - - <em:targetPlatform>Linux_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Linux_x86_64-gcc3</em:targetPlatform> - <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform> - <em:targetPlatform>Darwin_x86-gcc3</em:targetPlatform> - <em:targetPlatform>Darwin_ppc-gcc3</em:targetPlatform> - - <em:optionsURL>chrome://gwt-dmp/content/options.xul</em:optionsURL> - - <!-- TODO - - # replace default about dialog - <em:aboutURL>chrome://gwt-dmp/content/about.xul</em:aboutURL> - - # updates, see http://developer.mozilla.org/en/docs/Extension_Versioning%2C_Update_and_Compatibility#Update_RDF_Format - <em:updateURL>https://xxx.google.com/.../update.rdf</em:updateURL> - <em:updateURL>http://google-web-toolkit.googlecode.com/svn/trunk/plugins/xpcom/prebuilt/update.rdf</em:updateURL> - - # platforms - any others? - <em:targetPlatform>SunOS_sparc-sunc</em:targetPlatform> - <em:targetPlatform>SunOS_x86-sunc</em:targetPlatform> - --> - - </Description> -</RDF> ======================================= --- /changes/jat/single-xpi/plugins/xpcom/prebuilt/gwt-dmp-ff2.xpi Thu Sep 3 15:22:56 2009 +++ /dev/null Binary file, no diff available. ======================================= ***Additional files exist in this changeset.*** --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
