1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00
semantic/build/common.bzl
2020-06-25 10:14:54 -04:00

73 lines
2.2 KiB
Python

# This file lets us share warnings and such across the project
load(
"@rules_haskell//haskell:defs.bzl",
"haskell_library",
"haskell_test",
)
STANDARD_GHC_WARNINGS = [
"-O0",
"-v1",
"-j8",
"-fdiagnostics-color=always",
"-ferror-spans",
"-Weverything",
"-Wno-missing-local-signatures",
"-Wno-missing-import-lists",
"-Wno-implicit-prelude",
"-Wno-safe",
"-Wno-unsafe",
"-Wno-name-shadowing",
"-Wno-monomorphism-restriction",
"-Wno-missed-specialisations",
"-Wno-all-missed-specialisations",
"-Wno-star-is-type",
"-Wno-missing-deriving-strategies",
]
STANDARD_EXECUTABLE_FLAGS = [
"-threaded",
]
def semantic_language_library(language, name, srcs, nodetypes = "", **kwargs):
"""Create a new library target with dependencies needed for a language-AST project."""
if nodetypes == "":
nodetypes = language
haskell_library(
name = name,
# We can't use Template Haskell to find out the location of the
# node-types.json files, but we can pass it in as a preprocessor
# directive.
compiler_flags = STANDARD_GHC_WARNINGS + [
'-DNODE_TYPES_PATH="../../../../$(rootpath //vendor:' + nodetypes + '-node-types.json)"',
],
srcs = srcs,
extra_srcs = ["//vendor:" + nodetypes + "-node-types.json"],
deps = [
"//:base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core:lib",
"//semantic-proto:lib",
"//semantic-scope-graph:lib",
"//semantic-source:lib",
"//semantic-tags:lib",
"@stackage//:aeson",
"@stackage//:algebraic-graphs",
"//:containers",
"@stackage//:fused-effects",
"@stackage//:fused-syntax",
"@stackage//:generic-lens",
"@stackage//:generic-monoid",
"@stackage//:hashable",
"@stackage//:lens",
"@stackage//:pathtype",
"@stackage//:semilattices",
"@stackage//:template-haskell",
"@stackage//:text",
"@stackage//:tree-sitter",
"@stackage//:tree-sitter-" + language,
],
)