使用存储库

发布于 2024-12-04 21:01:48 字数 147 浏览 0 评论 0原文

当使用存储库(我想到的是 github)时,我们还应该提交第三方库吗?例如,boost 和 poco 通过示例编译为 5G。我们应该将所有这些都上传到 github 吗?如果没有,那么我们如何使库与其他人保持同步?

抱歉,缺少大小写和语法。我用手机打字,很难打字。

When working with repos (I have github in mind), should we also commit third party libraries? For example, boost and poco compile to 5G with samples. Should we upload all that to github? If not, then how do we keep the libraries in sync with other people?

Sorry about lack of capitalization and grammar. I am on my phone and it is difficult to type.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

版本控制的第一条规则:永远不要将生成的资产提交到您的存储库。所以你绝对不应该将 Boost 和 Poco 的构建产品提交到你的存储库中。是否将依赖项作为源包含在存储库中实际上取决于您;这在某种程度上取决于您的项目、您需要多少依赖项、您的软件有多少公众可能可以轻松访问这些依赖项等。打包者和发行版通常希望您不要捆绑依赖项,而是相反在自述文件或安装文件中仔细提及它们。

如果您想让从 VCS 检查您的代码的人员轻松获取依赖项,请尝试使用 svn externals、git submodules 或 hg subrepos,这样可以轻松排除依赖项并建立到依赖项上游存储库的清晰链接。

First rule of version control: never commit generated assets to your repository. So you should definitely not commit build products of Boost and Poco to your repository. Whether to include dependencies in your repository as source is really up to you; it kind of depends on your project, how many dependencies you need, how much of the public for your software is likely to have easy access to those dependencies, etc. Packagers and distributions generally prefer that you don't bundle your dependencies, but instead carefully mention them in a README or INSTALL file.

If you want to make it easy to get the dependencies for people who check your code from a VCS, try to use svn externals, git submodules or hg subrepos, making it easy to exclude the dependencies and establish a clear link to the dependency's upstream repository.

木森分化 2024-12-11 21:01:48

首先,是否使用 Maven 并不重要。没关系。

现在,我已经解决了这个问题,我建议您使用 Maven 存储库管理器,例如 NexusArtifactory

Artifactory 和 Nexus 所做的是为第三方库创建一个网络范围的存储库结构。

您可以使用标准 wgetcurl 命令轻松下载发布存储库中的任何工件。如果您使用 Ant,则可以使用 Ivy 来管理您的工件。如果您使用 Maven,那么一切就都准备好了。这意味着您可以直接在构建脚本中编写所需第三方库的下载脚本。

发布存储库也可用于您的第三方库。您是否制作了您的其他项目使用的基础库?您可以使用相同的发布和下载机制来使编译的对象可供系统使用。

签入第三方库会导致以下问题:

  • 提交通常是逐个项目完成的。这意味着,如果您有多个项目依赖于第三方 foo 库,则 foo 很可能位于存储库中的两个不同位置。
  • 您将丢失有关 foo 的信息。你不会记得它是哪个版本的 foo 。在过去的十年里,我一直是 java 项目的构建工程师,在每个项目中,我们都有一些来自 Foo 项目的 foo.jar,但没有一个开发人员知道它是版本 1.3、2.5 还是 4.5。我们不知道 Foo 项目是否支持这个旧版本,或者我们是否得到了有缺陷的 1.3,并且应该在 Hoover 政府中升级到版本 1.4。
  • 二进制文件占用源存储库中的大量空间。每次提交新版本时,都会有更多空间。而且,它会给你带来什么回报?不多。您无法对其进行比较以查看先前版本中发生了什么更改。结账可能要花很长时间而且没有任何回报。
  • 许多源存储库不允许您删除第三方程序的过时版本。我不会提及任何名字(咳!Subversion!咳!),但我见过大小为 100 到 200 GB 的存储库,而且它几乎只是第三方库的过时版本。

顺便说一句,您从未提到过您的编程平台。如果您使用 Ruby、Php 或 Perl,则可以使用它们内置的存储库系统(分别为 Gem、Pear 和 CPAN),并且无需担心配置发布存储库。

First, it doesn't matter if you're using Maven or not. It doesn't matter.

Now, that I have that out of the way, I suggest you use a Maven repository manager like Nexus or Artifactory.

What Artifactory and Nexus do is create a network wide repository structure for third party libraries.

You can easily download any artifact in your release repository with the standard wget or curl commands. If you use Ant, you can use Ivy to manage your artifacts. If you use Maven, well, you're all set. That means you can script the download of the required third party libraries right in your build scripts.

A release repository can also be used for your third party libraries. Do you produce a base library that other projects of yours use? You can use the same release and download mechanism to make your compiled objects available to your system.

Checking in your third party libraries in causes the following issues:

  • The commits are usually done on a project-by-project basis. That means if you have more than one project that depends upon the third party foo library, chances are you'll have foo located in two different places in your repository.
  • You will lose information about foo. You won't remember which version of foo it was. I've been a build engineer for java projects for the last decade, and in every project we have some foo.jar from the Foo project, and none of the developers know whether it is verison 1.3, 2.5, or 4.5. We have no idea if the Foo project even supports this older version or if we got the buggy 1.3 and should have upgraded to version 1.4 back in the Hoover administration.
  • Binaries take up lots of room in your source repository. Every time you commit a new version, it's even more room. And, what does it get you in return? Not much. You can't diff it to see what was changed in the previous version. Checkouts can take forever with no benefit in return.
  • Many source repositories won't allow you to remove obsolete versions of your third party programs. I won't mention any names (cough! Subversion! cough!), but I've seen repositories that are 100 to 200 gigabytes in size, and it's almost nothing but obsolete versions of third party libraries.

By the way, you never mentioned your programming platform. If you are using Ruby, Php, or Perl, you can use their built in repository system (Gem, Pear, and CPAN respectively) and you won't need to worry about configuring release repositories.

鱼窥荷 2024-12-11 21:01:48

我喜欢这些第三方库可以通过 git 获得,并且我可以将它们作为子模块包含在我的项目中。我非常喜欢这样。使更新变得轻而易举。

如果这是不可能的,那么是的,我将他们的代码包含在我的存储库中。最终,我将把我的生产分支移交给我的运营人员,以推送到生产服务器,因此它需要拥有运行所需的所有货物。这可能与您的工作流程不同,但这就是我的工作流程。

I like it when those third party libraries are available via git, and I can include them in my project as submodules. I like that a lot. Makes pulling in updates a total piece of cake.

When that's not possible, then yeah, I include their code right in my repo. Ultimately, I'm going to turn my production branch over to my operations people to push to the production server, so it needs to have all the goods needed to run. That may be a different workflow than yours, but that's how mine works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文