Skip to content

Commit 6114d41

Browse files
author
ripley
committed
start checks of rust compilation
git-svn-id: https://svn.r-project.org/R/trunk@87115 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent cc70121 commit 6114d41

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/library/tools/R/check.R

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ add_dummies <- function(dir, Log)
323323
text <- strsplit(text, "\n")[[1L]]
324324
printLog(Log, paste(strwrap(text), collapse = "\n"), "\n")
325325
}
326+
InstLog <-NA_character_ # set in check_src()
326327

327328
## used for R_runR2 and
328329
## .check_package_description
@@ -667,7 +668,9 @@ add_dummies <- function(dir, Log)
667668
wrapLog(msg)
668669
}
669670
}
670-
}
671+
}
672+
673+
check_rust()
671674

672675
miss <- file.path("inst", "doc", c("Rplots.ps", "Rplots.pdf"))
673676
if (any(f <- file.exists(miss))) {
@@ -3752,6 +3755,7 @@ add_dummies <- function(dir, Log)
37523755
else
37533756
file.path(pkgoutdir, "00install.out")
37543757
if (file.exists(instlog) && dir.exists('src')) {
3758+
InstLog <<- instlog
37553759
checkingLog(Log, "compilation flags used")
37563760
lines <- readLines(instlog, warn = FALSE)
37573761
## skip stuff before building libs
@@ -3919,6 +3923,39 @@ add_dummies <- function(dir, Log)
39193923
} else resultLog(Log, "OK")
39203924
}
39213925

3926+
check_rust <- function()
3927+
{
3928+
## It is impossible to tell definiitively if a package
3929+
## compiles rust code. SystemRequirements in DESCRIPTION is
3930+
## fres-format, and only advisory. So we look at the
3931+
## installation log, which we found in check_src()
3932+
if (is.na(InstLog)) return (NA)
3933+
##message("InstLog = ", InstLog)
3934+
lines <- readLines(InstLog, warn = FALSE)
3935+
l1 <- grep("(cargo build| Compiling )", lines)
3936+
if(!length(l1)) return(NA)
3937+
checkingLog(Log, "Rust compilation")
3938+
msg <- character(); OK <- TRUE
3939+
if(any(grep("Downloading crates ...", lines))) {
3940+
OK <- FALSE
3941+
msg <- c(msg, "Downloads Rust crates")
3942+
}
3943+
lines <- lines[1:l1[1L]]
3944+
patt <- "rustc *[[:digit:]]+[].][[:digit:]]"
3945+
ans <- any(grepl(patt, lines, ignore.case = TRUE))
3946+
if(!ans) {
3947+
OK <- FALSE
3948+
msg <- c(msg, "No rustc version reported prior to compilation")
3949+
## print(lines)
3950+
}
3951+
if(OK)
3952+
resultLog(Log, "OK")
3953+
else {
3954+
msg <- paste(paste0(" ", msg), collapse = "\n")
3955+
warningLog(Log, msg)
3956+
}
3957+
}
3958+
39223959
check_loading <- function(arch = "")
39233960
{
39243961
checkingLog(Log, "whether the package can be loaded")

0 commit comments

Comments
 (0)