Skip to content

Commit

Permalink
Ensure that we generate a non-empty Javadoc jar for guava-gwt.
Browse files Browse the repository at this point in the history
Without it, we get an error during Sonatype deployment:
  Missing: no javadoc jar found in folder '/com/google/guava/guava-gwt/28.2-jre'

I hacked around this on the GitHub release branch for 28.2 by reenabling Javadoc:
a1b3c06

But as you may recall from CL 276327335, we're soon going to have no classes to generate Javadoc for (after we remove GWT-RPC support). So even with Javadoc generation enabled, we'd end up with no jar.

To ensure that we get a jar, I've introduced a package-private dummy class (and then excluded it from the other steps in which source files are used).

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=288314285
  • Loading branch information
cpovirk authored and netdpb committed Jan 7, 2020
1 parent 8f0c0a2 commit 1f5dff3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
15 changes: 11 additions & 4 deletions guava-gwt/pom.xml
Expand Up @@ -116,9 +116,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<!-- Yes, we want to exclude this 3 times: -->
<!-- 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>
Expand All @@ -128,6 +130,7 @@
<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>
Expand All @@ -137,15 +140,19 @@
<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>
<!-- No meaningful public classes, just sources for the GWT compiler, some internal serialization classes, and dummy entry-point class to force compilation. -->
<!-- And soon, the serialization classes will be going away, and the entry point won't compile after we move gwt-user to test scope. -->
<skip>true</skip>
<sourceFileExcludes>
<!-- 4. Don't build Javadoc for it (since that, too, would require a *non-test* dep on gwt-user. -->
<sourceFileExclude>**/ForceGuavaCompilation*</sourceFileExclude>
</sourceFileExcludes>
<!-- After removing GWT-RPC support, we will have no real classes to build Javadoc for. This would result in an empty Javadoc jar, which the Sonatype repository manager would reject. 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. -->
Expand Down
25 changes: 25 additions & 0 deletions guava-gwt/src/com/google/common/DummyJavadocClass.java
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2019 The Guava Authors
*
* 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.common;

/**
* A dummy class so that the Maven Javadoc plugin will produce a jar. If it doesn't produce a jar,
* then the Sonatype repository manager issues an error.
*
* @author Chris Povirk
*/
class DummyJavadocClass {}

0 comments on commit 1f5dff3

Please sign in to comment.