-->

How can I synchronize closed and open sourced vers

2019-07-15 03:10发布

问题:

I have a tool I would like to release the source to. However, a few features cannot be released as open source parts because of licensing restrictions. I'd like to generally develop the tool itself using the open source version of the code, but at each release I need to port the few features in the closed version back into the build for a particular client.

I can't just use a normal branch for this, because that would put the closed source bits into the same repository as where I'd like to share the open code (in this case, Bitbucket).

Is there anything I can do or am I stuck with manually moving source around?

回答1:

Can you segregate the secret bits into plugins/addons (something that can be enabled by build or runtime configuration) and split the codebase into two repositories, one for the open source edition (and also the base for the closed-source edition), and one for the closed-source additions?

This way, the closed-source build would still use the same repository, but add some extra stuff from the secret second code base. The build process would be similar to the one for an external upstream library.



回答2:

You would have 2 repositories, one containing all the closed source, and one containing all the open.

In your closed source repository, you would pull in all the changes from the open source repository, and merge with the closed source.

This should work without problems unless you have to implement some parts different in the two, then you will have merge conflicts in those areas when you merge in your changes.