[Unit tests] Fix path of Java bindings (#6616)
authorAndres Noetzli <andres.noetzli@gmail.com>
Tue, 25 May 2021 03:21:16 +0000 (20:21 -0700)
committerGitHub <noreply@github.com>
Tue, 25 May 2021 03:21:16 +0000 (03:21 +0000)
Currently, when configuring cvc5 with Java bindings, CMake complains
about `get_filename_component(CVC5_JNI_PATH ${CVC5_JAR_PATH} DIRECTORY)`
not using the correct number of arguments in the Java unit tests. The
issue is that `${CVC5_JAR_PATH}` is empty. The value of
`${CVC5_JAR_PATH}` was computed in the Java API bindings but then not
shared with the rest of the build system. Because `${CVC5_JAR_PATH}` is
not used anywhere else, this commit moves the computation of
`${CVC5_JAR_PATH}` to the unit tests. The commit also ensures that the
API subdirectories are processed before the test subdirectories.

CMakeLists.txt
src/api/java/CMakeLists.txt
test/unit/api/java/CMakeLists.txt

index 1c6ad160414c1f608b502ab0bf8afbac20a10c1f..d7512e8748a02d823505eec930006359a53645bd 100644 (file)
@@ -503,7 +503,6 @@ endif()
 # Add subdirectories
 
 add_subdirectory(src)
-add_subdirectory(test)
 
 if(BUILD_BINDINGS_PYTHON)
   set(BUILD_BINDINGS_PYTHON_VERSION ${PYTHON_VERSION_MAJOR})
@@ -519,6 +518,8 @@ if(BUILD_DOCS)
   add_subdirectory(docs)
 endif()
 
+add_subdirectory(test)
+
 #-----------------------------------------------------------------------------#
 # Package configuration
 #
index d56f594ce00ed48c327dd18ed5a84b0c1f1777a4..53ea46f46a93753abfd61c01b463dac6578747d4 100644 (file)
@@ -112,5 +112,3 @@ add_jar(cvc5jar
 )
 
 add_dependencies(cvc5jar generate-java-kinds cvc5jni cvc5)
-
-get_target_property(CVC5_JAR_PATH cvc5jar JAR_FILE)
\ No newline at end of file
index 0ef649b878363129c92de3472f0eb54d4fd837dd..fe497ef3bbba6d6734bdeb556ab24a3016fb95a9 100644 (file)
@@ -17,6 +17,8 @@ find_package(Java REQUIRED)
 include(UseJava)
 find_package(JUnit REQUIRED)
 
+get_target_property(CVC5_JAR_PATH cvc5jar JAR_FILE)
+
 # specify source files for junit tests
 set(java_test_src_files
   ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/SolverTest.java