Add Bazel build scripts

This commit is contained in:
Dietrich Epp 2022-03-22 18:11:02 -04:00
parent 3d8bf3721e
commit 094f2c5016
7 changed files with 100 additions and 1 deletions

16
.bazelrc Normal file
View File

@ -0,0 +1,16 @@
build --incompatible_enable_cc_toolchain_resolution
build --define=warnings=off
build:asan --strip=never
build:asan --copt=-fsanitize=address
build:asan --copt=-g
build:asan --copt=-O1
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt=-fsanitize=address
try-import %workspace%/.user.bazelrc
build --copt=-fdiagnostics-color
build --host_copt=-fdiagnostics-color
build --host_copt=-UNDEBUG

3
.gitignore vendored
View File

@ -1 +1,2 @@
/convert_test
/.user.bazelrc
/bazel-*

3
BUILD.bazel Normal file
View File

@ -0,0 +1,3 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
gazelle(name = "gazelle")

44
WORKSPACE Normal file
View File

@ -0,0 +1,44 @@
workspace(name = "syncfiles")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
go_repository(
name = "org_golang_x_text",
importpath = "golang.org/x/text",
sum = "h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=",
version = "v0.3.5",
)
# go_repository(
# name = "org_golang_x_tools",
# importpath = "golang.org/x/tools",
# sum = "h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc=",
# version = "v0.0.0-20180917221912-90fa682c2a6e",
# )
go_rules_dependencies()
go_register_toolchains(version = "1.18")
gazelle_dependencies()

15
gen/BUILD.bazel Normal file
View File

@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
go_binary(
name = "macscript",
srcs = [
"data.go",
"main.go",
"rez.go",
"scriptmap.go",
],
deps = [
"//gen/charmap",
"//gen/table",
],
)

8
gen/charmap/BUILD.bazel Normal file
View File

@ -0,0 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "charmap",
srcs = ["charmap.go"],
importpath = "moria.us/macscript/charmap",
visibility = ["//gen:__subpackages__"],
)

12
gen/table/BUILD.bazel Normal file
View File

@ -0,0 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "table",
srcs = ["table.go"],
importpath = "moria.us/macscript/table",
visibility = ["//gen:__subpackages__"],
deps = [
"//gen/charmap",
"@org_golang_x_text//unicode/norm:go_default_library",
],
)