# Guava multi-module build container
# Builds Guava from source using Maven with a Java 25 toolchain
FROM maven:3.9.14-sapmachine-25
# Build in /workspace/guava
WORKDIR /workspace/guava
# Copy the entire repository into the image
COPY . .
# Provide a toolchains.xml so Maven toolchains plugin can find a JDK 25 toolchain
# This helps when the base image provides SAPMachine 25 but tooling needs explicit config.
RUN mkdir -p /root/.m2 && cat > /root/.m2/toolchains.xml << 'XML'
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>25</version>
<vendor>SAP</vendor>
</provides>
<configuration>
<jdkHome>/usr/lib/jvm/sapmachine-25</jdkHome>
</configuration>
</toolchain>
</toolchains>
XML
# First pass: install all modules (skipping tests to speed up)
RUN mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true
# Second pass: verify the build (also skips tests)
# This covers the Android flavor and other modules as configured by the root pom.xml
RUN mvn -B -ntp -P!standard-with-extra-repos -Dtoolchain.skip verify -U -DskipTests=true
# The image now contains built artifacts under the repository's target/ directories.
# A simple shell is provided as the default command for convenience.
CMD ["bash"]