我应该如何管理C或C ++开源项目中的依赖项?

时间:2022-06-24 07:15:18

I've got a few open source applications. These depend on a few third party components, notably Crypto++ and Boost. There are a couple of options to take:

我有一些开源应用程序。这些依赖于一些第三方组件,特别是Crypto ++和Boost。有几种选择:

  • Put third party code into version control, and include it with distributions of my code. On one hand, this is the easiest for people to use because they can compile directly out of my source control repository. On the other, they might be wasting bandwidth downloading source they already have, or end up having to fight with my library in order to remove the third party bits. Furthermore, source control tools often have trouble dealing with massive libraries like Boost.
  • 将第三方代码放入版本控制中,并将其包含在我的代码分发中。一方面,这是最容易使用的人,因为他们可以直接从我的源代码控制库中编译。另一方面,他们可能正在浪费他们已经拥有的带宽下载源,或者最终不得不与我的库进行斗争才能删除第三方位。此外,源代码控制工具在处理像Boost这样的大型库时经常遇到麻烦。

  • Don't include third party code at all. This forces people to go out of their way to be able to use my library. On the other hand it means my source control repository and distributions will be small.
  • 根本不包括第三方代码。这迫使人们竭尽全力使用我的图书馆。另一方面,这意味着我的源代码控制存储库和分发将很小。

  • Something I have not yet anticipated.
  • 我尚未预料到的东西。

What should I do?

我该怎么办?

Note: I'm not working in an environment where reliance on a dependency mapper like aptitude, apt-get, or yum are acceptable.

注意:我不是在可以接受依赖aptitude,apt-get或yum等依赖映射器的环境中工作。

4 个解决方案

#1


6  

Option 3: Don't include it in your code distribution but instead include a (link to a) download, which should match the most recent version you support.
Also, explicitly list your dependencies and the most recent versions you support.

选项3:不要将其包含在代码分发中,而是包含(链接到a)下载,该下载应与您支持的最新版本匹配。此外,明确列出您的依赖项和您支持的最新版本。

This allows users to do however they want. Want your code with dependencies? Load both from one source. Want only part of the dependencies because you have the others? Load part of them. Want only your code? Load it seperately.

这允许用户按照自己的意愿行事。想要你的代码有依赖吗?从一个来源加载。只想要部分依赖项,因为你拥有其他依赖项?加载部分内容。只想要你的代码吗?单独加载它。

Option 4: Offer 2 versions, one including the dependencies and the other without but combined with option 3 above.

选项4:提供2个版本,一个包括依赖项,另一个版本没有,但与上面的选项3相结合。

#2


2  

I suggest Autoconf which was designed to abstract these worries away from you.

我建议Autoconf旨在将这些担忧从你身上抽走出来。

I doubt you can be expected to maintain build scripts for all of your dependencies across all platforms. Another problem with keeping 3rd party code in your svn is that now you also need to track down their dependencies and so on.

我怀疑你可以期望在所有平台上维护所有依赖项的构建脚本。在您的svn中保留第三方代码的另一个问题是,现在您还需要跟踪它们的依赖关系等等。

#3


0  

I think its a good idea to have dependencies in the SVN. That way developers can simply check-out and compile. Also you avoid the problem with different incompatible versions of your dependencies.

我认为在SVN中拥有依赖关系是一个好主意。这样开发人员可以简单地签出和编译。您还可以避免使用不同的依赖项不兼容版本的问题。

If you put the dependencies in a separate folder then developers can choose not to check-out your dependencies if they alrdy have them...

如果您将依赖项放在一个单独的文件夹中,那么开发人员可以选择不签出依赖项,如果他们有这些依赖项...

#4


0  

If you have a good package manager, than I would definitely not include dependencies in your repository. If you list the dependencies, it should be pretty easy for someone compiling it to get them from the repos.

如果你有一个好的包管理器,那么肯定不会在你的存储库中包含依赖项。如果列出依赖项,那么编译它的人应该很容易从repos中获取它们。

If you wanted to, you could include all of the dependencies as an additional download if you wanted to. But mixing them in with the code your working is generally not a good idea.

如果您愿意,可以将所有依赖项作为附加下载包含在内。但是将它们与你工作的代码混合起来通常不是一个好主意。

#1


6  

Option 3: Don't include it in your code distribution but instead include a (link to a) download, which should match the most recent version you support.
Also, explicitly list your dependencies and the most recent versions you support.

选项3:不要将其包含在代码分发中,而是包含(链接到a)下载,该下载应与您支持的最新版本匹配。此外,明确列出您的依赖项和您支持的最新版本。

This allows users to do however they want. Want your code with dependencies? Load both from one source. Want only part of the dependencies because you have the others? Load part of them. Want only your code? Load it seperately.

这允许用户按照自己的意愿行事。想要你的代码有依赖吗?从一个来源加载。只想要部分依赖项,因为你拥有其他依赖项?加载部分内容。只想要你的代码吗?单独加载它。

Option 4: Offer 2 versions, one including the dependencies and the other without but combined with option 3 above.

选项4:提供2个版本,一个包括依赖项,另一个版本没有,但与上面的选项3相结合。

#2


2  

I suggest Autoconf which was designed to abstract these worries away from you.

我建议Autoconf旨在将这些担忧从你身上抽走出来。

I doubt you can be expected to maintain build scripts for all of your dependencies across all platforms. Another problem with keeping 3rd party code in your svn is that now you also need to track down their dependencies and so on.

我怀疑你可以期望在所有平台上维护所有依赖项的构建脚本。在您的svn中保留第三方代码的另一个问题是,现在您还需要跟踪它们的依赖关系等等。

#3


0  

I think its a good idea to have dependencies in the SVN. That way developers can simply check-out and compile. Also you avoid the problem with different incompatible versions of your dependencies.

我认为在SVN中拥有依赖关系是一个好主意。这样开发人员可以简单地签出和编译。您还可以避免使用不同的依赖项不兼容版本的问题。

If you put the dependencies in a separate folder then developers can choose not to check-out your dependencies if they alrdy have them...

如果您将依赖项放在一个单独的文件夹中,那么开发人员可以选择不签出依赖项,如果他们有这些依赖项...

#4


0  

If you have a good package manager, than I would definitely not include dependencies in your repository. If you list the dependencies, it should be pretty easy for someone compiling it to get them from the repos.

如果你有一个好的包管理器,那么肯定不会在你的存储库中包含依赖项。如果列出依赖项,那么编译它的人应该很容易从repos中获取它们。

If you wanted to, you could include all of the dependencies as an additional download if you wanted to. But mixing them in with the code your working is generally not a good idea.

如果您愿意,可以将所有依赖项作为附加下载包含在内。但是将它们与你工作的代码混合起来通常不是一个好主意。