Skip to content

Commit

Permalink
Add of packages dependencies checking during packaging process
Browse files Browse the repository at this point in the history
* Added checking of RUnit and roxygen2 packages

(closes OpenFLUID/openfluid#791)
  • Loading branch information
fabrejc committed Sep 10, 2018
1 parent 578f211 commit 7dd1eaa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
17 changes: 15 additions & 2 deletions cmake/preprocess.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@


FILE(MAKE_DIRECTORY ${BUILDDIR})
FILE(REMOVE_RECURSE ${PACKAGEBUILDDIR})
FILE(MAKE_DIRECTORY ${PACKAGEBUILDDIR})
FILE(MAKE_DIRECTORY ${BUILDLIBRDIR})


FOREACH(PACK ${REQUIRED_R_PACKAGES})
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}"
"-E" "chdir" "${PACKAGEBUILDDIR}"
"Rscript" "--vanilla" "${RESOURCESDIR}/checkPackage.R" "${PACK}"
RESULT_VARIABLE CHECK_STATUS)
IF(NOT ${CHECK_STATUS})
MESSAGE(FATAL_ERROR "R package ${PACK} is not installed")
ELSE()
MESSAGE(STATUS "Found required R package : ${PACK}")
ENDIF()
ENDFOREACH()



FILE(COPY "${PACKAGESRCDIR}/"
DESTINATION "${PACKAGEBUILDDIR}"
PATTERN ".*" EXCLUDE
Expand Down
8 changes: 7 additions & 1 deletion config.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ ENDIF()
SET(PACKAGEBUILDDIR "${BUILDDIR}/ROpenFLUID")
SET(BUILDLIBRDIR "${BUILDDIR}/_Rlibrary")

# Required R packages
SET(REQUIRED_R_PACKAGES "RUnit" "roxygen2")
IF(WIN32)
SET(REQUIRED_R_PACKAGES "RUnit")
ENDIF()

# Title and description
SET(OpenFLUID_R_TITLE "R Interface to OpenFLUID Platform Framework for Modelling and Simulation of Landscapes")
SET(OpenFLUID_R_DESC "Provides a collection of functions to load, parameterize, run and analyze OpenFLUID simulations within the GNU R environment.")

# ROpenFLUID Version
SET(OpenFLUID_R_VERSION_PATCH "20180726")
SET(OpenFLUID_R_VERSION_PATCH "20180910")

# Required OpenFLUID version
SET(REQUIRED_OPENFLUID_VERSION "2.1.6")
Expand Down
8 changes: 8 additions & 0 deletions resources/checkPackage.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
args <- commandArgs(TRUE)

if (as.character(args) %in% rownames(installed.packages()))
{
quit(status=1)
}

quit(status=0)

0 comments on commit 7dd1eaa

Please sign in to comment.