This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new bc447b29f chore(r): Consolidate common bootstrap/build ignore code and 
re-run documentation generation (#2135)
bc447b29f is described below

commit bc447b29fcb4b432dd365ca83f3736779ceace1d
Author: Dewey Dunnington <[email protected]>
AuthorDate: Thu Sep 12 16:08:30 2024 -0500

    chore(r): Consolidate common bootstrap/build ignore code and re-run 
documentation generation (#2135)
    
    This PR does a few maintenance tasks highlighted by submitting the last
    release to CRAN:
    
    - Consolidates the bootstrap code, which is now the same for all C-based
    drivers (and the same among Go-based drivers).
    - Updates the .Rbuildignore, which in some drivers had ignored clangd
    stuff and hadn't in others (and in some cases contained references to
    irrelevant files
    - Fixed a documentation NOTE and re-ran `devtools::document()` on the
    C-based drivers
---
 r/adbcdrivermanager/DESCRIPTION                    |  2 +-
 r/adbcdrivermanager/R/helpers.R                    |  2 +-
 r/adbcdrivermanager/bootstrap.R                    | 17 +-------
 r/adbcdrivermanager/configure                      |  3 +-
 r/adbcdrivermanager/man/read_adbc.Rd               |  2 +-
 r/adbcflightsql/bootstrap.R                        | 48 +---------------------
 r/adbcflightsql/configure                          |  1 +
 r/adbcpostgresql/.Rbuildignore                     |  5 +--
 r/adbcpostgresql/DESCRIPTION                       |  2 +-
 r/adbcpostgresql/bootstrap.R                       | 20 +--------
 r/adbcpostgresql/configure                         |  1 +
 r/adbcpostgresql/man/adbcpostgresql-package.Rd     |  1 -
 r/adbcpostgresql/src/Makevars.in                   |  2 +-
 r/adbcpostgresql/src/Makevars.ucrt                 |  2 +-
 r/adbcpostgresql/src/Makevars.win                  |  2 +-
 r/adbcsnowflake/bootstrap.R                        | 48 +---------------------
 r/adbcsnowflake/configure                          |  1 +
 r/adbcsqlite/.Rbuildignore                         |  4 +-
 r/adbcsqlite/DESCRIPTION                           |  2 +-
 r/adbcsqlite/bootstrap.R                           | 19 +--------
 r/adbcsqlite/configure                             |  3 +-
 r/adbcsqlite/man/adbcsqlite-package.Rd             |  1 -
 r/adbcsqlite/src/Makevars.in                       |  2 +-
 .../bootstrap.R => tools/bootstrap-c.R}            | 16 +++++++-
 .../bootstrap.R => tools/bootstrap-go.R}           | 40 ++++++++----------
 25 files changed, 58 insertions(+), 188 deletions(-)

diff --git a/r/adbcdrivermanager/DESCRIPTION b/r/adbcdrivermanager/DESCRIPTION
index 47c4d0937..d57c0b49c 100644
--- a/r/adbcdrivermanager/DESCRIPTION
+++ b/r/adbcdrivermanager/DESCRIPTION
@@ -15,7 +15,7 @@ Description: Provides a developer-facing interface to 'Arrow' 
Database
 License: Apache License (>= 2)
 Encoding: UTF-8
 Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.2
 Suggests:
     testthat (>= 3.0.0),
     withr
diff --git a/r/adbcdrivermanager/R/helpers.R b/r/adbcdrivermanager/R/helpers.R
index eea3a3ee8..d99584806 100644
--- a/r/adbcdrivermanager/R/helpers.R
+++ b/r/adbcdrivermanager/R/helpers.R
@@ -36,7 +36,7 @@
 #' @param ... Passed to S3 methods.
 #'
 #' @return
-#'   - `read_adbc()`: A [nanoarrow_array_stream][as_nanoarrow_array_stream]
+#'   - `read_adbc()`: A 
[nanoarrow_array_stream][nanoarrow::as_nanoarrow_array_stream]
 #'   - `execute_adbc()`: `db_or_con`, invisibly.
 #'   - `write_adbc()`: `tbl`, invisibly.
 #' @export
diff --git a/r/adbcdrivermanager/bootstrap.R b/r/adbcdrivermanager/bootstrap.R
index 73506902a..d1c1353f4 100644
--- a/r/adbcdrivermanager/bootstrap.R
+++ b/r/adbcdrivermanager/bootstrap.R
@@ -15,18 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-source_files <- list.files("../../c", "\\.(h|c|cc|hpp)$", recursive = TRUE)
-source_files <- source_files[!grepl("_test\\.cc", source_files)]
-source_files <- source_files[!grepl("^(build|out)/", source_files)]
-# backward C++ causes CRAN warnings and the drivers do not use it
-source_files <- source_files[!grepl("^vendor/backward", source_files)]
-source_files <- file.path("c", source_files)
-src <- file.path("../..", source_files)
-dst <- file.path("src", source_files)
-
-unlink("src/c", recursive = TRUE)
-for (dir_name in rev(unique(dirname(dst)))) {
-  dir.create(dir_name, showWarnings = FALSE, recursive = TRUE)
-}
-
-stopifnot(all(file.copy(src, dst)))
+Sys.setenv("ADBC_R_BOOTSTRAP_EXCLUDE" = "vendor/sqlite3")
+source("../tools/bootstrap-c.R")
diff --git a/r/adbcdrivermanager/configure b/r/adbcdrivermanager/configure
index a0bec8830..998239a44 100755
--- a/r/adbcdrivermanager/configure
+++ b/r/adbcdrivermanager/configure
@@ -22,5 +22,6 @@
 # ADBC repo into this package. If the file doesn't exist, we're installing
 # from a pre-built tarball.
 if [ -f bootstrap.R ]; then
-  $R_HOME/bin/Rscript bootstrap.R --vanilla
+  echo "Running bootstrap.R..."
+  "$R_HOME/bin/Rscript" bootstrap.R --vanilla
 fi
diff --git a/r/adbcdrivermanager/man/read_adbc.Rd 
b/r/adbcdrivermanager/man/read_adbc.Rd
index eba140c36..31bb9d930 100644
--- a/r/adbcdrivermanager/man/read_adbc.Rd
+++ b/r/adbcdrivermanager/man/read_adbc.Rd
@@ -43,7 +43,7 @@ is not compatible or append otherwise).}
 }
 \value{
 \itemize{
-\item \code{read_adbc()}: A 
\link[=as_nanoarrow_array_stream]{nanoarrow_array_stream}
+\item \code{read_adbc()}: A 
\link[nanoarrow:as_nanoarrow_array_stream]{nanoarrow_array_stream}
 \item \code{execute_adbc()}: \code{db_or_con}, invisibly.
 \item \code{write_adbc()}: \code{tbl}, invisibly.
 }
diff --git a/r/adbcflightsql/bootstrap.R b/r/adbcflightsql/bootstrap.R
index b29da14b0..c3dd879dd 100644
--- a/r/adbcflightsql/bootstrap.R
+++ b/r/adbcflightsql/bootstrap.R
@@ -15,50 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# If we are building within the repo, copy the go sources into the go/
-# directory. Technically this copies all go drivers but this is easier
-# than remembering the internal dependency structure of the go sources.
-files_to_vendor <- list.files(
-  "../../go/adbc",
-  "\\.(go|mod|txt|sum|h|c)$",
-  recursive = TRUE
-)
-
-files_to_vendor_src <- file.path("../../go/adbc", files_to_vendor)
-files_to_vendor_dst <- file.path("src/go/adbc", files_to_vendor)
-
-# On Windows, file.copy does not handle symlinks. This
-# is not a problem for a user install, where this script
-# should not even exist, but the below helps development
-# on Windows.
-dir.create("src/arrow-adbc", showWarnings=FALSE)
-file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
-
-if (all(file.exists(files_to_vendor_src))) {
-  unlink("src/go/adbc", recursive = TRUE)
-
-  cat(
-    sprintf(
-      "Vendoring files from arrow-adbc/go/adbc to src/go/adbc:\n%s\n",
-      paste(
-        "-", files_to_vendor_src, " -> ", files_to_vendor_dst,
-        collapse = "\n"
-      )
-    )
-  )
-
-  # Recreate the directory structure
-  dst_dirs <- unique(dirname(files_to_vendor_dst))
-  for (dst_dir in dst_dirs) {
-    if (!dir.exists(dst_dir)) {
-      dir.create(dst_dir, recursive = TRUE)
-    }
-  }
-
-  # Copy the files
-  if (all(file.copy(files_to_vendor_src, files_to_vendor_dst))) {
-    cat("All files successfully copied to src/go/adbc\n")
-  } else {
-    stop("Failed to vendor all files")
-  }
-}
+source("../tools/bootstrap-go.R")
diff --git a/r/adbcflightsql/configure b/r/adbcflightsql/configure
index 3ba0a5946..ffa51d900 100755
--- a/r/adbcflightsql/configure
+++ b/r/adbcflightsql/configure
@@ -41,6 +41,7 @@ fi
 # ADBC repo into this package. If the file doesn't exist, we're installing
 # from a pre-built tarball.
 if [ -f bootstrap.R ]; then
+  echo "Running bootstrap.R..."
   "$RSCRIPT_BIN" bootstrap.R
 fi
 
diff --git a/r/adbcpostgresql/.Rbuildignore b/r/adbcpostgresql/.Rbuildignore
index 2525a88aa..bbed9151e 100644
--- a/r/adbcpostgresql/.Rbuildignore
+++ b/r/adbcpostgresql/.Rbuildignore
@@ -4,9 +4,6 @@
 ^bootstrap\.R$
 ^README\.Rmd$
 ^src/Makevars$
-^src/sqlite3\.c$
-^src/sqlite3\.h$
-^docker-compose\.yml$
 ^configure\.win$
 ^windows$
 ^\.vscode$
@@ -14,3 +11,5 @@
 ^docs$
 ^pkgdown$
 ^cran-comments\.md$
+^compile_commands\.json$
+^\.cache$
diff --git a/r/adbcpostgresql/DESCRIPTION b/r/adbcpostgresql/DESCRIPTION
index ebb0c6440..a7fd93da4 100644
--- a/r/adbcpostgresql/DESCRIPTION
+++ b/r/adbcpostgresql/DESCRIPTION
@@ -15,7 +15,7 @@ Description: Provides a developer-facing interface to the 
'Arrow' Database
 License: Apache License (>= 2)
 Encoding: UTF-8
 Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.2
 SystemRequirements: libpq
 Suggests:
     nanoarrow,
diff --git a/r/adbcpostgresql/bootstrap.R b/r/adbcpostgresql/bootstrap.R
index 0357a3be6..d1c1353f4 100644
--- a/r/adbcpostgresql/bootstrap.R
+++ b/r/adbcpostgresql/bootstrap.R
@@ -15,21 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-dir.create("src/arrow-adbc", showWarnings = FALSE)
-file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
-
-source_files <- list.files("../../c", "\\.(h|c|cc|hpp)$", recursive = TRUE)
-source_files <- source_files[!grepl("_test\\.cc", source_files)]
-source_files <- source_files[!grepl("^(build|out)/", source_files)]
-# backward C++ causes CRAN warnings and the drivers do not use it
-source_files <- source_files[!grepl("^vendor/backward", source_files)]
-source_files <- file.path("c", source_files)
-src <- file.path("../..", source_files)
-dst <- file.path("src", source_files)
-
-unlink("src/c", recursive = TRUE)
-for (dir_name in rev(unique(dirname(dst)))) {
-  dir.create(dir_name, showWarnings = FALSE, recursive = TRUE)
-}
-
-stopifnot(all(file.copy(src, dst)))
+Sys.setenv("ADBC_R_BOOTSTRAP_EXCLUDE" = "vendor/sqlite3")
+source("../tools/bootstrap-c.R")
diff --git a/r/adbcpostgresql/configure b/r/adbcpostgresql/configure
index d23dab0a6..0e4eb0014 100755
--- a/r/adbcpostgresql/configure
+++ b/r/adbcpostgresql/configure
@@ -22,6 +22,7 @@
 # ADBC repo into this package. If the file doesn't exist, we're installing
 # from a pre-built tarball.
 if [ -f bootstrap.R ]; then
+  echo "Running bootstrap.R..."
   "$R_HOME/bin/Rscript" bootstrap.R
 fi
 
diff --git a/r/adbcpostgresql/man/adbcpostgresql-package.Rd 
b/r/adbcpostgresql/man/adbcpostgresql-package.Rd
index 6fd1ae426..6656b07da 100644
--- a/r/adbcpostgresql/man/adbcpostgresql-package.Rd
+++ b/r/adbcpostgresql/man/adbcpostgresql-package.Rd
@@ -3,7 +3,6 @@
 \docType{package}
 \name{adbcpostgresql-package}
 \alias{adbcpostgresql-package}
-\alias{_PACKAGE}
 \title{adbcpostgresql: 'Arrow' Database Connectivity ('ADBC') 'PostgreSQL' 
Driver}
 \description{
 Provides a developer-facing interface to the 'Arrow' Database Connectivity 
('ADBC') 'PostgreSQL' driver for the purposes of building high-level database 
interfaces for users. 'ADBC' \url{https://arrow.apache.org/adbc/} is an API 
standard for database access libraries that uses 'Arrow' for result sets and 
query parameters.
diff --git a/r/adbcpostgresql/src/Makevars.in b/r/adbcpostgresql/src/Makevars.in
index c34b0e160..4c2af03bf 100644
--- a/r/adbcpostgresql/src/Makevars.in
+++ b/r/adbcpostgresql/src/Makevars.in
@@ -16,7 +16,7 @@
 # under the License.
 
 CXX_STD = CXX17
-PKG_CPPFLAGS=-I../src -I../src/c/ -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include/ @cppflags@ -DADBC_EXPORT="" -DFMT_HEADER_ONLY=1
+PKG_CPPFLAGS=-I../src/c -I../src/c/include -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include @cppflags@ -DADBC_EXPORT="" -DFMT_HEADER_ONLY=1
 PKG_LIBS=@libs@
 
 OBJECTS = init.o \
diff --git a/r/adbcpostgresql/src/Makevars.ucrt 
b/r/adbcpostgresql/src/Makevars.ucrt
index 37b101344..659829dae 100644
--- a/r/adbcpostgresql/src/Makevars.ucrt
+++ b/r/adbcpostgresql/src/Makevars.ucrt
@@ -16,7 +16,7 @@
 # under the License.
 
 CXX_STD = CXX17
-PKG_CPPFLAGS = -I../src -I../src/c/ -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include/ -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO 
-DFMT_HEADER_ONLY=1
+PKG_CPPFLAGS = -I../src/c -I../src/c/include -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO 
-DFMT_HEADER_ONLY=1
 
 PKG_LIBS = -lpq -lpgcommon -lpgport -lssl -lcrypto -lz -lsecur32 -lws2_32 
-lwldap32 -lcrypt32
 
diff --git a/r/adbcpostgresql/src/Makevars.win 
b/r/adbcpostgresql/src/Makevars.win
index fe715ef3b..2cf926913 100644
--- a/r/adbcpostgresql/src/Makevars.win
+++ b/r/adbcpostgresql/src/Makevars.win
@@ -18,7 +18,7 @@
 VERSION = 13.2.0
 RWINLIB = ../windows/libpq-$(VERSION)
 CXX_STD = CXX17
-PKG_CPPFLAGS = -I$(RWINLIB)/include -I../src -I../src/c/ -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include/ -DADBC_EXPORT="" -D__USE_MINGW_ANSI_STDIO 
-DFMT_HEADER_ONLY=1
+PKG_CPPFLAGS = -I$(RWINLIB)/include -I../src/c -I../src/c/include 
-I../src/c/vendor/ -I../src/c/vendor/fmt/include -DADBC_EXPORT="" 
-D__USE_MINGW_ANSI_STDIO -DFMT_HEADER_ONLY=1
 PKG_LIBS = -L$(RWINLIB)/lib${R_ARCH}${CRT} \
        -lpq -lpgport -lpgcommon -lssl -lcrypto -lwsock32 -lsecur32 -lws2_32 
-lgdi32 -lcrypt32 -lwldap32
 
diff --git a/r/adbcsnowflake/bootstrap.R b/r/adbcsnowflake/bootstrap.R
index ab8e05a81..c3dd879dd 100644
--- a/r/adbcsnowflake/bootstrap.R
+++ b/r/adbcsnowflake/bootstrap.R
@@ -15,50 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# If we are building within the repo, copy the go sources into the go/
-# directory. Technically this copies all go drivers but this is easier
-# than remembering the internal dependency structure of the go sources.
-files_to_vendor <- list.files(
-  "../../go/adbc",
-  "\\.(go|mod|txt|sum|h|c|sql)$",
-  recursive = TRUE
-)
-
-files_to_vendor_src <- file.path("../../go/adbc", files_to_vendor)
-files_to_vendor_dst <- file.path("src/go/adbc", files_to_vendor)
-
-# On Windows, file.copy does not handle symlinks. This
-# is not a problem for a user install, where this script
-# should not even exist, but the below helps development
-# on Windows.
-dir.create("src/arrow-adbc", showWarnings=FALSE)
-file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
-
-if (all(file.exists(files_to_vendor_src))) {
-  unlink("src/go/adbc", recursive = TRUE)
-
-  cat(
-    sprintf(
-      "Vendoring files from arrow-adbc/go/adbc to src/go/adbc:\n%s\n",
-      paste(
-        "-", files_to_vendor_src, " -> ", files_to_vendor_dst,
-        collapse = "\n"
-      )
-    )
-  )
-
-  # Recreate the directory structure
-  dst_dirs <- unique(dirname(files_to_vendor_dst))
-  for (dst_dir in dst_dirs) {
-    if (!dir.exists(dst_dir)) {
-      dir.create(dst_dir, recursive = TRUE)
-    }
-  }
-
-  # Copy the files
-  if (all(file.copy(files_to_vendor_src, files_to_vendor_dst))) {
-    cat("All files successfully copied to src/go/adbc\n")
-  } else {
-    stop("Failed to vendor all files")
-  }
-}
+source("../tools/bootstrap-go.R")
diff --git a/r/adbcsnowflake/configure b/r/adbcsnowflake/configure
index e5a101435..ff68cdd03 100755
--- a/r/adbcsnowflake/configure
+++ b/r/adbcsnowflake/configure
@@ -41,6 +41,7 @@ fi
 # ADBC repo into this package. If the file doesn't exist, we're installing
 # from a pre-built tarball.
 if [ -f bootstrap.R ]; then
+  echo "Running bootstrap.R..."
   "$RSCRIPT_BIN" bootstrap.R
 fi
 
diff --git a/r/adbcsqlite/.Rbuildignore b/r/adbcsqlite/.Rbuildignore
index 7a0fc58e1..42642862d 100644
--- a/r/adbcsqlite/.Rbuildignore
+++ b/r/adbcsqlite/.Rbuildignore
@@ -4,10 +4,10 @@
 ^bootstrap\.R$
 ^README\.Rmd$
 ^src/Makevars$
-^src/sqlite3\.c$
-^src/sqlite3\.h$
 ^\.vscode$
 ^_pkgdown\.yml$
 ^docs$
 ^pkgdown$
 ^cran-comments\.md$
+^compile_commands\.json$
+^\.cache$
diff --git a/r/adbcsqlite/DESCRIPTION b/r/adbcsqlite/DESCRIPTION
index 0aa8686f3..55d53d8f3 100644
--- a/r/adbcsqlite/DESCRIPTION
+++ b/r/adbcsqlite/DESCRIPTION
@@ -15,7 +15,7 @@ Description: Provides a developer-facing interface to the 
'Arrow' Database
 License: Apache License (>= 2)
 Encoding: UTF-8
 Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.2
 SystemRequirements: SQLite3
 Suggests:
     nanoarrow,
diff --git a/r/adbcsqlite/bootstrap.R b/r/adbcsqlite/bootstrap.R
index 0357a3be6..23c65340a 100644
--- a/r/adbcsqlite/bootstrap.R
+++ b/r/adbcsqlite/bootstrap.R
@@ -15,21 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-dir.create("src/arrow-adbc", showWarnings = FALSE)
-file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
-
-source_files <- list.files("../../c", "\\.(h|c|cc|hpp)$", recursive = TRUE)
-source_files <- source_files[!grepl("_test\\.cc", source_files)]
-source_files <- source_files[!grepl("^(build|out)/", source_files)]
-# backward C++ causes CRAN warnings and the drivers do not use it
-source_files <- source_files[!grepl("^vendor/backward", source_files)]
-source_files <- file.path("c", source_files)
-src <- file.path("../..", source_files)
-dst <- file.path("src", source_files)
-
-unlink("src/c", recursive = TRUE)
-for (dir_name in rev(unique(dirname(dst)))) {
-  dir.create(dir_name, showWarnings = FALSE, recursive = TRUE)
-}
-
-stopifnot(all(file.copy(src, dst)))
+source("../tools/bootstrap-c.R")
diff --git a/r/adbcsqlite/configure b/r/adbcsqlite/configure
index 52795bd4c..401ecb634 100755
--- a/r/adbcsqlite/configure
+++ b/r/adbcsqlite/configure
@@ -22,7 +22,8 @@
 # ADBC repo into this package. If the file doesn't exist, we're installing
 # from a pre-built tarball.
 if [ -f bootstrap.R ]; then
-  $R_HOME/bin/Rscript bootstrap.R --vanilla
+  echo "Running bootstrap.R..."
+  "$R_HOME/bin/Rscript" bootstrap.R --vanilla
 fi
 
 # Include and library flags
diff --git a/r/adbcsqlite/man/adbcsqlite-package.Rd 
b/r/adbcsqlite/man/adbcsqlite-package.Rd
index 6af152480..e66b4cdcc 100644
--- a/r/adbcsqlite/man/adbcsqlite-package.Rd
+++ b/r/adbcsqlite/man/adbcsqlite-package.Rd
@@ -3,7 +3,6 @@
 \docType{package}
 \name{adbcsqlite-package}
 \alias{adbcsqlite-package}
-\alias{_PACKAGE}
 \title{adbcsqlite: 'Arrow' Database Connectivity ('ADBC') 'SQLite' Driver}
 \description{
 Provides a developer-facing interface to the 'Arrow' Database Connectivity 
('ADBC') 'SQLite' driver for the purposes of building high-level database 
interfaces for users. 'ADBC' \url{https://arrow.apache.org/adbc/} is an API 
standard for database access libraries that uses 'Arrow' for result sets and 
query parameters.
diff --git a/r/adbcsqlite/src/Makevars.in b/r/adbcsqlite/src/Makevars.in
index e4da67dc8..93a1ce7b4 100644
--- a/r/adbcsqlite/src/Makevars.in
+++ b/r/adbcsqlite/src/Makevars.in
@@ -16,7 +16,7 @@
 # under the License.
 
 CXX_STD = CXX17
-PKG_CPPFLAGS=-I../src/ -I../src/c/ -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include/ @cppflags@ -DADBC_EXPORT="" -DFMT_HEADER_ONLY=1 
-D_LIBCPP_DISABLE_AVAILABILITY
+PKG_CPPFLAGS=-I../src/c -I../src/c/include -I../src/c/vendor/ 
-I../src/c/vendor/fmt/include @cppflags@ -DADBC_EXPORT="" -DFMT_HEADER_ONLY=1 
-D_LIBCPP_DISABLE_AVAILABILITY
 PKG_LIBS=@libs@
 
 OBJECTS = init.o \
diff --git a/r/adbcpostgresql/bootstrap.R b/r/tools/bootstrap-c.R
similarity index 79%
copy from r/adbcpostgresql/bootstrap.R
copy to r/tools/bootstrap-c.R
index 0357a3be6..87e5f6e7f 100644
--- a/r/adbcpostgresql/bootstrap.R
+++ b/r/tools/bootstrap-c.R
@@ -15,21 +15,33 @@
 # specific language governing permissions and limitations
 # under the License.
 
-dir.create("src/arrow-adbc", showWarnings = FALSE)
-file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
+exclude <- Sys.getenv("ADBC_R_BOOTSTRAP_EXCLUDE", "")
 
 source_files <- list.files("../../c", "\\.(h|c|cc|hpp)$", recursive = TRUE)
+
+# Apply excludes that apply to all drivers
 source_files <- source_files[!grepl("_test\\.cc", source_files)]
 source_files <- source_files[!grepl("^(build|out)/", source_files)]
 # backward C++ causes CRAN warnings and the drivers do not use it
 source_files <- source_files[!grepl("^vendor/backward", source_files)]
+
+# Apply excludes passed via environment variable
+if (!identical(exclude, "")) {
+  source_files <- source_files[!grepl(exclude, source_files)]
+}
+
+# Create source and destination paths
 source_files <- file.path("c", source_files)
 src <- file.path("../..", source_files)
 dst <- file.path("src", source_files)
 
+# Clean existing vendor
 unlink("src/c", recursive = TRUE)
+
+# Create folder structure for new vendor
 for (dir_name in rev(unique(dirname(dst)))) {
   dir.create(dir_name, showWarnings = FALSE, recursive = TRUE)
 }
 
+# Copy files
 stopifnot(all(file.copy(src, dst)))
diff --git a/r/adbcsnowflake/bootstrap.R b/r/tools/bootstrap-go.R
similarity index 67%
copy from r/adbcsnowflake/bootstrap.R
copy to r/tools/bootstrap-go.R
index ab8e05a81..63421318b 100644
--- a/r/adbcsnowflake/bootstrap.R
+++ b/r/tools/bootstrap-go.R
@@ -31,34 +31,28 @@ files_to_vendor_dst <- file.path("src/go/adbc", 
files_to_vendor)
 # is not a problem for a user install, where this script
 # should not even exist, but the below helps development
 # on Windows.
-dir.create("src/arrow-adbc", showWarnings=FALSE)
+dir.create("src/arrow-adbc", showWarnings = FALSE)
 file.copy("../../c/include/arrow-adbc/adbc.h", "src/arrow-adbc/adbc.h")
 
-if (all(file.exists(files_to_vendor_src))) {
-  unlink("src/go/adbc", recursive = TRUE)
+unlink("src/go/adbc", recursive = TRUE)
 
-  cat(
-    sprintf(
-      "Vendoring files from arrow-adbc/go/adbc to src/go/adbc:\n%s\n",
-      paste(
-        "-", files_to_vendor_src, " -> ", files_to_vendor_dst,
-        collapse = "\n"
-      )
+cat(
+  sprintf(
+    "Vendoring files from arrow-adbc/go/adbc to src/go/adbc:\n%s\n",
+    paste(
+      "-", files_to_vendor_src, " -> ", files_to_vendor_dst,
+      collapse = "\n"
     )
   )
+)
 
-  # Recreate the directory structure
-  dst_dirs <- unique(dirname(files_to_vendor_dst))
-  for (dst_dir in dst_dirs) {
-    if (!dir.exists(dst_dir)) {
-      dir.create(dst_dir, recursive = TRUE)
-    }
-  }
-
-  # Copy the files
-  if (all(file.copy(files_to_vendor_src, files_to_vendor_dst))) {
-    cat("All files successfully copied to src/go/adbc\n")
-  } else {
-    stop("Failed to vendor all files")
+# Recreate the directory structure
+dst_dirs <- unique(dirname(files_to_vendor_dst))
+for (dst_dir in dst_dirs) {
+  if (!dir.exists(dst_dir)) {
+    dir.create(dst_dir, recursive = TRUE)
   }
 }
+
+# Copy the files
+stopifnot(all(file.copy(files_to_vendor_src, files_to_vendor_dst)))

Reply via email to