Skip to content

Commit aff93bf

Browse files
authored
Feat: java record serialization/deserialization (#1842)
1 parent 310d680 commit aff93bf

File tree

21 files changed

+3478
-1280
lines changed

21 files changed

+3478
-1280
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- run: .kokoro/build.sh
3737
env:
3838
JOB_TYPE: test
39+
JAVA_VERSION: ${{matrix.java}}
3940
windows:
4041
runs-on: windows-latest
4142
steps:

.kokoro/build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ set +e
4848
case ${JOB_TYPE} in
4949
test)
5050
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
51-
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT}
51+
if [[ "${JAVA_VERSION}" == "17" ]]; then
52+
# Activate the runTestsWithJava17 profile inside google-cloud-firestore
53+
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT} -DrunTestsWithJava17=true
54+
else
55+
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT}
56+
fi
5257
RETURN_CODE=$?
5358
;;
5459
lint)

google-cloud-firestore/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,5 +321,54 @@
321321
</dependency>
322322
</dependencies>
323323
</profile>
324+
<profile>
325+
<!-- JDK17 set up for tests in src/test-jdk17 -->
326+
<id>java17-test</id>
327+
<activation>
328+
<!-- Activate the tests only on CI unit(17) tests using flag -->
329+
<property>
330+
<name>runTestsWithJava17</name>
331+
<value>true</value>
332+
</property>
333+
<activeByDefault>false</activeByDefault>
334+
</activation>
335+
<build>
336+
<plugins>
337+
<plugin>
338+
<groupId>org.codehaus.mojo</groupId>
339+
<artifactId>build-helper-maven-plugin</artifactId>
340+
<executions>
341+
<execution>
342+
<id>add-test-source</id>
343+
<phase>generate-test-sources</phase>
344+
<goals>
345+
<goal>add-test-source</goal>
346+
</goals>
347+
<configuration>
348+
<sources>
349+
<source>src/test-jdk17/java</source>
350+
</sources>
351+
</configuration>
352+
</execution>
353+
</executions>
354+
</plugin>
355+
<plugin>
356+
<groupId>org.apache.maven.plugins</groupId>
357+
<artifactId>maven-compiler-plugin</artifactId>
358+
<inherited>true</inherited>
359+
<configuration>
360+
<!-- Enable Java 17 for all sources so that Intellij picks the right language level -->
361+
<source>17</source>
362+
<release>17</release>
363+
<compilerArgs>
364+
<arg>-parameters</arg>
365+
<arg>--add-opens=java.base/java.lang=ALL-UNNAMED</arg>
366+
<arg>--add-opens=java.base/java.util=ALL-UNNAMED</arg>
367+
</compilerArgs>
368+
</configuration>
369+
</plugin>
370+
</plugins>
371+
</build>
372+
</profile>
324373
</profiles>
325374
</project>

google-cloud-firestore/src/main/java/com/google/cloud/firestore/CollectionReference.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.api.gax.rpc.ApiException;
2323
import com.google.api.gax.rpc.ApiExceptions;
2424
import com.google.api.gax.rpc.UnaryCallable;
25+
import com.google.cloud.firestore.encoding.CustomClassMapper;
2526
import com.google.cloud.firestore.spi.v1.FirestoreRpc;
2627
import com.google.cloud.firestore.telemetry.TraceUtil;
2728
import com.google.cloud.firestore.telemetry.TraceUtil.Scope;

0 commit comments

Comments
 (0)