victorbjorklund
Specify which parts of library to compile or not
I’m going to try to build a library (that I can hopefully publish) that allows access to statistics reports from the Swedish Statistics Authority. Basically they have a bunch of statistics data but the issue is they use very weird API:s for accessing them so I wanna provide a more easy way to get the data by wrapping the api:s in a nice library.
However they have a lot of reports and data so I will probably have to write a module per report. And it seems a bit wasteful to include all (I’m not sure how many reports in total they got but wouldn’t be surprised if it is over 500) for a project that just wanna access how the population size of each municipality.
I get that it might be hard/impossible to “tree-shake” since code can be called dynamically at runtime but can I provide a way to for example specify in the config which reports they want to actually use? Something like this:
config :scb_ex,
reports: [:municipality_population]
Most Liked
al2o3cr
There was just a post on the Dashbit blog arguing for smaller SDK surfaces:
Are the many reports different enough to need different code?
arcyfelix
I guess you could hack it by slightly changing your approach.
Instead of a single mix project, you can have a single umbrella project and your modules will become small libraries.
You can control what has access to what with Boundary — boundary v0.10.3 to provide a meaningful error when one “module/report” depends on another that is not compiled (strongly advised against it).
Or you can extract these common pieces to the Core which is exposed to all Reports.







