混合语言源目录布局

发布于 2024-07-13 01:38:36 字数 203 浏览 6 评论 0原文

我们正在运行一个使用多种不同语言的大型项目:Java、Python、PHP、SQL 和 Perl。

到目前为止,人们一直在自己的私有存储库中工作,但现在我们希望将整个项目合并到一个存储库中。 现在的问题是:目录结构应该是什么样的? 我们应该为每种语言设置单独的目录,还是应该按组件/项目将其分开? python/perl/java 处理公共目录布局的能力如何?

We are running a large project with several different languages: Java, Python, PHP, SQL and Perl.

Until now people have been working in their own private repositories, but now we want to merge the entire project in a single repository. The question now is: how should the directory structure look? Should we have separate directories for each language, or should we separate it by component/project? How well does python/perl/java cope with a common directory layout?

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

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

发布评论

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

评论(2

陌路黄昏 2024-07-20 01:38:36

我的经验表明这种布局是最好的:

mylib/
    src/
       java/
       python/
       perl/
       .../
    bin/
       java/
       python/
       perl/
    stage/
    dist/

src 是您的源代码,并且是唯一签入的内容。

bin 是构建期间发生“编译”的位置,并且未签入。

stage 是在构建过程中复制内容以准备打包的地方

dist 是放置构建工件的位置

我放置模块/组件/库在层次结构的顶部,因为我单独构建每个模块,并使用依赖项管理器根据需要组合它们。

当然,命名约定有所不同。 但我发现这个方法的效果相当令人满意。

My experience indicates that this kind of layout is best:

mylib/
    src/
       java/
       python/
       perl/
       .../
    bin/
       java/
       python/
       perl/
    stage/
    dist/

src is your source, and is the only thing checked in.

bin is where "compilation" occurs to during the build, and is not checked in.

stage is where you copy things during the build to prepare them for packaging

dist is where you put the build artifacts

I put the module/component/library at the top of the hierarchy, because I build every module separately, and use a dependency manager to combine them as needed.

Of course, naming conventions vary. But I've found this to work quite satisfactorily.

柠北森屋 2024-07-20 01:38:36

我认为最好的办法是确保您的各种模块不依赖于同一目录(即按组件分开)。 很多人似乎对这个想法非常害怕,但是一组好的构建脚本应该能够自动化消除任何痛苦。

最终目标是使基础设施的安装变得容易,然后在环境设置好后就可以轻松地在单个组件上工作。

(需要注意的是,我来自 Perl 和 CL 世界,我们将“模块”安装到某个全局位置,例如 ~/perl 或 ~/.sbcl,而不是像 Java 人员那样将每个模块包含在每个项目中。您可能认为这会是一个维护问题,但最终它不是一个定期更新 git 存储库(或 CPAN)中每个模块的脚本,这确实是最好的方法。)

编辑:一。更重要的是:

项目总是有外部依赖项。 我的项目需要 Postgres 和一个可用的 Linux 安装。 将其与版本控制中的应用程序代码捆绑在一起是疯狂的——但是在新工作站上进行所有设置的脚本非常有帮助。

我想我想说的是,也许以一种迂回的方式,我认为你不应该以不同于外部模块的方式对待你的内部模块。

I think the best thing to do would be to ensure that your various modules don't depend upon being in the same directory (i.e. separate by component). A lot of people seem to be deathly afraid of this idea, but a good set of build scripts should be able to automate away any pain.

The end goal would be to make it easy to install the infrastructure, and then really easy to work on a single component once the environment is setup.

(It's important to note that I come from the Perl and CL worlds, where we install "modules" into some global location, like ~/perl or ~/.sbcl, rather than including each module with each project, like Java people do. You'd think this would be a maintenance problem, but it ends up not being one. With a script that updates each module from your git repository (or CPAN) on a regular basis, it is really the best way.)

Edit: one more thing:

Projects always have external dependencies. My projects need Postgres and a working Linux install. It would be insane to bundle this with the app code in version control -- but a script to get everything setup on a fresh workstation is very helpful.

I guess what I'm trying to say, in a roundabout way perhaps, is that I don't think you should treat your internal modules differently from external modules.

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