Skip to content

Commit 332ed7e

Browse files
authored
Generate dSYM file in install() on macOS (#2598)
1 parent 6ec478b commit 332ed7e

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ Config/testthat/edition: 3
6969
Encoding: UTF-8
7070
Language: en-US
7171
Roxygen: list(markdown = TRUE)
72-
RoxygenNote: 7.2.3
72+
RoxygenNote: 7.3.2

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# devtools (development version)
22

3+
* On macOS, `install()` now generates `dSYM` sidecar files for native libraries by default.
4+
35
* Functions that use httr now explicitly check that it is installed
46
(@catalamarti, #2573).
57

R/install.R

+19
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@
3636
#' @param keep_source If `TRUE` will keep the srcrefs from an installed
3737
#' package. This is useful for debugging (especially inside of RStudio).
3838
#' It defaults to the option `"keep.source.pkgs"`.
39+
#' @param generate_dsym (macOS only) If `TRUE`, and if the package includes a
40+
#' native library (a `.so` file), a `dSYM` sidecar file is generated and
41+
#' installed alongside the library. This file contains source and line
42+
#' information that allows a debugger to step through original sources.
43+
#'
44+
#' Note that since `install()` operates from a temporary directory, the source
45+
#' paths will point to dangling locations. You will need to remap these paths
46+
#' to the actual sources on your disk, e.g. with lldb:
47+
#'
48+
#' ```
49+
#' # Get information about the dangling temporary path for a function in your
50+
#' # library
51+
#' image lookup -vn my_function
52+
#'
53+
#' # Remap the dangling location to the actual package path
54+
#' settings set target.source-map /private/tmp/Rtmpnl5XgE/R.INSTALLe5133dcc3211/mypackage /path/to/mypackage
55+
#' ```
3956
#' @param ... additional arguments passed to [remotes::install_deps()]
4057
#' when installing dependencies.
4158
#' @family package installation
@@ -50,6 +67,7 @@ install <-
5067
build_vignettes = FALSE,
5168
keep_source = getOption("keep.source.pkgs"),
5269
force = FALSE,
70+
generate_dsym = TRUE,
5371
...) {
5472
pkg <- as.package(pkg)
5573

@@ -70,6 +88,7 @@ install <-
7088

7189
opts <- c(
7290
if (keep_source) "--with-keep.source",
91+
if (is_macos && generate_dsym) "--dsym",
7392
"--install-tests"
7493
)
7594
if (quick) {

R/utils.R

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ compact <- function(x) {
1010
}
1111

1212
is_windows <- isTRUE(.Platform$OS.type == "windows")
13+
is_macos <- isTRUE(tolower(Sys.info()[["sysname"]]) == "darwin")
1314

1415
sort_ci <- function(x) {
1516
withr::with_collate("C", x[order(tolower(x), x)])

man/install.Rd

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)