Add really basic Bazel support.

This commit is contained in:
Jelmer Vernooij 2021-04-25 13:32:32 +01:00
parent e1c5258bca
commit 126d06c332
2 changed files with 31 additions and 0 deletions

View file

@ -38,6 +38,7 @@ issues (or lack of support for a particular ecosystem), please file a bug.
### Supported Build Systems
- Bazel
- Cabal
- Cargo
- Golang

View file

@ -544,6 +544,35 @@ class SetupPy(BuildSystem):
return cls(path)
class Bazel(BuildSystem):
name = "bazel"
def __init__(self, path):
self.path = path
def __repr__(self):
return "%s(%r)" % (type(self).__name__, self.path)
@classmethod
def exists(cls, path):
if not os.path.exists(os.path.join(path, "BUILD")):
return False
return True
@classmethod
def probe(cls, path):
if cls.exists(path):
logging.debug("Found BUILD, assuming bazel package.")
return cls(path)
def build(self, session, resolver, fixers):
run_with_build_fixers(session, ["bazel", "build", "//..."], fixers)
def test(self, session, resolver, fixers):
run_with_build_fixers(session, ["bazel", "test", "//..."], fixers)
class Octave(BuildSystem):
name = "octave"
@ -1542,6 +1571,7 @@ BUILDSYSTEM_CLSES = [
Golang,
R,
Octave,
Bazel,
# Make is intentionally at the end of the list.
Make,
Composer,