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