-
Notifications
You must be signed in to change notification settings - Fork 4k
[R-package] Add support for R 4.0 (fixes #3064, fixes #3024) #3065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
fae616f
[R-package] replaced gendef.exe with R code to create R.def (fixes #3…
jameslamb 3f0b201
fix broken things
jameslamb 7c4f6ec
trying to add R4.0 docs
jameslamb 10ed59c
changed make
jameslamb bfdfa9a
fixing make paths
jameslamb 05dbc7d
update notes on environment variables
jameslamb 2a9c70d
fix linting
jameslamb 5b921b4
fixes to CI
jameslamb 58626a1
fixing build_cmd and other stuff
jameslamb fdd73f5
fix bad substitution
jameslamb f28a96b
fix Azure Linux builds
jameslamb ff511d9
I am bad at bash
jameslamb baed7ef
simplifying
jameslamb fa21e73
only testing R
jameslamb e830a5b
getting better logs
jameslamb dc5ac1f
mingw32
jameslamb 984aa76
docs
jameslamb 79bc923
toolchain
jameslamb 1a44f02
using msys
jameslamb 727c1a2
fix visual studio condition
jameslamb 8f36d50
toolchain test
jameslamb 8aa23aa
full CI
jameslamb 3ae083b
fix if-elses
jameslamb 02ebaab
bump allowed NOTEs
jameslamb 799a5a0
search for Rscript
jameslamb 5ad20b7
updates to docs
jameslamb e5ab064
use processx
jameslamb 28b52df
fix mismatched arguments
jameslamb 8d078e0
move CI to GitHub Actions
jameslamb b39a2dd
minor changes
jameslamb 76271c0
fix workflow file
jameslamb aad8194
fix templating
jameslamb 3173698
fix Azure DevOps
jameslamb 7cfbbe3
fix conflicts
jameslamb aad57c1
debugging windows builds
jameslamb 8e3c30c
dont shQuote file name
jameslamb 5d8ced2
all GitHub Actions jobs
jameslamb 6b4a1f1
Apply suggestions from code review
jameslamb c65a910
minor cleanup
jameslamb 651a31d
remove objdump printing
jameslamb 709ddf3
make file.remove() invisible
jameslamb fb21a6f
Apply suggestions from code review
jameslamb 369da1f
Merge branch 'master' into fix/r-4.0
jameslamb d0e995f
reduce duplicated paths in docs
jameslamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # [description] | ||
| # Create a definition file (.def) from a .dll file, using objdump. | ||
| # | ||
| # [usage] | ||
| # | ||
| # Rscript make-r-def.R something.dll something.def | ||
| # | ||
| # [references] | ||
| # * https://www.cs.colorado.edu/~main/cs1300/doc/mingwfaq.html | ||
|
|
||
| args <- commandArgs(trailingOnly = TRUE) | ||
|
|
||
| IN_DLL_FILE <- args[[1L]] | ||
| OUT_DEF_FILE <- args[[2L]] | ||
| DLL_BASE_NAME <- basename(IN_DLL_FILE) | ||
|
|
||
| message(sprintf("Creating '%s' from '%s'", OUT_DEF_FILE, IN_DLL_FILE)) | ||
|
|
||
| # system() will not raise an R exception if the process called | ||
| # fails. Wrapping it here to get that behavior. | ||
| # | ||
| # system() introduces a lot of overhead, at least on Windows, | ||
| # so trying processx if it is available | ||
| .pipe_shell_command_to_stdout <- function(command, args, out_file) { | ||
| has_processx <- suppressMessages({ | ||
| suppressWarnings({ | ||
| require("processx") # nolint | ||
| }) | ||
| }) | ||
| if (has_processx) { | ||
| p <- processx::process$new( | ||
| command = command | ||
| , args = args | ||
| , stdout = out_file | ||
| , windows_verbatim_args = FALSE | ||
| ) | ||
| invisible(p$wait()) | ||
StrikerRUS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| message(paste0( | ||
| "Using system2() to run shell commands. Installing " | ||
| , "'processx' with install.packages('processx') might " | ||
| , "make this faster." | ||
| )) | ||
| # shQuote() is necessary here since one of the arguments | ||
| # is a file-path to R.dll, which may have spaces. processx | ||
| # does such quoting but system2() does not | ||
| exit_code <- system2( | ||
| command = command | ||
| , args = shoQuote(args) | ||
| , stdout = out_file | ||
| ) | ||
| if (exit_code != 0L) { | ||
| stop(paste0("Command failed with exit code: ", exit_code)) | ||
| } | ||
| } | ||
| return(invisible(NULL)) | ||
| } | ||
|
|
||
| # use objdump to dump all the symbols | ||
| OBJDUMP_FILE <- "objdump-out.txt" | ||
| .pipe_shell_command_to_stdout( | ||
| command = "objdump" | ||
| , args = c("-p", IN_DLL_FILE) | ||
| , out_file = OBJDUMP_FILE | ||
| ) | ||
jameslamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| objdump_results <- readLines(OBJDUMP_FILE) | ||
| invisible(file.remove(OBJDUMP_FILE)) | ||
|
|
||
| # Only one table in the objdump results matters for our purposes, | ||
| # see https://www.cs.colorado.edu/~main/cs1300/doc/mingwfaq.html | ||
| start_index <- which( | ||
| grepl( | ||
| pattern = "[Ordinal/Name Pointer] Table" | ||
| , x = objdump_results | ||
| , fixed = TRUE | ||
| ) | ||
| ) | ||
| empty_lines <- which(objdump_results == "") | ||
| end_of_table <- empty_lines[empty_lines > start_index][1L] | ||
|
|
||
| # Read the contents of the table | ||
| exported_symbols <- objdump_results[(start_index + 1L):end_of_table] | ||
| exported_symbols <- gsub("\t", "", exported_symbols) | ||
| exported_symbols <- gsub(".*\\] ", "", exported_symbols) | ||
| exported_symbols <- gsub(" ", "", exported_symbols) | ||
|
|
||
| # Write R.def file | ||
| writeLines( | ||
| text = c( | ||
| paste0("LIBRARY \"", DLL_BASE_NAME, "\"") | ||
| , "EXPORTS" | ||
| , exported_symbols | ||
| ) | ||
| , con = OUT_DEF_FILE | ||
| , sep = "\n" | ||
| ) | ||
| message(sprintf("Successfully created '%s'", OUT_DEF_FILE)) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.