xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("tree-sitter")
  2. set_homepage("https://tree-sitter.github.io/")
  3. set_description("An incremental parsing system for programming tools")
  4. add_urls("https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v$(version).zip")
  5. add_versions("0.22.5", "b8c0da9f5cafa3214547bc3bbfa0d0f05a642f9d0c045e505a940cf487300849")
  6. add_versions("0.22.2", "df0cd4aacc53b6feb9519dd4b74a7a6c8b7f3f7381fcf7793250db3e5e63fb80")
  7. add_versions("0.21.0", "874794e6b3b985f7f9e87dfe29e4bfdbe5c0339e67740f35dfc4fa85804ba708")
  8. on_install(function(package)
  9. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  10. local configs = {}
  11. if package:config("shared") then
  12. configs.kind = "shared"
  13. end
  14. import("package.tools.xmake").install(package, configs)
  15. end)
  16. on_test(function(package)
  17. assert(package:check_csnippets({
  18. test = [[
  19. #include <string.h>
  20. #include <tree_sitter/api.h>
  21. void test() {
  22. TSParser *parser = ts_parser_new();
  23. const char *source_code = "[1, null]";
  24. TSTree *tree = ts_parser_parse_string(
  25. parser,
  26. NULL,
  27. source_code,
  28. strlen(source_code)
  29. );
  30. }
  31. ]]
  32. }))
  33. end)