1load("@dependencies//:requirements.bzl", "requirement")
2
3package(default_visibility = ["//visibility:public"])
4
5cc_binary(
6    name = "lua_engine",
7    srcs = [
8        "lua_engine.cc",
9        "lua_engine.h",
10    ],
11    copts = [
12        "-fPIC",
13        "-Wall",
14        "-Wextra",
15        "-O2",
16    ],
17    data = ["json.lua"],
18    linkopts = ["-ldl"],
19    linkshared = True,
20    deps = ["@lua//:lua_library"],
21)
22
23cc_library(
24    name = "lua_engine_library",
25    srcs = ["lua_engine.cc"],
26    hdrs = ["lua_engine.h"],
27    data = ["json.lua"],
28    deps = ["@lua//:lua_library"],
29)
30
31filegroup(
32    name = "publisher_jsons",
33    srcs = glob(["data/**"]),
34)
35
36filegroup(
37    name = "templates",
38    srcs = glob(["templates/**"]),
39)
40
41filegroup(
42    name = "static_files",
43    srcs = glob(["static/**"]),
44)
45
46py_library(
47    name = "server_lib",
48    srcs = ["app.py"],
49    data = [
50        ":lua_engine",
51        ":publisher_jsons",
52        ":static_files",
53        ":templates",
54    ],
55    srcs_version = "PY3ONLY",
56    deps = [requirement("Flask")],
57)
58
59py_binary(
60    name = "server",
61    srcs = ["app.py"],
62    data = [
63        ":lua_engine",
64        ":publisher_jsons",
65        ":static_files",
66        ":templates",
67    ],
68    main = "app.py",
69    srcs_version = "PY3ONLY",
70    deps = [requirement("Flask")],
71)
72