Add support for using pre-downloaded junit dependencies

This commit is contained in:
Russell Sears 2023-02-09 23:28:24 +00:00 committed by Aaron Molitor
parent f58d58ca77
commit d02118db67
1 changed files with 47 additions and 42 deletions

View File

@ -295,39 +295,44 @@ if(NOT OPEN_FOR_IDE)
message(WARNING "Cannot run java tests with sanitizer builds")
return()
endif()
if(EXISTS /opt/junit_dependencies)
set(JUNIT_JARS /opt/junit_dependencies)
else()
set(JUNIT_JARS "${CMAKE_BINARY_DIR}/packages")
# We use Junit libraries for both JUnit and integration testing structures, so download in either case
# https://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-engine/5.7.1/junit-jupiter-engine-5.7.1.jar
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-engine/5.7.1/junit-jupiter-engine-5.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-jupiter-engine-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-engine-5.7.1.jar
EXPECTED_HASH SHA256=56616c9350b3624f76cffef6b24ce7bb222915bfd5688f96d3cf4cef34f077cb)
# https://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-api/5.7.1/junit-jupiter-api-5.7.1.jar
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-api/5.7.1/junit-jupiter-api-5.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-jupiter-api-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-api-5.7.1.jar
EXPECTED_HASH SHA256=ce7b985bc469e2625759a4ebc45533c70581a05a348278c1d6408e9b2e35e314)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-params/5.7.1/junit-jupiter-params-5.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-jupiter-params-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-params-5.7.1.jar
EXPECTED_HASH SHA256=8effdd7f8a4ba5558b568184dee08008b2443c86c673ef81de5861fbc7ef0613)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-commons/1.7.1/junit-platform-commons-1.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-platform-commons-1.7.1.jar
${JUNIT_JARS}/junit-platform-commons-1.7.1.jar
EXPECTED_HASH SHA256=7c546be86864718fbaceb79fa84ff1d3a516500fc428f1b21d061c2e0fbc5a4b)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-engine/1.7.1/junit-platform-engine-1.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-platform-engine-1.7.1.jar
${JUNIT_JARS}/junit-platform-engine-1.7.1.jar
EXPECTED_HASH SHA256=37df5a9cd6dbc1f754ba2b46f96b8874a83660e1796bf38c738f022dcf86c23f)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-launcher/1.7.1/junit-platform-launcher-1.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-platform-launcher-1.7.1.jar
${JUNIT_JARS}/junit-platform-launcher-1.7.1.jar
EXPECTED_HASH SHA256=3122ac6fb284bc50e3afe46419fc977f94d580e9d3d1ea58805d200b510a99ee)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-console/1.7.1/junit-platform-console-1.7.1.jar"
${CMAKE_BINARY_DIR}/packages/junit-platform-console-1.7.1.jar
${JUNIT_JARS}/junit-platform-console-1.7.1.jar
EXPECTED_HASH SHA256=11ed48fcdfcea32f2fa98872db7ecba2d49d178f76493e7a149a2242363ad12e)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/apiguardian/apiguardian-api/1.1.1/apiguardian-api-1.1.1.jar"
${CMAKE_BINARY_DIR}/packages/apiguardian-api-1.1.1.jar
${JUNIT_JARS}/apiguardian-api-1.1.1.jar
EXPECTED_HASH SHA256=fc68f0d28633caccf3980fdf1e99628fba9c49424ee56dc685cd8b4d2a9fefde)
file(DOWNLOAD "https://search.maven.org/remotecontent?filepath=org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar"
${CMAKE_BINARY_DIR}/packages/opentest4j-1.2.0.jar)
${JUNIT_JARS}/opentest4j-1.2.0.jar)
endif()
set(JUNIT_CLASSPATH "${CMAKE_BINARY_DIR}/packages/junit-jupiter-api-5.7.1.jar:${CMAKE_BINARY_DIR}/packages/junit-jupiter-engine-5.7.1.jar:${CMAKE_BINARY_DIR}/packages/junit-jupiter-params-5.7.1.jar:${CMAKE_BINARY_DIR}/packages/opentest4j-1.2.0.jar:${CMAKE_BINARY_DIR}/packages/apiguardian-api-1.1.1.jar")
set(JUNIT_CLASSPATH "${JUNIT_CLASSPATH}:${CMAKE_BINARY_DIR}/packages/junit-platform-console-1.7.1.jar:${CMAKE_BINARY_DIR}/packages/junit-platform-commons-1.7.1.jar")
set(JUNIT_CLASSPATH "${JUNIT_CLASSPATH}:${CMAKE_BINARY_DIR}/packages/junit-platform-engine-1.7.1.jar:${CMAKE_BINARY_DIR}/packages/junit-platform-launcher-1.7.1.jar")
set(JUNIT_CLASSPATH "${JUNIT_JARS}/junit-jupiter-api-5.7.1.jar:${JUNIT_JARS}/junit-jupiter-engine-5.7.1.jar:${JUNIT_JARS}/junit-jupiter-params-5.7.1.jar:${JUNIT_JARS}/opentest4j-1.2.0.jar:${JUNIT_JARS}/apiguardian-api-1.1.1.jar")
set(JUNIT_CLASSPATH "${JUNIT_CLASSPATH}:${JUNIT_JARS}/junit-platform-console-1.7.1.jar:${JUNIT_JARS}/junit-platform-commons-1.7.1.jar")
set(JUNIT_CLASSPATH "${JUNIT_CLASSPATH}:${JUNIT_JARS}/junit-platform-engine-1.7.1.jar:${JUNIT_JARS}/junit-platform-launcher-1.7.1.jar")
endif()
if(RUN_JUNIT_TESTS)
@ -351,11 +356,11 @@ if(NOT OPEN_FOR_IDE)
# can be found at https://cmake.org/cmake/help/v3.19/manual/ctest.1.html)
add_jar(fdb-junit SOURCES ${JAVA_JUNIT_TESTS} ${JUNIT_RESOURCES} INCLUDE_JARS fdb-java
${CMAKE_BINARY_DIR}/packages/junit-jupiter-api-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/junit-jupiter-engine-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/junit-jupiter-params-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/opentest4j-1.2.0.jar
${CMAKE_BINARY_DIR}/packages/apiguardian-api-1.1.1.jar
${JUNIT_JARS}/junit-jupiter-api-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-engine-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-params-5.7.1.jar
${JUNIT_JARS}/opentest4j-1.2.0.jar
${JUNIT_JARS}/apiguardian-api-1.1.1.jar
)
get_property(junit_jar_path TARGET fdb-junit PROPERTY JAR_FILE)
@ -394,11 +399,11 @@ if(NOT OPEN_FOR_IDE)
# the directory layer with a unique path, etc.)
#
add_jar(fdb-integration SOURCES ${JAVA_INTEGRATION_TESTS} ${JAVA_INTEGRATION_RESOURCES} INCLUDE_JARS fdb-java
${CMAKE_BINARY_DIR}/packages/junit-jupiter-api-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/junit-jupiter-engine-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/junit-jupiter-params-5.7.1.jar
${CMAKE_BINARY_DIR}/packages/opentest4j-1.2.0.jar
${CMAKE_BINARY_DIR}/packages/apiguardian-api-1.1.1.jar)
${JUNIT_JARS}/junit-jupiter-api-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-engine-5.7.1.jar
${JUNIT_JARS}/junit-jupiter-params-5.7.1.jar
${JUNIT_JARS}/opentest4j-1.2.0.jar
${JUNIT_JARS}/apiguardian-api-1.1.1.jar)
get_property(integration_jar_path TARGET fdb-integration PROPERTY JAR_FILE)
# add_fdbclient_test will set FDB_CLUSTER_FILE if it's not set already