Skip to content

Commit

Permalink
Rely more on Maven in updaterelease.sh:
Browse files Browse the repository at this point in the history
- Use Maven Wrapper. This builds on cl/573917287.
- Derive the location of Java 11 from the Maven build instead of requiring `JAVA_HOME` to be set. This might let us choose to stop requiring `JAVA_HOME`. See cl/639128020 and related CLs.
  • Loading branch information
cpovirk committed Jan 2, 2025
1 parent 2161d0f commit fc7f3dd
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions updaterelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ remove_unnecessary_comments() {
# Generates Javadoc for the given flavor of Guava.
generate_javadoc() {
local flavor="$1"
local mvnw="$PWD/mvnw"

# Change to android directory if necessary.
if [[ "$flavor" == android ]]; then
Expand All @@ -117,7 +118,7 @@ generate_javadoc() {
# Compile and generate Javadoc.
# Save the build classpath to a file in the tempdir.
echo -n "Compiling and generating Javadoc for Guava $version..."
mvn \
"${mvnw}" \
clean \
compile \
javadoc:javadoc \
Expand Down Expand Up @@ -153,7 +154,7 @@ generate_jdiff_xml() {

# Generate JDiff XML file for the release.
echo -n "Generating JDiff XML for Guava $version..."
${JAVA_HOME}/bin/javadoc \
${JAVA_11_HOME}/bin/javadoc \
-sourcepath "$TEMPDIR/$flavor/src" \
-classpath "$classpath" \
-subpackages com.google.common \
Expand Down Expand Up @@ -202,7 +203,7 @@ jdiff() {
local prev_release_javadoc_path="../../../../$other/api/docs/"

echo -n "Generating JDiff report between Guava $other_version and $version..."
${JAVA_HOME}/bin/javadoc \
${JAVA_11_HOME}/bin/javadoc \
-subpackages com \
-doclet jdiff.JDiff \
-docletpath "$JDIFF_PATH" \
Expand Down Expand Up @@ -388,14 +389,6 @@ generate_snapshot_javadoc_shortlinks() {

# Main function actually run the process.
main() {
if [[ -z "${JAVA_HOME:-}" ]]; then
echo '$JAVA_HOME needs to be set' >&2
exit 1
elif [[ ! -x "${JAVA_HOME}/bin/javadoc" ]]; then
echo '$JAVA_HOME must be set to a valid JDK location but is '"${JAVA_HOME}" >&2
exit 1
fi

# Make sure we have all the latest tags
git fetch --tags

Expand All @@ -416,6 +409,11 @@ main() {
# classes/
# docs/
git_checkout_ref "$RELEASE_REF"

# We run this separately so that its change to the default toolchain doesn't affect anything else.
./mvnw --projects '!guava-testlib,!guava-tests,!guava-bom,!guava-gwt' initialize -P print-java-11-home
export JAVA_11_HOME=$(<target/java_11_home)

for flavor in "${FLAVORS[@]}"; do
generate_javadoc "$flavor"
done
Expand Down

0 comments on commit fc7f3dd

Please sign in to comment.