mirror of
https://github.com/github/semantic.git
synced 2025-01-05 22:28:10 +03:00
Create a macro to define language packages quickly.
This commit is contained in:
parent
2da2f61f1e
commit
cac967e87f
@ -1,5 +1,12 @@
|
||||
# This file lets us share warnings and such across the project
|
||||
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_library",
|
||||
"haskell_test",
|
||||
"haskell_toolchain_library",
|
||||
)
|
||||
|
||||
STANDARD_GHC_WARNINGS = [
|
||||
"-O0",
|
||||
"-v1",
|
||||
@ -23,3 +30,36 @@ STANDARD_GHC_WARNINGS = [
|
||||
STANDARD_EXECUTABLE_FLAGS = [
|
||||
"-threaded",
|
||||
]
|
||||
|
||||
def semantic_language_library(language, name, srcs, **kwargs):
|
||||
haskell_library(
|
||||
name = name,
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
srcs = srcs,
|
||||
extra_srcs = ["//vendor:" + language + "-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",
|
||||
"@stackage//: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,
|
||||
],
|
||||
)
|
||||
|
@ -23,7 +23,7 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
# Not using semantic_language_library because of naming irregularities
|
||||
haskell_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
|
@ -15,7 +15,7 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,35 +23,8 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:go-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",
|
||||
"@stackage//: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-go",
|
||||
],
|
||||
language = "go",
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ load(
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,35 +23,8 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:java-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",
|
||||
"@stackage//: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-java",
|
||||
],
|
||||
language = "java",
|
||||
)
|
||||
|
@ -13,40 +13,18 @@ load(
|
||||
"haskell_cabal_binary",
|
||||
"haskell_cabal_library",
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
# and assign them a bazel target name, so that they
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
extra_srcs = ["//vendor:json-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",
|
||||
"@stackage//: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-json",
|
||||
],
|
||||
language = "json",
|
||||
)
|
||||
|
@ -4,18 +4,11 @@ package(default_visibility = ["//visibility:public"])
|
||||
# Load rules_haskell rules.
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_binary",
|
||||
"haskell_library",
|
||||
"haskell_toolchain_library",
|
||||
)
|
||||
load(
|
||||
"@rules_haskell//haskell:cabal.bzl",
|
||||
"haskell_cabal_binary",
|
||||
"haskell_cabal_library",
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,35 +16,8 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:php-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",
|
||||
"@stackage//: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-php",
|
||||
],
|
||||
language = "php",
|
||||
)
|
||||
|
@ -4,18 +4,11 @@ package(default_visibility = ["//visibility:public"])
|
||||
# Load rules_haskell rules.
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_binary",
|
||||
"haskell_library",
|
||||
"haskell_toolchain_library",
|
||||
)
|
||||
load(
|
||||
"@rules_haskell//haskell:cabal.bzl",
|
||||
"haskell_cabal_binary",
|
||||
"haskell_cabal_library",
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,8 +16,7 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(
|
||||
include = ["src/**/*.hs"],
|
||||
@ -33,31 +25,5 @@ haskell_library(
|
||||
"src/Language/Python/ScopeGraph.hs",
|
||||
],
|
||||
),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:python-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",
|
||||
"@stackage//: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-python",
|
||||
],
|
||||
language = "python",
|
||||
)
|
||||
|
@ -4,18 +4,11 @@ package(default_visibility = ["//visibility:public"])
|
||||
# Load rules_haskell rules.
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_binary",
|
||||
"haskell_library",
|
||||
"haskell_toolchain_library",
|
||||
)
|
||||
load(
|
||||
"@rules_haskell//haskell:cabal.bzl",
|
||||
"haskell_cabal_binary",
|
||||
"haskell_cabal_library",
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,35 +16,8 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:ruby-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",
|
||||
"@stackage//: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-ruby",
|
||||
],
|
||||
language = "ruby",
|
||||
)
|
||||
|
@ -4,18 +4,11 @@ package(default_visibility = ["//visibility:public"])
|
||||
# Load rules_haskell rules.
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_binary",
|
||||
"haskell_library",
|
||||
"haskell_toolchain_library",
|
||||
)
|
||||
load(
|
||||
"@rules_haskell//haskell:cabal.bzl",
|
||||
"haskell_cabal_binary",
|
||||
"haskell_cabal_library",
|
||||
)
|
||||
load(
|
||||
"//:build/common.bzl",
|
||||
"STANDARD_GHC_WARNINGS",
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# haskell_toolchain_library can access builtin GHC packages
|
||||
@ -23,35 +16,8 @@ load(
|
||||
# can be referenced as dependencies.
|
||||
haskell_toolchain_library(name = "base")
|
||||
|
||||
# You can add your own libraries with haskell_library.
|
||||
haskell_library(
|
||||
semantic_language_library(
|
||||
name = "lib",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
compiler_flags = STANDARD_GHC_WARNINGS,
|
||||
extra_srcs = ["//vendor:tsx-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",
|
||||
"@stackage//: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-tsx",
|
||||
],
|
||||
language = "tsx",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user