Skip to content

Conversation

@eddelbuettel
Copy link
Member

A simple extension to get the "API" version of the package out.

We have always have packageVersion("Rcpp") (or the earlier packageDescription("Rcpp")$Version) but as I keep increasing the 'dev version' during development, this leaks eg 1.0.1.2 right now when used by e.g. Rcpp.package.skeleton(). Which then bites potential users who would only have CRAN's 1.0.1 or older.

So I added two new #define statements for string versions in the usual config.h, plus a simple function to export to the R side -- where we turn it into package_version objects. Nothing major, but a little help.

@kevinushey This may also help for the RStudio package generator.

@eddelbuettel eddelbuettel requested a review from kevinushey April 26, 2019 02:23
@codecov-io
Copy link

codecov-io commented Apr 26, 2019

Codecov Report

Merging #963 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #963      +/-   ##
==========================================
+ Coverage   82.39%   82.48%   +0.09%     
==========================================
  Files          63       63              
  Lines        3158     3163       +5     
==========================================
+ Hits         2602     2609       +7     
+ Misses        556      554       -2
Impacted Files Coverage Δ
src/rcpp_init.cpp 100% <100%> (ø) ⬆️
src/api.cpp 93.1% <100%> (+0.42%) ⬆️
R/tools.R 100% <100%> (+22.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f4e64d...b35f1a8. Read the comment docs.

Copy link
Contributor

@kevinushey kevinushey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than 2 minor nitpicks.

R/tools.R Outdated
##' \code{\link{Rcpp.package.skeleton}}
##' @examples getRcppVersion()
getRcppVersion <- function(devel = FALSE) {
rcpp <- .Call("getRcppVersionStrings")[if(devel) 2 else 1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use .Call("getRcppVersionStrings", PACKAGE = "Rcpp") to ensure the symbol gets looked up directly in the Rcpp library?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Look at all the other .Call() we do -- it is not too consistent.

R/tools.R Outdated
##' @examples getRcppVersion()
getRcppVersion <- function(devel = FALSE) {
rcpp <- .Call("getRcppVersionStrings")[if(devel) 2 else 1]
.make_numeric_version(rcpp,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use package_version() here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I think I was looking inside that function and inadvertendly copied it, rather than calling it.

@eddelbuettel
Copy link
Member Author

@kevinushey All good?

@eddelbuettel eddelbuettel merged commit 3af3036 into master Apr 26, 2019
@eddelbuettel eddelbuettel deleted the feature/version_string branch April 27, 2019 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants