-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (65 loc) · 3.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
R?=R
PACKAGE=otoclass
VERSION = $(shell Rscript -e "l<-readLines(\"${PACKAGE}/DESCRIPTION\");cat(gsub(\"Version: \",\"\",l[grepl(\"Version: \",l)]))")
TARBALL := ${PACKAGE}_${VERSION}.tar.gz
RFILES := $(wildcard ${PACKAGE}/R/*.R)
CPPFILES := $(wildcard ${PACKAGE}/src/*.cpp)
NAMESPACEFILE := ${PACKAGE}/NAMESPACE
RCHECK := ${PACKAGE}.Rcheck
$(NAMESPACEFILE): $(RFILES)
@echo "\033[0;32mUpdating documentation\033[0;0m"
rm -f ${PACKAGE}/src/*.so
$(R) -q -e 'roxygen2::roxygenise("${PACKAGE}", roclets = c("collate", "namespace", "rd"))'
@touch $@
$(TARBALL): $(NAMESPACEFILE) $(CPPFILES)
@echo "\033[0;32mBuilding package\033[0;0m"
$(R) CMD build ${PACKAGE}
build: $(TARBALL)
$(RCHECK): $(TARBALL)
@echo "\033[0;32mChecking package as cran\033[0;0m"
$(R) CMD check --as-cran $(TARBALL)
check: $(RCHECK)
checkbc: $(TARBALL)
@echo "\033[0;32mChecking package with bioconductor\033[0;0m"
$(R) CMD BiocCheck --no-check-bioc-views $(TARBALL)
install: $(TARBALL)
@echo "\033[0;32mInstalling package\033[0;0m"
$(R) CMD INSTALL $(TARBALL)
install_dependencies:
@echo "\033[0;32mInstalling package dependencies\033[0;0m"
@echo "source('https://raw.githubusercontent.com/calbertsen/caMisc/master/caMisc/R/build_from_github.R'); \
installDependencies('${PACKAGE}/DESCRIPTION',dependencies=c(\"Depends\",\"LinkingTo\",\"Imports\",\"Suggests\",\"Enhances\"))" | $(R) -q --slave
install_bc:
@echo "\033[0;32mInstalling BiocCheck\033[0;0m"
$(R) -q -e 'if (!"BiocManager" %in% rownames(installed.packages())) install.packages("BiocManager"); BiocManager::install("BiocCheck")'
test: $(TARBALL)
@echo "\033[0;32mRunning all tests\033[0;0m"
@RUN_ALL_TESTS=true RUNTEST_PKG='../../${TARBALL}' $(R) -q --slave -e 'lf<-list.files("${PACKAGE}/tests","\\.R$$",full.names=TRUE); for(f in lf) source(f, chdir = TRUE, print.eval = TRUE )'
test_system: $(TARBALL)
@echo "\033[0;32mRunning all system tests\033[0;0m"
@RUN_ALL_TESTS=true RUNTEST_PKG='../${TARBALL}' $(R) -q --slave -e 'lf<-list.files("system_tests","\\.R$$",full.names=TRUE); for(f in lf) source(f, chdir = TRUE, print.eval = TRUE )'
test_installed:
@echo "\033[0;32mRunning all tests\033[0;0m"
@RUN_ALL_TESTS=true RUNTEST_PKG=${PACKAGE} $(R) -q --slave -e 'lf<-list.files("${PACKAGE}/tests","\\.R$$",full.names=TRUE); for(f in lf) source(f, chdir = TRUE, print.eval = TRUE )'
testquick: $(TARBALL)
@echo "\033[0;32mRunning almost all tests\033[0;0m"
@RUN_ALL_TESTS=false RUNTEST_PKG=../../$(TARBALL) $(R) -q --slave -e 'lf<-list.files("${PACKAGE}/tests","\\.R$$",full.names=TRUE); for(f in lf) source(f, chdir = TRUE, print.eval = TRUE )'
testquick_installed:
@echo "\033[0;32mRunning almost all tests\033[0;0m"
@RUN_ALL_TESTS=false RUNTEST_PKG=argosTrack $(R) -q --slave -e 'lf<-list.files("${PACKAGE}/tests","\\.R$$",full.names=TRUE); for(f in lf) source(f, chdir = TRUE, print.eval = TRUE )'
COVRALL := ${PACKAGE}-report.html
$(COVRALL): $(RFILES)
@echo "\033[0;32mChecking code coverage for all tests\033[0;0m"
@RUN_ALL_TESTS=true $(R) --slave -e 'aa<-covr::package_coverage("${PACKAGE}"); covr::report(aa,file="${PACKAGE}-report.html",browse = FALSE); aa'
coverage: $(COVRALL)
COVRQUICK := ${PACKAGE}-report-quick.html
$(COVRQUICK): $(RFILES)
@echo "\033[0;32mChecking code coverage for quick tests\033[0;0m"
@RUN_ALL_TESTS=false $(R) --slave -e 'aa<-covr::package_coverage("${PACKAGE}"); covr::report(aa,file="${PACKAGE}-report-quick.html",browse = FALSE); aa'
coveragequick: $(COVRQUICK)
clean:
@echo "\033[0;32mCleaning directory\033[0;0m"
git clean -f -d
uninstall:
@echo "\033[0;32mUninstalling package\033[0;0m"
$(R) CMD REMOVE ${PACKAGE}