1#' Build Tools 2#' 3#' Check, install, and use build tools as required. 4#' 5#' These functions are intended to be used together -- one should 6#' first check whether build tools are available, and when not, 7#' prompt for installation. For example: 8#' 9#' ```R 10#' compile_model <- function(...) { 11#' 12#' if (rstudioapi::isAvailable()) { 13#' 14#' if (!rstudioapi::buildToolsCheck()) 15#' rstudioapi::buildToolsInstall("Model compilation") 16#' 17#' rstudioapi::buildToolsExec({ 18#' # code requiring build tools here 19#' }) 20#' 21#' } 22#' } 23#' ``` 24#' 25#' The `action` parameter is used to communicate (with a prompt) the operation 26#' being performed that requires build tool installation. Setting it to `NULL` 27#' or the empty string will suppress that prompt. 28#' 29#' @param action The action (as a string) being taken that will require 30#' installation of build tools. 31#' 32#' @param expr An \R expression (unquoted) to be executed with build tools 33#' available and on the `PATH`. 34#' 35#' @note The `buildToolsCheck()`, `buildToolsInstall()`, and `buildToolsExec()` 36#' functions were added with version 1.2.962 of RStudio. 37#' 38#' @name build-tools 39NULL 40 41#' @name build-tools 42#' @export 43buildToolsCheck <- function() { 44 callFun("buildToolsCheck") 45} 46 47#' @name build-tools 48#' @export 49buildToolsInstall <- function(action) { 50 callFun("buildToolsInstall", action) 51} 52 53#' @name build-tools 54#' @export 55buildToolsExec <- function(expr) { 56 callFun("buildToolsExec", expr) 57} 58