1
1
mirror of https://github.com/github/semantic.git synced 2025-01-07 16:07:28 +03:00

add more of the bazel subprojects

This commit is contained in:
Patrick Thomson 2020-06-09 13:52:39 -04:00
parent ca8475057d
commit b51a27118f
20 changed files with 402 additions and 42 deletions

View File

@ -1,37 +1,38 @@
# Give your project a name. :)
workspace(name="semantic")
workspace(name = "semantic")
# Load the repository rule to download an http archive.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Download rules_haskell and make it accessible as "@rules_haskell".
http_archive(
name="rules_haskell",
strip_prefix="rules_haskell-0.12",
urls=["https://github.com/tweag/rules_haskell/archive/v0.12.tar.gz"],
sha256="56a8e6337df8802f1e0e7d2b3d12d12d5d96c929c8daecccc5738a0f41d9c1e4",
name = "rules_haskell",
sha256 = "56a8e6337df8802f1e0e7d2b3d12d12d5d96c929c8daecccc5738a0f41d9c1e4",
strip_prefix = "rules_haskell-0.12",
urls = ["https://github.com/tweag/rules_haskell/archive/v0.12.tar.gz"],
)
load(
"@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies",
"@rules_haskell//haskell:repositories.bzl",
"rules_haskell_dependencies",
)
# Setup all Bazel dependencies required by rules_haskell.
rules_haskell_dependencies()
load(
"@rules_haskell//haskell:toolchain.bzl", "rules_haskell_toolchains",
"@rules_haskell//haskell:toolchain.bzl",
"rules_haskell_toolchains",
)
# Download a GHC binary distribution from haskell.org and register it as a toolchain.
rules_haskell_toolchains(version="8.8.1")
rules_haskell_toolchains(version = "8.8.1")
load(
"@rules_haskell//haskell:cabal.bzl",
"stack_snapshot",
"haskell_cabal_library",
"haskell_cabal_binary",
"haskell_cabal_library",
"stack_snapshot",
)
# load("@rules_haskell//haskell:doctest.bzl", "haskell_doctest_toolchain")
@ -39,9 +40,9 @@ load(
# register_toolchains("//:doctest")
stack_snapshot(
name="stackage",
local_snapshot="//:stack-snapshot.yaml",
packages=[
name = "stackage",
local_snapshot = "//:stack-snapshot.yaml",
packages = [
"Glob",
"QuickCheck",
"aeson",
@ -64,8 +65,8 @@ stack_snapshot(
"hedgehog",
"lens",
"optparse-applicative",
"pathtype",
"parsers",
"pathtype",
"pretty-simple",
"prettyprinter",
"prettyprinter-ansi-terminal",
@ -77,24 +78,30 @@ stack_snapshot(
"terminal-size",
"text",
"transformers",
"trifecta",
"tree-sitter",
"tree-sitter-go",
"tree-sitter-java",
"tree-sitter-json",
"tree-sitter-php",
"tree-sitter-python",
"tree-sitter-ql",
"tree-sitter-ruby",
"tree-sitter-typescript",
"trifecta",
"unordered-containers",
],
tools=["@happy"], # , "@doctest"],
tools = ["@happy"], # , "@doctest"],
)
http_archive(
name="happy",
build_file_content="""
name = "happy",
build_file_content = """
load("@rules_haskell//haskell:cabal.bzl", "haskell_cabal_binary")
haskell_cabal_binary(name = "happy", srcs = glob(["**"]), visibility = ["//visibility:public"])
""",
sha256="fb9a23e41401711a3b288f93cf0a66db9f97da1ce32ec4fffea4b78a0daeb40f",
strip_prefix="happy-1.19.12",
urls=["http://hackage.haskell.org/package/happy-1.19.12/happy-1.19.12.tar.gz"],
sha256 = "fb9a23e41401711a3b288f93cf0a66db9f97da1ce32ec4fffea4b78a0daeb40f",
strip_prefix = "happy-1.19.12",
urls = ["http://hackage.haskell.org/package/happy-1.19.12/happy-1.19.12.tar.gz"],
)
# http_archive(

View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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-ql",
],
)

View File

@ -21,4 +21,4 @@ import Language.Haskell.TH.Syntax (runIO)
import Prelude hiding (Bool, Eq, Float, Integer, String)
import qualified TreeSitter.QL as CodeQL (getNodeTypesPath, getTestCorpusDir, tree_sitter_ql)
runIO CodeQL.getNodeTypesPath >>= astDeclarationsForLanguage CodeQL.tree_sitter_ql
astDeclarationsForLanguage CodeQL.tree_sitter_ql "/Users/patrickt/src/semantic/vendor/codeql-node-types.json"

View File

@ -108,14 +108,6 @@ instance ToTags CodeQL.DatatypeBranch where
name = CodeQL.ClassName {text, ann}
} = yieldTag text Class ann byteRange >> gtags t
instance ToTags CodeQL.ClasslessPredicateCall where
tags
CodeQL.ClasslessPredicateCall
{ extraChildren
} = for_ extraChildren $ \x -> case x of
Prj t@CodeQL.AritylessPredicateExpr {} -> tags t
_ -> pure ()
instance ToTags CodeQL.QualifiedRhs where
tags
t@CodeQL.QualifiedRhs

51
semantic-go/BUILD.bazel Normal file
View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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",
],
)

View File

@ -20,4 +20,4 @@ import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Go as Go (getNodeTypesPath, getTestCorpusDir, tree_sitter_go)
runIO Go.getNodeTypesPath >>= astDeclarationsForLanguage Go.tree_sitter_go
astDeclarationsForLanguage Go.tree_sitter_go "/Users/patrickt/src/semantic/vendor/go-node-types.json"

51
semantic-java/BUILD.bazel Normal file
View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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",
],
)

View File

@ -20,4 +20,4 @@ import AST.Token
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Java as Java (getNodeTypesPath, getTestCorpusDir, tree_sitter_java)
runIO Java.getNodeTypesPath >>= astDeclarationsForLanguage Java.tree_sitter_java
astDeclarationsForLanguage Java.tree_sitter_java "/Users/patrickt/src/semantic/vendor/java-node-types.json"

View File

@ -169,7 +169,6 @@ instance ToTags Java.FieldAccess
instance ToTags Java.FieldDeclaration
instance ToTags Java.FinallyClause
instance ToTags Java.FloatingPointType
instance ToTags Java.ForInit
instance ToTags Java.ForStatement
instance ToTags Java.FormalParameter
instance ToTags Java.FormalParameters
@ -189,15 +188,14 @@ instance ToTags Java.LabeledStatement
instance ToTags Java.LambdaExpression
instance ToTags Java.Literal
instance ToTags Java.LocalVariableDeclaration
instance ToTags Java.LocalVariableDeclarationStatement
instance ToTags Java.MarkerAnnotation
-- instance ToTags Java.MethodDeclaration
-- instance ToTags Java.MethodInvocation
instance ToTags Java.MethodReference
instance ToTags Java.Modifiers
instance ToTags Java.ModuleBody
instance ToTags Java.ModuleDeclaration
instance ToTags Java.ModuleDirective
instance ToTags Java.ModuleName
instance ToTags Java.NullLiteral
instance ToTags Java.ObjectCreationExpression
instance ToTags Java.OctalIntegerLiteral

51
semantic-json/BUILD.bazel Normal file
View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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",
],
)

View File

@ -19,4 +19,4 @@ import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.JSON as JSON (getNodeTypesPath, getTestCorpusDir, tree_sitter_json)
runIO JSON.getNodeTypesPath >>= astDeclarationsForLanguage JSON.tree_sitter_json
astDeclarationsForLanguage JSON.tree_sitter_json "/Users/patrickt/src/semantic/vendor/json-node-types.json"

51
semantic-php/BUILD.bazel Normal file
View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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",
],
)

View File

@ -20,4 +20,4 @@ import Language.Haskell.TH.Syntax (runIO)
import Prelude hiding (String, Integer, Float)
import qualified TreeSitter.PHP as PHP (getNodeTypesPath, tree_sitter_php)
runIO PHP.getNodeTypesPath >>= astDeclarationsForLanguage PHP.tree_sitter_php
astDeclarationsForLanguage PHP.tree_sitter_php "/Users/patrickt/src/semantic/vendor/php-node-types.json"

View File

@ -20,4 +20,4 @@ import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Python as Python (getNodeTypesPath, getTestCorpusDir, tree_sitter_python)
astDeclarationsForLanguage Python.tree_sitter_python "/private/var/tmp/_bazel_patrickt/9ab2276bd7abbc23224fda87a0d88539/external/stackage/tree-sitter-python-0.9.0.2/vendor/tree-sitter-python/src/node-types.json"
astDeclarationsForLanguage Python.tree_sitter_python "/Users/patrickt/src/semantic/vendor/python-node-types.json"

View File

@ -20,4 +20,4 @@ import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Ruby as Ruby (getNodeTypesPath, getTestCorpusDir, tree_sitter_ruby)
runIO Ruby.getNodeTypesPath >>= astDeclarationsForLanguage Ruby.tree_sitter_ruby
astDeclarationsForLanguage Ruby.tree_sitter_ruby "/Users/patrickt/src/semantic/vendor/ruby-node-types.json"

51
semantic-tsx/BUILD.bazel Normal file
View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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",
],
)

View File

@ -0,0 +1,51 @@
# Set all targets visibility in this package to "public".
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",
)
# 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(
name = "lib",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
":base",
"//semantic-analysis:lib",
"//semantic-ast:lib",
"//semantic-core: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-typescript",
],
)

View File

@ -20,4 +20,4 @@ import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.TypeScript as TypeScript (getNodeTypesPath, getTestCorpusDir, tree_sitter_typescript)
runIO TypeScript.getNodeTypesPath >>= astDeclarationsForLanguage TypeScript.tree_sitter_typescript
astDeclarationsForLanguage TypeScript.tree_sitter_typescript "/Users/patrickt/src/semantic/vendor/typescript-node-types.json"

View File

@ -288,7 +288,6 @@ instance ToTags Ts.TupleType
instance ToTags Ts.TypeAliasDeclaration
instance ToTags Ts.TypeAnnotation
instance ToTags Ts.TypeArguments
instance ToTags Ts.TypeAssertion
instance ToTags Ts.TypeIdentifier
instance ToTags Ts.TypeParameter
instance ToTags Ts.TypeParameters

View File

@ -11,3 +11,10 @@ packages:
- tree-sitter-0.9.0.1
- tree-sitter-python-0.9.0.2
- tree-sitter-ruby-0.5.0.2
- tree-sitter-go-0.5.0.1
- tree-sitter-java-0.7.0.1
- tree-sitter-typescript-0.5.0.1
- tree-sitter-tsx-0.5.0.1
- tree-sitter-json-0.7.0.1
- tree-sitter-php-0.4.0.0
- tree-sitter-ql-0.1.0.3