Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ooz compression code has undefined behavior that manifests under -O2 with Clang.
build --host_compilation_mode=dbg
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.6.0
17 changes: 10 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
*
!.bazelrc
!.bazelversion
!BUILD.bazel
!MODULE.bazel
!MODULE.bazel.lock
!third_party
!patcher
!web/main.py
!web/pobgen.py
!web/pobgen_en.py
!web/nebuloch/*.py
!web/nebuloch/data/*
!web/templates/*
!patcher
patcher/Content.ggpk.d
patcher/out
patcher/bin
patcher/scripts/__pycache__
patcher/scripts/ninja_syntax.py
patcher/schema.min.json
patcher/build.ninja
patcher/.ninja_log
patcher/Content.ggpk.d
patcher/venv
patcher/out
42 changes: 20 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,38 @@ on:
pull_request:
name: test

defaults:
run:
working-directory: patcher

jobs:
patcher-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.14.0
with:
go-version: 1.x
- run: go test -v ./...
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- run: bazel test //patcher/...

web-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: sudo apt-get install -y ninja-build cmake libsodium-dev libunistring-dev
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.14.0
with:
go-version: 1.x
- uses: actions/setup-python@v2
with:
python-version: 3.x
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- run: python -m pip install virtualenv meson

- run: ./install.sh
- run: ./main.sh
- run: ./release.sh
- run: bash fetch.sh
working-directory: patcher
- run: bash main.sh
working-directory: patcher
- run: bash release.sh
working-directory: patcher

- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: python -m pip install -r requirements.txt -r test-requirements.txt
working-directory: web
- run: python -m pytest tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bazel-*
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Root BUILD file
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
FROM docker.io/alpine:latest AS patcher
FROM gcr.io/bazel-public/bazel:8.6.0 AS patcher

WORKDIR /patcher
COPY patcher /patcher
RUN apk add --no-cache python3 py3-virtualenv go build-base git curl bash samurai \
meson cmake pkgconfig libsodium-dev libunistring-dev
RUN ./install.sh
RUN ./main.sh
WORKDIR /build
COPY --chown=ubuntu . /build
RUN cd patcher && bash fetch.sh
RUN cd patcher && bash main.sh


FROM docker.io/alpine:latest as web
Expand All @@ -16,6 +14,6 @@ ENV PYTHONUNBUFFERED True

WORKDIR /web
COPY web /web
COPY --from=patcher /patcher/out/release /web/nebuloch/data
COPY --from=patcher /build/patcher/out/release /web/nebuloch/data

CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
76 changes: 76 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module(
name = "void-battery",
version = "0.0.0",
)

bazel_dep(name = "toolchains_chromium", version = "0.0.1")
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "libsodium", version = "1.0.19")
bazel_dep(name = "simde", version = "0.8.2")
bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "gazelle", version = "0.47.0")
bazel_dep(name = "ooz", version = "0")
bazel_dep(name = "libunistring", version = "1.3")
bazel_dep(name = "rules_python", version = "1.9.0")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "gamedata", version = "0")

git_override(
module_name = "toolchains_chromium",
remote = "https://github.com/afq984/toolchains_chromium.git",
commit = "1a93deae0f654933afe585749d35b7ef82d89bd8",
)

git_override(
module_name = "ooz",
remote = "https://github.com/zao/ooz.git",
commit = "6307b387e45c6b2283d622d82d2713a38e25e503",
build_file = "//third_party:ooz.BUILD",
init_submodules = False,
patches = ["//third_party/patches:ooz_add_module.patch"],
patch_strip = 0,
)

archive_override(
module_name = "libunistring",
urls = ["https://mirrors.kernel.org/gnu/libunistring/libunistring-1.3.tar.gz"],
sha256 = "8ea8ccf86c09dd801c8cac19878e804e54f707cf69884371130d20bde68386b7",
strip_prefix = "libunistring-1.3",
build_file = "//third_party:libunistring.BUILD",
patches = ["//third_party/patches:libunistring_bazel.patch"],
patch_strip = 1,
patch_cmds = [
# Generate public headers from .in.h templates.
# All @...@ substitutions are DLL_VARIABLE markers, empty on Linux.
"for f in lib/unistr.in.h lib/unicase.in.h lib/unitypes.in.h lib/uninorm.in.h lib/unictype.in.h lib/unistring/woe32dll.in.h; do sed -e 's/@HAVE_UNISTRING_WOE32DLL_H@/0/g' -e 's/@[A-Za-z0-9_]*@//g' \"$f\" > \"${f%.in.h}.h\"; done",
# Generate unistring/stdint.h (just wraps system <stdint.h>).
"echo '#include <stdint.h>' > lib/unistring/stdint.h",
# special-casing.in.h is identical to special-casing.h for our purposes.
"cp lib/unicase/special-casing.in.h lib/unicase/special-casing.h",
],
)

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//patcher:go.mod")
use_repo(
go_deps,
"com_github_google_go_cmp",
"com_github_pierrec_lz4_v4",
"com_github_spf13_pflag",
"org_golang_x_text",
)

local_path_override(
module_name = "gamedata",
path = "third_party/empty_gamedata",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.12")

chromium = use_extension("@toolchains_chromium//:extensions.bzl", "chromium")
chromium.toolchain()
use_repo(chromium, "chromium_toolchain")

register_toolchains("@chromium_toolchain//:all")
Loading
Loading