From a3ebb2899852b22471aa11eaeb67768d85d7c565 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Wed, 11 Nov 2020 15:47:24 -0800 Subject: [PATCH] Don't init .auth object until .onLoad Creating the .auth object directly at the top-level means the code from gargle is snapshotted at build time. --- DESCRIPTION | 2 +- R/bq-auth.R | 7 +++---- R/zzz.R | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 45495e52..b133fa4b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: bigrquery Title: An Interface to Google's 'BigQuery' 'API' -Version: 1.3.2.9000 +Version: 1.3.2.9001 Authors@R: c( person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre"), comment = c(ORCID = "0000-0003-4757-117X")), diff --git a/R/bq-auth.R b/R/bq-auth.R index 58739fb6..79a01258 100644 --- a/R/bq-auth.R +++ b/R/bq-auth.R @@ -1,9 +1,8 @@ ## This file is the interface between bigrquery and the ## auth functionality in gargle. -.auth <- gargle::init_AuthState( - package = "bigrquery", - auth_active = TRUE -) + +# Initialization happens in .onLoad +.auth <- NULL ## The roxygen comments for these functions are mostly generated from data ## in this list and template text maintained in gargle. diff --git a/R/zzz.R b/R/zzz.R index 2e1b6abd..88e1ce6a 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,5 +1,10 @@ .onLoad <- function(libname, pkgname) { + .auth <<- gargle::init_AuthState( + package = "bigrquery", + auth_active = TRUE + ) + # S3 methods -------------------------------------------------------------- register_s3_method("dplyr", "collect", "tbl_BigQueryConnection") register_s3_method("dplyr", "db_analyze", "BigQueryConnection")