-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.R
83 lines (71 loc) · 1.96 KB
/
build.R
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
# Build File
#
# Documents the package using roxygen
# Two build modes:
# - slow: make sure that binaries are built and source references retained
# - quick: quick reinstall, might not work after major changes (especially to C code)
args <- commandArgs(trailingOnly = TRUE)
if('docOnly' %in% args){
# update documentation
devtools::document()
devtools::build_vignettes(
dependencies = FALSE,
upgrade = FALSE,
install = FALSE
)
# only update reference pages
pkgdown::build_site(
lazy = TRUE,
devel = TRUE,
preview = FALSE
)
system('sed -i "s/href=\'\\./href=\'dot-/g" docs/**/*.html')
} else if('quick' %in% args){
try({
libpath <- installed.packages()['vscDebugger', 'LibPath']
trunc <- file.path(libpath, 'vscDebugger', 'libs')
# f1 <- file(file.path(trunc, 'i386', 'vscDebugger.dll'), open='r')
f2 <- file(file.path(trunc, 'x64', 'vscDebugger.dll'), open='r')
remove.packages('vscDebugger')
})
# update documentation
devtools::document()
# quick install only
# usually enough, e.g. when only changing some R code
devtools::install(
dependencies = FALSE,
quick=TRUE,
keep_source=TRUE,
args=c("--no-byte-compile", "--no-staged-install", "--no-libs")
)
# pkgdown::build_site(
# install = FALSE,
# lazy = TRUE,
# devel = TRUE,
# preview = FALSE
# )
# system('sed -i "s/href=\'\\./href=\'dot-/g" docs/**/*.html')
} else{
# This workflow seems to work on windows to reliably build the
# binaries and keep the source info of the debugger:
# update documentation
devtools::document()
# normal install first to build binaries
devtools::install(
dependencies = FALSE,
upgrade = 'never',
quick = FALSE,
build = TRUE,
force = TRUE,
args = c(
"--preclean",
"--clean"
),
build_vignettes = TRUE
)
pkgdown::build_site(
install = FALSE,
preview = FALSE
)
system('sed -i "s/href=\'\\./href=\'dot-/g" docs/**/*.html')
}