thinhong / denim

R package for discrete model
https://thinhong.github.io/denim/
Other
2 stars 1 forks source link

src folder #9

Closed choisy closed 2 years ago

choisy commented 3 years ago

I see many files that seem to be identical in here and here. This looks like a bad practice and copy-paste in a code. How do you manage to maintain these 2 sets of identical files in parallel? Do you update C++ code only in the cpp_training repo and then have some sort of automatic copying of the files you need from this repo to the discreteModel repo? Is there a reason you want to keep this 2 repos separate?

thinhong commented 3 years ago

Thanks for introducing me about this feature. I've read somewhere that we could link two github repos but couldn't try it here because Rcpp cannot compile files in subfolders of the src folder, for example the src/Distribution or src/muParser, so I have to take them out and edit the path in other files when they need to load these files (all C++ code in the discreteModel are not stored in subfolders).

I still want to keep them in subfolder (src/Distribution or src/muParser) in the cpp_training to look more organized so I copied them manually. But yeah this is definitely a bad practice.

choisy commented 3 years ago

Using devtools you can specify that there are scripts you want to run before building your R package (as stated here). So, what you can do with such a script is fetching the C++ codes you need from cpp_training repository, and place them where they need to be in your R package files hierarchy. Have a look at what's available from devtools then.

choisy commented 3 years ago

After thinking about this, I think that in this directory, you should simple include a script that automatically copy and paste the script you need from the C++ repo into here. And then you just do a commit each time you do so. Don't forget to exclude this script from your package. This should can be specified in a .Rbuildignore file that you can generate with use this::use_build_ignore().

thinhong commented 3 years ago

Thanks Marc, I will try to do it

choisy commented 3 years ago

Be more positive Thinh-oiii!!! You will do it! If you're blocked, ask me.