forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup: Use Bazel modules to enforce proper
#include
hygiene.
- Loading branch information
Showing
128 changed files
with
432 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e9e6e7baafe3cfe9b212ffb4f1ea8a8b48e2dc1ee4c07c6b1b0b04893b3b6464 /usr/local/bin/tox-bootstrapd | ||
af58a125e5c80d7a19bc7f32868c1edfdf80f366e3bf778728961a50ce63ee26 /usr/local/bin/tox-bootstrapd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env python3 | ||
import glob as py_glob | ||
import os | ||
import subprocess | ||
import sys | ||
from typing import Optional | ||
|
||
LIBS = {} | ||
|
||
|
||
def load(bzl: str, *syms: str) -> None: | ||
pass | ||
|
||
|
||
def exports_files(srcs: list[str], | ||
visibility: Optional[list[str]] = None) -> None: | ||
pass | ||
|
||
|
||
def cc_library(name: str, **kwargs: list[str]) -> None: | ||
LIBS[name] = kwargs | ||
|
||
|
||
def cc_test(name: str, **kwargs: list[str]) -> None: | ||
pass | ||
|
||
|
||
def cc_fuzz_test(name: str, **kwargs: list[str]) -> None: | ||
pass | ||
|
||
|
||
def select(selector: dict[str, list[str]]) -> list[str]: | ||
return selector["//tools/config:linux"] | ||
|
||
|
||
def glob(include: list[str]) -> list[str]: | ||
return [ | ||
f[len("toxcore/"):] for p in include | ||
for f in py_glob.glob(os.path.join("toxcore", p)) | ||
] | ||
|
||
|
||
def alias(name: str, actual: str, visibility: list[str]) -> None: | ||
pass | ||
|
||
|
||
def sh_library(name: str, **kwargs: list[str]) -> None: | ||
pass | ||
|
||
|
||
def main() -> None: | ||
with open("toxcore/BUILD.bazel", "r") as fh: | ||
exec(fh.read()) | ||
|
||
with open("module.modulemap", "w") as fh: | ||
for name, lib in LIBS.items(): | ||
fh.write("module " + name + " {\n") | ||
for hdr in lib["hdrs"]: | ||
fh.write(f' header "toxcore/{hdr}"\n') | ||
for dep in lib.get("deps", []): | ||
if dep[0] == ":": | ||
fh.write(f" use {dep[1:]}\n") | ||
fh.write("}\n") | ||
|
||
srcs = sorted( | ||
set( | ||
os.path.join("toxcore", src) for lib in LIBS.values() | ||
for src in lib.get("srcs", []))) | ||
for src in srcs: | ||
print(f"Validating {src}", file=sys.stderr) | ||
subprocess.run( | ||
[ | ||
"clang", | ||
"-xc++", | ||
"-fsyntax-only", | ||
"-Wall", | ||
"-Werror", | ||
"-Wno-missing-braces", | ||
"-std=c++23", | ||
"-fdiagnostics-color=always", | ||
"-fmodules", | ||
# TODO(iphydf): Fix all the other errors. | ||
# "-fmodules-strict-decluse", | ||
"-fmodules-decluse", | ||
"-fmodule-map-file=module.modulemap", | ||
src, | ||
], | ||
check=True, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM toxchat/c-toxcore:sources AS sources | ||
FROM alpine:3.19.0 | ||
|
||
RUN ["apk", "add", "--no-cache", \ | ||
"bash", \ | ||
"clang", \ | ||
"libconfig-dev", \ | ||
"libsodium-dev", \ | ||
"libvpx-dev", \ | ||
"linux-headers", \ | ||
"opus-dev", \ | ||
"pkgconfig", \ | ||
"python3"] | ||
|
||
WORKDIR /work | ||
COPY --from=sources /src/ /work/ | ||
|
||
COPY toxcore/BUILD.bazel /work/toxcore/ | ||
COPY other/docker/modules/check /work/other/docker/modules/ | ||
RUN ["other/docker/modules/check"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
BUILD=modules | ||
other/docker/sources/build | ||
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.