• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4  <modelVersion>4.0.0</modelVersion>
5  <parent>
6    <groupId>com.google.guava</groupId>
7    <artifactId>guava-parent</artifactId>
8    <version>32.1.2-jre</version>
9  </parent>
10  <artifactId>guava-gwt</artifactId>
11  <name>Guava GWT compatible libs</name>
12  <description>
13    Guava is a suite of core and expanded libraries that include
14    utility classes, Google's collections, I/O classes, and
15    much more.
16
17    This project includes GWT-friendly sources.
18  </description>
19  <properties>
20    <gwt.version>2.10.0</gwt.version>
21    <gwt.plugin.version>2.10.0</gwt.plugin.version>
22    <gwt.logLevel>WARN</gwt.logLevel>
23  </properties>
24  <repositories>
25    <repository>
26      <id>sonatype-google-snapshots</id>
27      <name>sonatype-google-snapshots</name>
28      <url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
29      <snapshots>
30        <enabled>true</enabled>
31      </snapshots>
32    </repository>
33  </repositories>
34  <pluginRepositories>
35    <pluginRepository>
36      <id>sonatype-snapshots</id>
37      <name>sonatype-snapshots</name>
38      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
39      <snapshots>
40        <enabled>true</enabled>
41      </snapshots>
42    </pluginRepository>
43  </pluginRepositories>
44  <dependencies>
45    <dependency>
46      <groupId>com.google.guava</groupId>
47      <artifactId>failureaccess</artifactId>
48      <version>1.0.2</version>
49    </dependency>
50    <dependency>
51      <groupId>com.google.guava</groupId>
52      <artifactId>guava</artifactId>
53      <version>${project.version}</version>
54    </dependency>
55    <dependency>
56      <groupId>com.google.guava</groupId>
57      <artifactId>guava-testlib</artifactId>
58      <version>${project.version}</version>
59      <scope>test</scope>
60    </dependency>
61    <dependency>
62      <groupId>com.google.guava</groupId>
63      <artifactId>guava-testlib</artifactId>
64      <version>${project.version}</version>
65      <classifier>tests</classifier>
66      <scope>test</scope>
67    </dependency>
68    <dependency>
69      <groupId>com.google.guava</groupId>
70      <artifactId>guava-tests</artifactId>
71      <version>${project.version}</version>
72      <classifier>tests</classifier>
73      <scope>test</scope>
74    </dependency>
75    <dependency>
76      <groupId>org.gwtproject</groupId>
77      <artifactId>gwt-dev</artifactId>
78      <version>${gwt.version}</version>
79      <scope>provided</scope>
80    </dependency>
81    <dependency>
82      <groupId>org.gwtproject</groupId>
83      <artifactId>gwt-user</artifactId>
84      <version>${gwt.version}</version>
85      <scope>test</scope>
86    </dependency>
87    <dependency>
88      <groupId>com.google.truth</groupId>
89      <artifactId>truth</artifactId>
90      <version>${truth.version}</version>
91      <classifier>gwt</classifier>
92      <scope>test</scope>
93      <exclusions>
94        <exclusion>
95          <!-- use the guava we're building. -->
96          <groupId>com.google.guava</groupId>
97          <artifactId>guava</artifactId>
98        </exclusion>
99      </exclusions>
100    </dependency>
101    <dependency>
102      <groupId>com.google.truth.extensions</groupId>
103      <artifactId>truth-java8-extension</artifactId>
104      <version>${truth.version}</version>
105      <classifier>gwt</classifier>
106      <scope>test</scope>
107      <exclusions>
108        <exclusion>
109          <!-- use the guava we're building. -->
110          <groupId>com.google.guava</groupId>
111          <artifactId>guava</artifactId>
112        </exclusion>
113      </exclusions>
114    </dependency>
115    <dependency>
116      <groupId>org.checkerframework</groupId>
117      <artifactId>checker-qual</artifactId>
118    </dependency>
119  </dependencies>
120  <build>
121    <plugins>
122      <plugin>
123        <artifactId>maven-compiler-plugin</artifactId>
124        <configuration>
125          <excludes>
126            <!-- Yes, we want to exclude ForceGuavaCompilation 4 times: -->
127            <!-- (And we might as well exclude DummyJavadocClass 3 times (though it would be harmless to include).) -->
128            <!-- 1. Don't compile it (since that requires a *non-test* dep on gwt-user. -->
129            <exclude>**/ForceGuavaCompilation*</exclude>
130            <exclude>**/DummyJavadocClass*</exclude>
131          </excludes>
132        </configuration>
133      </plugin>
134      <plugin>
135        <artifactId>maven-jar-plugin</artifactId>
136        <configuration>
137          <excludes>
138            <!-- 2. Don't include the source in the jar (since that would let users depend on it from GWT client code, which is compiled from source). -->
139            <exclude>**/ForceGuavaCompilation*</exclude>
140            <exclude>**/DummyJavadocClass*</exclude>
141          </excludes>
142        </configuration>
143      </plugin>
144      <plugin>
145        <artifactId>maven-source-plugin</artifactId>
146        <configuration>
147          <excludes>
148            <!-- 3. Don't include it in the source jar (since it's really more of a "test" than it is production code). -->
149            <exclude>**/ForceGuavaCompilation*</exclude>
150            <exclude>**/DummyJavadocClass*</exclude>
151          </excludes>
152        </configuration>
153      </plugin>
154      <plugin>
155        <artifactId>maven-javadoc-plugin</artifactId>
156        <configuration>
157          <sourceFileExcludes>
158            <!-- 4. Don't build Javadoc for it (since that, too, would require a *non-test* dep on gwt-user. -->
159            <sourceFileExclude>**/ForceGuavaCompilation*</sourceFileExclude>
160          </sourceFileExcludes>
161          <!-- The above exclusion doesn't actually matter unless I prevent Javadoc from autodiscovering the source in the sourcepath, which defaults to the source directory :\ Boo for -sourcepath. -->
162          <sourcepath>doesnotexist</sourcepath>
163          <!-- Note that we do need to build Javadoc for *some* class. Otherwise, we get an empty Javadoc jar, which the Sonatype repository manager rejects. To avoid that, we've introduced a dummy class. But we made it package-private so that no one can depend on it. That in turn forced us to configure Javadoc to show package-private APIs. -->
164          <show>package</show>
165        </configuration>
166      </plugin>
167      <!-- Disable "normal" testing, which doesn't work for GWT tests. -->
168      <plugin>
169        <artifactId>maven-surefire-plugin</artifactId>
170        <configuration>
171          <skip>true</skip>
172        </configuration>
173      </plugin>
174      <plugin>
175        <artifactId>maven-dependency-plugin</artifactId>
176        <executions>
177          <execution>
178            <id>unpack-failureaccess-sources</id>
179            <phase>generate-resources</phase>
180            <goals><goal>unpack-dependencies</goal></goals>
181            <configuration>
182              <includeArtifactIds>failureaccess</includeArtifactIds>
183              <classifier>sources</classifier>
184              <excludeTransitive>true</excludeTransitive>
185              <excludes>META-INF/MANIFEST.MF</excludes>
186              <outputDirectory>${project.build.directory}/failureaccess-sources</outputDirectory>
187              <type>java-source</type>
188              <silent>false</silent>
189            </configuration>
190          </execution>
191          <execution>
192            <id>unpack-guava-sources</id>
193            <phase>generate-resources</phase>
194            <goals><goal>unpack-dependencies</goal></goals>
195            <configuration>
196              <includeArtifactIds>guava</includeArtifactIds>
197              <classifier>sources</classifier>
198              <excludeTransitive>true</excludeTransitive>
199              <excludes>META-INF/MANIFEST.MF</excludes>
200              <outputDirectory>${project.build.directory}/guava-sources</outputDirectory>
201              <type>java-source</type>
202              <silent>false</silent>
203            </configuration>
204          </execution>
205          <execution>
206            <id>unpack-guava-testlib-sources</id>
207            <phase>generate-resources</phase>
208            <goals><goal>unpack-dependencies</goal></goals>
209            <configuration>
210              <includeArtifactIds>guava-testlib</includeArtifactIds>
211              <classifier>sources</classifier>
212              <excludeTransitive>true</excludeTransitive>
213              <excludes>META-INF/MANIFEST.MF</excludes>
214              <outputDirectory>${project.build.directory}/guava-test-sources</outputDirectory>
215              <type>java-source</type>
216              <silent>false</silent>
217            </configuration>
218          </execution>
219          <execution>
220            <id>unpack-guava-testlib-test-sources</id>
221            <phase>generate-resources</phase>
222            <goals><goal>unpack-dependencies</goal></goals>
223            <configuration>
224              <includeArtifactIds>guava-testlib</includeArtifactIds>
225              <classifier>test-sources</classifier>
226              <excludeTransitive>true</excludeTransitive>
227              <excludes>META-INF/MANIFEST.MF</excludes>
228              <outputDirectory>${project.build.directory}/guava-test-sources</outputDirectory>
229              <type>java-source</type>
230              <silent>false</silent>
231            </configuration>
232          </execution>
233          <execution>
234            <id>unpack-guava-test-sources</id>
235            <phase>generate-resources</phase>
236            <goals><goal>unpack-dependencies</goal></goals>
237            <configuration>
238              <includeArtifactIds>guava-tests</includeArtifactIds>
239              <classifier>test-sources</classifier>
240              <excludeTransitive>true</excludeTransitive>
241              <excludes>META-INF/MANIFEST.MF</excludes>
242              <outputDirectory>${project.build.directory}/guava-test-sources</outputDirectory>
243              <type>java-source</type>
244              <silent>false</silent>
245            </configuration>
246          </execution>
247        </executions>
248        <dependencies>
249          <dependency>
250            <groupId>com.google.guava</groupId>
251            <artifactId>failureaccess</artifactId>
252            <version>1.0.2</version>
253            <classifier>sources</classifier>
254          </dependency>
255          <dependency>
256            <groupId>com.google.guava</groupId>
257            <artifactId>guava</artifactId>
258            <version>${project.version}</version>
259            <classifier>sources</classifier>
260          </dependency>
261          <dependency>
262            <groupId>com.google.guava</groupId>
263            <artifactId>guava-testlib</artifactId>
264            <version>${project.version}</version>
265            <classifier>sources</classifier>
266          </dependency>
267          <dependency>
268            <groupId>com.google.guava</groupId>
269            <artifactId>guava-testlib</artifactId>
270            <version>${project.version}</version>
271            <classifier>test-sources</classifier>
272          </dependency>
273          <dependency>
274            <groupId>com.google.guava</groupId>
275            <artifactId>guava-tests</artifactId>
276            <version>${project.version}</version>
277            <classifier>test-sources</classifier>
278          </dependency>
279        </dependencies>
280      </plugin>
281      <plugin>
282        <artifactId>maven-antrun-plugin</artifactId>
283        <executions>
284          <execution>
285            <id>copy-gwt-files</id>
286            <phase>generate-resources</phase>
287            <goals><goal>run</goal></goals>
288            <configuration>
289              <target name="copy-gwt-resources">
290                <copy toDir="${project.build.directory}/guava-gwt-sources">
291                  <fileset dir="${project.build.directory}/guava-sources">
292                    <contains text="@GwtCompatible"/>
293                  </fileset>
294                </copy>
295                <!-- The following don't contain @GwtCompatible for dependency reasons. -->
296                <copy toDir="${project.build.directory}/guava-gwt-sources">
297                  <fileset dir="${project.build.directory}/guava-sources">
298                    <include name="**/ListenableFuture.java" />
299                  </fileset>
300                </copy>
301                <copy toDir="${project.build.directory}/guava-gwt-sources">
302                  <fileset dir="${project.build.directory}/failureaccess-sources">
303                    <include name="**/InternalFutures.java" />
304                  </fileset>
305                </copy>
306                <copy toDir="${project.build.directory}/guava-gwt-sources">
307                  <fileset dir="${project.build.directory}/failureaccess-sources">
308                    <include name="**/InternalFutureFailureAccess.java" />
309                  </fileset>
310                </copy>
311                <!-- Any manually written supersource should take priority over the original guava source, so we set overwrite=true. -->
312                <copy toDir="${project.build.directory}/guava-gwt-sources" overwrite="true">
313                  <fileset dir="src-super" />
314                </copy>
315                <copy toDir="${project.build.directory}/guava-test-gwt-sources">
316                  <fileset dir="${project.build.directory}/guava-test-sources">
317                    <contains text="@GwtCompatible"/>
318                  </fileset>
319                </copy>
320                <!-- TODO(cpovirk): If we continue stripping these once we use @ElementTypesAreNonnullByDefault, then we should strip @ElementTypesAreNonnullByDefault, too, to reflect that the classes are *not* fully annotated. But hopefully we can stop stripping them, as https://github.com/jspecify/jspecify/issues/184 should make possible. -->
321                <replace token="@Nullable" value="">
322                  <fileset dir="${project.build.directory}">
323                    <include name="guava-gwt-sources/**/*.java"/>
324                    <include name="guava-test-gwt-sources/**/*.java"/>
325                  </fileset>
326                </replace>
327                <replace token="@NonNull" value="">
328                  <fileset dir="${project.build.directory}">
329                    <include name="guava-gwt-sources/**/*.java"/>
330                    <include name="guava-test-gwt-sources/**/*.java"/>
331                  </fileset>
332                </replace>
333              </target>
334            </configuration>
335          </execution>
336        </executions>
337      </plugin>
338      <plugin>
339        <groupId>org.codehaus.mojo</groupId>
340        <artifactId>gwt-maven-plugin</artifactId>
341        <version>${gwt.plugin.version}</version>
342        <executions>
343          <execution>
344            <id>gwt-compile</id>
345            <goals>
346              <goal>compile</goal>
347            </goals>
348            <configuration>
349              <module>com.google.common.ForceGuavaCompilation</module>
350              <failOnError>true</failOnError>
351              <logLevel>${gwt.logLevel}</logLevel>
352              <generateJsInteropExports>true</generateJsInteropExports>
353              <validateOnly>true</validateOnly>
354              <sourceLevel>1.8</sourceLevel>
355              <!--
356                To avoid "java.io.IOException: User limit of inotify watches reached" under JDK10.
357                Presumably we don't need inotify, since we don't intend to change files during the
358                build?
359                -->
360              <extraJvmArgs>-Dgwt.watchFileChanges=false</extraJvmArgs>
361            </configuration>
362          </execution>
363          <!--
364            GWT issues some scary warnings while running tests, but I believe they are harmless.
365            Let's take the warnings for one module, c.g.c.base.testModule, as an example:
366
367              [INFO] Validating units:
368              [INFO]    Ignored 53 units with compilation errors in first pass.
369              [INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
370
371            Turning up the log level, we see that GWT is trying to compile classes from other
372            packages, like RangeTest. The reason for this is that GWT doesn't distinguish between
373            .java files in c.g.c.collect.Collect, a module that the c.g.c.base test module inherits,
374            and .java files in c.g.c.collect.testModule, one that it doesn't[*]. Consequently,
375            c.g.c.base.testModule transitively pulls in .java files from both modules while reading
376            the module description of only the prod module. And the prod module doesn't inherit all
377            the modules that the test module classes use, so we get errors.
378
379            The good news is that, despite ignoring errors here, GWT does fail if any errors affect
380            classes that are actually used in the module under test.
381
382            One way to eliminate the warnings is to make base.testModule include the not really
383            necessary <inherits> lines for c.g.c.collect.testModule, etc. However, adding <inherits>
384            lines could make c.g.c.base.testModule transitively inherit from extra modules. If some
385            of those modules are ones that it uses but forgets to list in its own <inherits>, we'd
386            like to get an error. Currently we do, but if we add the extra <inherits> lines, we
387            won't.
388
389            I have one idea for a better approach, but it's painful, and I haven't tested it: We
390            could postprocess Collect.gwt.xml to add <skip> lines for all the files that should be
391            covered by testModule.gwt.xml. Maybe I'll try it someday.
392
393            [*] https://code.google.com/p/google-web-toolkit/wiki/ResourceOracle#When_multiple_PathPrefix_es_have_the_same_path
394                https://code.google.com/p/google-web-toolkit/issues/detail?id=7581
395            -->
396          <execution>
397            <id>gwt-test</id>
398            <goals>
399              <goal>test</goal>
400            </goals>
401            <configuration>
402              <module>com.google.common.GuavaTests</module>
403              <includes>**/GwtTestSuite.java</includes>
404              <logLevel>${gwt.logLevel}</logLevel>
405              <mode>htmlunit</mode>
406              <htmlunit>FF38</htmlunit>
407              <productionMode>true</productionMode>
408              <!-- Fix OutOfMemoryError under Travis. -->
409              <extraJvmArgs>-Xms3500m -Xmx3500m -Xss1024k</extraJvmArgs>
410              <sourceLevel>1.8</sourceLevel>
411              <!-- Keep these timeouts very large because, if we hit the timeout, the tests silently pass :( -->
412              <testTimeOut>86400 <!-- seconds --></testTimeOut>
413              <testMethodTimeout>1440 <!-- minutes --></testMethodTimeout>
414              <!-- Presumably we want watchFileChanges=false here, since we want it for compile: -->
415              <extraJvmArgs>-Dgwt.watchFileChanges=false</extraJvmArgs>
416            </configuration>
417          </execution>
418        </executions>
419      </plugin>
420    </plugins>
421    <resources>
422      <resource>
423        <directory>src</directory>
424      </resource>
425      <!-- src-super is copied to guava-gwt-sources (so that we can strip its @Nullable annotations), so we don't need to list it here. We may want to arrange something similar for test-super someday. -->
426      <!-- TODO(cpovirk): Why do we have separate src and src-super directories, anyway? -->
427      <resource>
428        <directory>${project.build.directory}/guava-gwt-sources</directory>
429      </resource>
430    </resources>
431    <testResources>
432      <testResource>
433        <directory>test</directory>
434      </testResource>
435      <testResource>
436        <directory>test-super</directory>
437      </testResource>
438      <testResource>
439        <directory>${project.build.directory}/guava-test-gwt-sources</directory>
440      </testResource>
441    </testResources>
442  </build>
443</project>
444