Skip to content

Commit

Permalink
Merge pull request #222 from plotly/212-untangle-dashr-build
Browse files Browse the repository at this point in the history
Relocate metadata fixup logic from config.yml to R script
  • Loading branch information
rpkyle authored Aug 4, 2020
2 parents 3ca561b + f1b81d6 commit 4d234cb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Makefile
announcement\.Rmd
todo\.txt
.github
tests/integration
tests/circleci
36 changes: 36 additions & 0 deletions tests/circleci/fixup_metadata.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# this script uses regex to edit the DESCRIPTION file within each of the Dash core
# packages as required to test bleeding edge builds
#
# to avoid spurious versioning errors, we loosen the version restriction here so
# that it is >= rather than the == format currently applied to release packages for
# testing purposes only

# capture DESCRIPTION data for dash, dashTable, dashCoreComponents, dashHtmlComponents
dash_desc <- read.dcf("dashR/DESCRIPTION")
dt_version <- read.dcf("dash-table/DESCRIPTION")[,"Version"]
dcc_version <- read.dcf("dash-core-components/DESCRIPTION")[,"Version"]
dhc_version <- read.dcf("dash-html-components/DESCRIPTION")[,"Version"]

# capture Imports data for dashTable, dashCoreComponents, dashHtmlComponents
imports <- dash_desc[,"Imports"][[1]]

# loosen version restriction to prevent versioning errors at release time,
# edit the Imports section of dash's DESCRIPTION as required, then update dash_desc
imports <- gsub("==", ">=", imports, perl=TRUE)

dash_desc[,"Imports"][[1]] <- imports

# obtain the latest commit hash for dashTable, dashCoreComponents, dashHtmlComponents, and save
dhc_hash <- system("cd dash-html-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE)
dcc_hash <- system("cd dash-core-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE)
dt_hash <- system("cd dash-table; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE)
remotes <- dash_desc[,"Remotes"][[1]]

# edit the Remotes section of dash's DESCRIPTION as required to update hashes, update dash_desc
remotes <- gsub("((?<=plotly\\\\/dash-html-components@)([a-zA-Z0-9]+))", dhc_hash, remotes, perl=TRUE)
remotes <- gsub("((?<=plotly\\\\/dash-core-components@)([a-zA-Z0-9]+))", dcc_hash, remotes, perl=TRUE)
remotes <- gsub("((?<=plotly\\\\/dash-table@)([a-zA-Z0-9]+))", dt_hash, remotes, perl=TRUE)
dash_desc[,"Remotes"][[1]] <- remotes

# write the updated DESCRIPTION back to the dash package directory for installation
write.dcf(dash_desc, "dashR/DESCRIPTION")

0 comments on commit 4d234cb

Please sign in to comment.