Commit 350ee518 authored by jml's avatar jml
Browse files

add a make

parent 4430273b
alapu_url <- function(...){
try(url_server <- getOption(x="alapu_server")[1])
if (inherits(url_server,"try-error")){
stop("alapu_server not defined, use config_server")
}
param <- c(as.list(environment()), list(...))
indice <- which(unlist(lapply(param,is.null)))
if (length(indice)) {
param <- param[-indice]
}
}
res <- do.call("file.path",param)
return(res)
}
# Determine package name and version from DESCRIPTION file
PKG_VERSION=$(shell grep -i ^version DESCRIPTION | cut -d : -d \ -f 2)
PKG_NAME=$(shell grep -i ^package DESCRIPTION | cut -d : -d \ -f 2)
# Name of built package
PKG_TAR=$(PKG_NAME)_$(PKG_VERSION).tar.gz
# Install package
install:
cd .. && R CMD INSTALL $(PKG_NAME)
# Build documentation with roxygen
# 1) Remove old doc
# 2) Generate documentation
roxygen:
rm -f man/*.Rd
Rscript -e "library(methods)" \
-e "library(devtools)" \
-e "devtools::document()"
# Generate PDF output from the Rd sources
# 1) Rebuild documentation with roxygen
# 2) Generate pdf, overwrites output file if it exists
pdf: roxygen
cd .. && R CMD Rd2pdf --force $(PKG_NAME)
# Build and check package
check:
cd .. && R CMD build --no-build-vignettes $(PKG_NAME)
cd .. && _R_CHECK_CRAN_INCOMING_=FALSE NOT_CRAN=true \
R CMD check --as-cran --no-manual --no-vignettes \
--no-build-vignettes --no-stop-on-test-error $(PKG_TAR)
# Check reverse dependencies
#
# 1) Install packages (in ./revdep/lib) to check reverse dependencies.
# 2) Check reverse dependencies using 'R CMD check'.
# 3) Collect results from '00check.log' files.
revdep: revdep_install revdep_check revdep_results
# Install packages to check reverse dependencies
revdep_install: clean
mkdir -p revdep/lib
cd .. && R CMD INSTALL --library=$(PKG_NAME)/revdep/lib $(PKG_NAME)
R_LIBS_USER=./revdep/lib Rscript --vanilla \
-e "options(repos = c(CRAN='https://cran.r-project.org'))" \
-e "pkg <- tools::package_dependencies('$(PKG_NAME)', which = 'all', reverse = TRUE)" \
-e "pkg <- as.character(unlist(pkg))" \
-e "dep <- sapply(pkg, tools::package_dependencies, which = 'all')" \
-e "dep <- as.character(unlist(dep))" \
-e "if ('BiocInstaller' %in% dep) {" \
-e " source('https://bioconductor.org/biocLite.R')" \
-e " biocLite('BiocInstaller')" \
-e "}" \
-e "install.packages(pkg, dependencies = TRUE)" \
-e "download.packages(pkg, destdir = 'revdep')"
# Check reverse dependencies with 'R CMD check'
revdep_check:
$(foreach var,$(wildcard revdep/*.tar.gz),R_LIBS_USER=./revdep/lib \
_R_CHECK_CRAN_INCOMING_=FALSE R --vanilla CMD check --as-cran \
--no-stop-on-test-error --output=revdep $(var) \
| tee --append revdep/00revdep.log;)
# Collect results from checking reverse dependencies
revdep_results:
Rscript --vanilla \
-e "options(repos = c(CRAN='https://cran.r-project.org'))" \
-e "pkg <- tools::package_dependencies('$(PKG_NAME)', which = 'all', reverse = TRUE)" \
-e "pkg <- as.character(unlist(pkg))" \
-e "results <- do.call('rbind', lapply(pkg, function(x) {" \
-e " filename <- paste0('revdep/', x, '.Rcheck/00check.log')" \
-e " if (file.exists(filename)) {" \
-e " lines <- readLines(filename)" \
-e " status <- sub('^Status: ', '', lines[grep('^Status: ', lines)])" \
-e " } else {" \
-e " status <- 'missing'" \
-e " }" \
-e " data.frame(Package = x, Status = status)" \
-e "}))" \
-e "results <- results[order(results[, 'Status']), ]" \
-e "rownames(results) <- NULL" \
-e "cat('\n\n*** Results ***\n\n')" \
-e "results" \
-e "cat('\n\n')"
# Build and check package with gctorture
check_gctorture:
cd .. && R CMD build --no-build-vignettes $(PKG_NAME)
cd .. && R CMD check --no-manual --no-vignettes --no-build-vignettes --use-gct $(PKG_TAR)
# Build and check package with valgrind
check_valgrind:
cd .. && R CMD build --no-build-vignettes $(PKG_NAME)
cd .. && R CMD check --as-cran --no-manual --no-vignettes --no-build-vignettes --use-valgrind $(PKG_TAR)
# Run all tests with valgrind
test_objects = $(wildcard tests/*.R)
valgrind:
$(foreach var,$(test_objects),R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < $(var);)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment