Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create src/init.c for skeleton #692

Merged
merged 1 commit into from
May 10, 2017
Merged

Conversation

eddelbuettel
Copy link
Member

This lets Rcpp.package.skeleton() create src/init.c (by making the required call).

Should compileAttributes() do that too?

@jjallaire
Copy link
Member

Yes I think compileAttributes should do this as well, however I think it should also insert a preamble (similar to it's other auto-generated files) so that if the user creates their own src/init.c then we don't overwrite it.

@eddelbuettel
Copy link
Member Author

I think I agree. And if/when it does, we need to remove it from here as well.

Also need to add .registration=TRUE to NAMESPACE as this PR does.

@codecov-io
Copy link

Codecov Report

Merging #692 into master will decrease coverage by 0.05%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #692      +/-   ##
==========================================
- Coverage   89.77%   89.72%   -0.06%     
==========================================
  Files          66       66              
  Lines        3511     3523      +12     
==========================================
+ Hits         3152     3161       +9     
- Misses        359      362       +3
Impacted Files Coverage Δ
R/Rcpp.package.skeleton.R 83.73% <73.33%> (-0.04%) ⬇️
R/RcppClass.R 77.01% <0%> (-1.15%) ⬇️

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 abea6f2...fb27ed3. Read the comment docs.

@eddelbuettel
Copy link
Member Author

eddelbuettel commented May 10, 2017

@jjallaire I only glanced at src/attributes.cpp and R/Attributes.R and I am not sure how we can reuse.
Or should we just duplicate as

 looking for token 
 if not found
      abort 
 else 
      write token 
      append output from `tools::package_native_....()` 

@jjallaire
Copy link
Member

I can take a look sometime later this week or next. The biggest issue I see is that if users have a file other than init.c which includes a package initialization function we'll be adding another one (which will break their compilation). Note this will happen on their local system rather than on CRAN so it's recoverable, but still ugly. Another possibility would be to scan for package init functions as part of our normal scanning and then only write init.c if there is no package init function.

@eddelbuettel
Copy link
Member Author

Point well taken on files not-named init.c. We may well have to scan then. OTOH the good news is that I have been relying on the tools::package_native_routine_registration_skeleton() function for several months now with many uploads, and it just works. So this doesn't seem unsurmountable. Wish I had thought of this fairly clean way of integrating things earlier.

@eddelbuettel
Copy link
Member Author

I'll fold this to tick off another micro-issue.

@eddelbuettel eddelbuettel merged commit 4e0f79c into master May 10, 2017
@eddelbuettel eddelbuettel deleted the feature/init_c_in_skeleton branch May 10, 2017 11:17
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.

None yet

4 participants