1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

Subprojects support

Summary:
X-link: https://github.com/facebookincubator/zstrong/pull/857

Where one project should be checked out in a subdirectory of another
project. Like git submodules.

This is how the Glean build currently works: hsthrift is a separate
git repo, but Glean builds with hsthrift checked out in a
subdirectory.

Reviewed By: chadaustin

Differential Revision: D58055066

fbshipit-source-id: 1a22abaa8c5261c40b752d685a03d01625215b12
This commit is contained in:
Simon Marlow
2024-06-03 16:10:36 -07:00
committed by Facebook GitHub Bot
parent a9cca47023
commit 75ca7ab807
3 changed files with 50 additions and 2 deletions

View File

@@ -587,6 +587,39 @@ class SimpleShipitTransformerFetcher(Fetcher):
return self.repo_dir
class SubFetcher(Fetcher):
"""Fetcher for a project with subprojects"""
def __init__(self, base, subs) -> None:
self.base = base
self.subs = subs
def update(self) -> ChangeStatus:
base = self.base.update()
changed = base.build_changed() or base.sources_changed()
for fetcher, dir in self.subs:
stat = fetcher.update()
if stat.build_changed() or stat.sources_changed():
changed = True
link = self.base.get_src_dir() + "/" + dir
if not os.path.exists(link):
os.symlink(fetcher.get_src_dir(), link)
return ChangeStatus(changed)
def clean(self) -> None:
self.base.clean()
for fetcher, _ in self.subs:
fetcher.clean()
def hash(self) -> None:
hash = self.base.hash()
for fetcher, _ in self.subs:
hash += fetcher.hash()
def get_src_dir(self):
return self.base.get_src_dir()
class ShipitTransformerFetcher(Fetcher):
@classmethod
def _shipit_paths(cls, build_options):