erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Support for including all files under version control in the created package #327

Open tothlac opened 1 year ago

tothlac commented 1 year ago

We are in the middle of moving all of our repositories from our internal bitbucket server to our internal hex server, because we want to use semver versioning for the dependencies.

Our problem is that we have lots of repositories, and in some of them there are files stored in special folders. I'm afraid that we will forget about these special directories, then it will cause a problem not in the build of the current repository but in some other projects using this repo as a dependency.

I was thinking of adding --inclulde_all_vcs=true command line option to rebar3 hex build, so in this case all files under version control will be copied into the generated package, but nothing else... Only those files.

I'm aware of the fact, this way some unnecessary files will be included as well, for instance the entire test directory, which can potentially contain huge amount of testing related data. For that we can use an exclude_paths option in rebar.config, like this:

{hex, [
   {exclude_paths, ["test", ...]},
   {repos, [
   ]}
]}.

In the initial version maybe I would like to support only git, svn, and some others.... Of course it would not change the default behaviour of the plugin, because using it without the --include_all_vcs option it would work entirely the same way.

What is your opinion about this?

tothlac commented 1 year ago

We can also use the exclude_files option already used in the app.src file.

starbelly commented 1 year ago

I'm not sure, I need to think on this a bit. While it seems to solve a problem, it feels a bit niche and can ultimately be haphazard.

Have you thought about using include_paths to solve your problem? You'll have to be diligent, if you will, about keeping exclude_paths up to date, so why not use include_paths coupled with building the package and inspecting the contents before a publish?