Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
1c27a15e
Commit
1c27a15e
authored
May 08, 2019
by
James Lamb
Committed by
Laurae
May 08, 2019
Browse files
removed external dependenciesin build_r.R (fixes #2122) (#2123)
parent
94fbe5bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
build_r.R
build_r.R
+13
-10
No files found.
build_r.R
View file @
1c27a15e
...
...
@@ -5,10 +5,6 @@
# Sys.setenv("CXX" = "/usr/local/bin/g++-8")
# Sys.setenv("CC" = "/usr/local/bin/gcc-8")
library
(
testthat
)
library
(
roxygen2
)
library
(
devtools
)
# R returns FALSE (not a non-zero exit code) if a file copy operation
# breaks. Let's fix that
.handle_result
<-
function
(
res
)
{
...
...
@@ -17,6 +13,15 @@ library(devtools)
}
}
# system() will not raise an R exception if the process called
# fails. Wrapping it here to get that behavior
.run_shell_command
<-
function
(
cmd
,
...
){
exit_code
<-
system
(
cmd
,
...
)
if
(
exit_code
!=
0
){
stop
(
paste0
(
"Command failed with exit code: "
,
exit_code
))
}
}
# Make a new temporary folder to work in
unlink
(
x
=
"lightgbm_r"
,
recursive
=
TRUE
)
dir.create
(
"lightgbm_r"
)
...
...
@@ -51,15 +56,12 @@ result <- file.copy(from = "CMakeLists.txt",
overwrite
=
TRUE
)
.handle_result
(
result
)
# rebuild documentation
# devtools::document(pkg = "lightgbm_r")
# Build the package
# NOTE: --keep-empty-dirs is necessary to keep the deep paths expected
# by CMake while also meeting the CRAN req to create object files
# on demand
devtools
::
build
(
pkg
=
"lightgbm_r"
,
args
=
c
(
"--keep-empty-dirs"
)
)
cmd
<-
"R CMD build lightgbm_r --keep_empty-dirs"
.run_shell_command
(
cmd
)
# Install the package
version
<-
gsub
(
...
...
@@ -73,7 +75,8 @@ version <- gsub(
)
tarball
<-
file.path
(
getwd
(),
sprintf
(
"lightgbm_%s.tar.gz"
,
version
))
system
(
sprintf
(
"R CMD INSTALL %s --no-multiarch"
,
tarball
))
cmd
<-
sprintf
(
"R CMD INSTALL %s --no-multiarch"
,
tarball
)
.run_shell_command
(
cmd
)
# Run R CMD CHECK
# R CMD CHECK lightgbm_2.1.2.tar.gz --as-cran | tee check.log | cat
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment