Skip to content

Commit 4364bf8

Browse files
committed
improved rust check
1 parent 8f2ce5a commit 4364bf8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/library/tools/R/check.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3925,15 +3925,16 @@ add_dummies <- function(dir, Log)
39253925

39263926
check_rust <- function()
39273927
{
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()
3928+
## A Cargo.toml file is used to identify a rust package,
3929+
## so check for Cargo.toml under src to see if rust code
3930+
## is compiled in the crate
39323931
if (is.na(InstLog)) return (NA)
3932+
srcd <- file.path(pkgdir, "src")
3933+
if (length(Sys.glob(paste0(srcd, "/**/Cargo.toml"))) == 0) return (NA)
39333934
##message("InstLog = ", InstLog)
39343935
lines <- readLines(InstLog, warn = FALSE)
39353936
l1 <- grep("(cargo build| Compiling )", lines)
3936-
if(!length(l1)) return(NA)
3937+
if(!length(l1)) return (NA)
39373938
l2 <- grep(" Compiling ", lines)
39383939
checkingLog(Log, "Rust compilation")
39393940
msg <- character(); OK <- TRUE

0 commit comments

Comments
 (0)