mirror of
https://github.com/github/semantic.git
synced 2024-11-23 08:27:56 +03:00
Revert "kind of get semantic-ruby working, but having trouble with stuff"
This reverts commit b314ade302
.
This commit is contained in:
parent
b314ade302
commit
b8f2995877
@ -37,28 +37,16 @@ def tree_sitter_node_types_archive(name, version, sha256, urls = [], nodetypespa
|
||||
name = name,
|
||||
build_file_content = """
|
||||
exports_files(glob(["{}"]))
|
||||
|
||||
native.filegroup(
|
||||
name = "corpus",
|
||||
srcs = "test/corpus/*.txt",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""".format(nodetypespath),
|
||||
strip_prefix = "{}-{}".format(name, version),
|
||||
urls = ["https://github.com/tree-sitter/{}/archive/v{}.tar.gz".format(name, version)],
|
||||
sha256 = sha256,
|
||||
)
|
||||
|
||||
def semantic_language_library(language, name, srcs, nodetypes = [], **kwargs):
|
||||
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 = [
|
||||
"@tree-sitter-{}//:src/node-types.json".format(language),
|
||||
]
|
||||
filegroup(
|
||||
name = "corpus",
|
||||
srcs = native.glob("@"),
|
||||
)
|
||||
if nodetypes == "":
|
||||
nodetypes = "@tree-sitter-{}//:src/node-types.json".format(language)
|
||||
haskell_library(
|
||||
name = name,
|
||||
# We can't use Template Haskell to find out the location of the
|
||||
@ -71,7 +59,7 @@ def semantic_language_library(language, name, srcs, nodetypes = [], **kwargs):
|
||||
'-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes),
|
||||
],
|
||||
srcs = srcs,
|
||||
extra_srcs = nodetypes,
|
||||
extra_srcs = [nodetypes],
|
||||
deps = [
|
||||
"//:base",
|
||||
"//semantic-analysis",
|
||||
|
@ -5,35 +5,9 @@ load(
|
||||
"semantic_language_library",
|
||||
)
|
||||
|
||||
# Load rules_haskell rules.
|
||||
load(
|
||||
"@rules_haskell//haskell:defs.bzl",
|
||||
"haskell_test",
|
||||
)
|
||||
|
||||
semantic_language_library(
|
||||
name = "semantic-ruby",
|
||||
srcs = glob(["src/**/*.hs"]),
|
||||
language = "ruby",
|
||||
nodetypes = "@tree-sitter-ruby//:src/node-types.json",
|
||||
)
|
||||
|
||||
haskell_test(
|
||||
name = "test",
|
||||
srcs = glob(["test/**/*.hs"]),
|
||||
deps = [
|
||||
":semantic-ruby",
|
||||
"//:base",
|
||||
"//:bytestring",
|
||||
"//:text",
|
||||
"//semantic:fixtureshim",
|
||||
"//semantic-ast",
|
||||
"@stackage//:bazel-runfiles",
|
||||
"@stackage//:hedgehog",
|
||||
"@stackage//:pathtype",
|
||||
"@stackage//:tasty",
|
||||
"@stackage//:tasty-hedgehog",
|
||||
"@stackage//:tasty-hunit",
|
||||
"@stackage//:tree-sitter-ruby",
|
||||
],
|
||||
)
|
||||
|
@ -1,38 +1,20 @@
|
||||
{-# LANGUAGE DisambiguateRecordFields #-}
|
||||
{-# LANGUAGE ImplicitParams #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
|
||||
module Main (main) where
|
||||
|
||||
import TreeSitter.Ruby
|
||||
import AST.TestHelpers
|
||||
import AST.Unmarshal
|
||||
import qualified Language.Ruby.AST as Rb
|
||||
import qualified System.Path as Path
|
||||
import qualified System.Path.Fixture as Fixture
|
||||
import qualified Bazel.Runfiles as Bazel
|
||||
import Test.Tasty
|
||||
import System.IO
|
||||
import Control.Concurrent
|
||||
import TreeSitter.Ruby
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
let ?project = Path.relDir "semantic-ruby"
|
||||
|
||||
rf <- Bazel.create
|
||||
let ?runfiles = rf
|
||||
|
||||
let parse = parseByteString @Rb.Program @() tree_sitter_ruby
|
||||
|
||||
Rb.getTestCorpusDir >>= print
|
||||
print (Path.toString (Fixture.bazelDir "/."))
|
||||
hFlush stdout
|
||||
threadDelay 1000000000
|
||||
|
||||
Fixture.bazelDir <$> Rb.getTestCorpusDir
|
||||
>>= readCorpusFiles'
|
||||
>>= traverse (testCorpus parse)
|
||||
>>= defaultMain . tests
|
||||
main
|
||||
= Path.absDir <$> Rb.getTestCorpusDir
|
||||
>>= readCorpusFiles'
|
||||
>>= traverse (testCorpus parse)
|
||||
>>= defaultMain . tests
|
||||
where parse = parseByteString @Rb.Program @() tree_sitter_ruby
|
||||
|
||||
tests :: [TestTree] -> TestTree
|
||||
tests = testGroup "tree-sitter-ruby corpus tests"
|
||||
|
Loading…
Reference in New Issue
Block a user