Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding package with lib tree-sitter, version 0.17.3 #3791

Merged
merged 55 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7db1467
add main config
Nov 5, 2020
ae751dc
add version folder
Nov 5, 2020
583574e
add test package
Nov 5, 2020
52aca67
add version configs
Nov 5, 2020
6ceff2d
fix build errors with hooks
Nov 5, 2020
2914153
Merge pull request #1 from AlexeiKislinskii10/resiprocate
OleksiiKyslynskyi Nov 5, 2020
58718a9
fix automatic build system errors
Nov 5, 2020
c73c014
fix automatic build system errors 2
Nov 5, 2020
17a9cf4
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 6, 2020
1dcab81
simplifu test app
Nov 6, 2020
6827dec
merge
Nov 6, 2020
42a58bd
Improve ReSIProcate recipe
uilianries Nov 9, 2020
09bda6a
Merge pull request #2 from bincrafters/resiprocate/1.12.0
OleksiiKyslynskyi Nov 9, 2020
7553a62
fix build
Nov 10, 2020
1d64fb5
fix build 2
Nov 10, 2020
d21276c
simplify pathes
Nov 10, 2020
8b565c4
Dummy commit to rerun build
OleksiiKyslynskyi Nov 11, 2020
4c34f5c
add prefix to autotool
Nov 11, 2020
efc0788
add prefix to autotool
Nov 11, 2020
43b0cf0
fix errors in test app
Nov 11, 2020
b806611
remove fpic for mac and windows
Nov 11, 2020
61f3961
fix msys
Nov 12, 2020
4d19732
fix msys
Nov 12, 2020
aa827c0
fix msys
Nov 12, 2020
14b3979
change msysy2 condition
Nov 12, 2020
0169f97
try to fix vs 15 build
Nov 12, 2020
2df7fbd
try to fix vs buld
Nov 12, 2020
d997358
try to fix vs buld
Nov 12, 2020
942d3a9
fix build
Nov 16, 2020
eebbd4a
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 16, 2020
af3b377
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 16, 2020
8d9a5b7
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 16, 2020
1f6552e
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 17, 2020
866087a
Update recipes/resiprocate/all/test_package/CMakeLists.txt
OleksiiKyslynskyi Nov 20, 2020
7f55c31
Update recipes/resiprocate/all/conanfile.py
OleksiiKyslynskyi Nov 20, 2020
1f9ac38
fix build
Nov 20, 2020
20c4734
add tree-sitter lib
Dec 3, 2020
9116d22
simplify package
Dec 3, 2020
ecd1f5b
Merge branch 'master' of https://github.com/conan-io/conan-center-index
Dec 3, 2020
af33643
add msys2
Dec 4, 2020
23f6e66
fix win build
Dec 4, 2020
869f9dc
disable windows and mac build
Dec 4, 2020
60cc8f9
return missed import
Dec 4, 2020
617727c
dummy, to init build
Dec 4, 2020
2e0845c
dummy commit, to init build
Dec 5, 2020
6a38a93
add fpic and share options
Dec 5, 2020
6624eab
fix comments
Dec 6, 2020
5a2a089
fix comments2
Dec 6, 2020
1f8131a
fix comments3
Dec 6, 2020
40977a3
fix comments4
Dec 6, 2020
5e2a5d7
fix build
Dec 6, 2020
86f8464
apply suggest
Dec 6, 2020
fc259d1
optimization
Dec 7, 2020
fd1b7c5
run build
Dec 8, 2020
927c825
Update recipes/tree-sitter/all/conanfile.py
OleksiiKyslynskyi Dec 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/tree-sitter/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.17.3":
url: https://github.com/tree-sitter/tree-sitter/archive/0.17.3.tar.gz
sha256: a897e5c9a7ccb74271d9b20d59121d2d2e9de8b896c4d1cfaac0f8104c1ef9f8
65 changes: 65 additions & 0 deletions recipes/tree-sitter/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import shutil

required_conan_version = ">=1.29.1"

class TreeSitterConan(ConanFile):
name = "tree-sitter"
description = "Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited."
topics = ("parser")
OleksiiKyslynskyi marked this conversation as resolved.
Show resolved Hide resolved
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://tree-sitter.github.io/tree-sitter"
license = "MIT"
settings = "os", "compiler", "build_type", "arch"
options = {"fPIC": [True, False],
"shared": [True, False]}
default_options = {"fPIC": True,
"shared": False}
_autotools = None

@property
def _source_subfolder(self):
return "source_subfolder"

def requirements(self):
if self.settings.os == "Windows":
raise ConanInvalidConfiguration("tree-sitter is not support on {}.".format(self.settings.os))
OleksiiKyslynskyi marked this conversation as resolved.
Show resolved Hide resolved

def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)

def _configure_autotools(self):
if not self._autotools:
self._autotools = AutoToolsBuildEnvironment(self)

return self._autotools

def build(self):
autotools = self._configure_autotools()

with tools.chdir(self._source_subfolder):
autotools.make()

def package(self):
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")

autotools = self._configure_autotools()
with tools.chdir(self._source_subfolder):
autotools.install(args=["PREFIX={}".format(self.package_folder)])

if self.options.shared:
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a")
else:
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so*")
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dylib*")

tools.rmdir(os.path.join(self.package_folder, os.path.join("lib", "pkgconfig")))


def package_info(self):
self.cpp_info.names["pkg_config"] = "tree-sitter"
self.cpp_info.libs = ["tree-sitter"]

8 changes: 8 additions & 0 deletions recipes/tree-sitter/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
17 changes: 17 additions & 0 deletions recipes/tree-sitter/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os

from conans import ConanFile, CMake, tools

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
11 changes: 11 additions & 0 deletions recipes/tree-sitter/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <tree_sitter/api.h>
#include <stdio.h>

//More datailed example search at https://tree-sitter.github.io/tree-sitter/using-parsers#getting-started
int main() {
TSParser *parser = ts_parser_new();
ts_parser_delete(parser);
printf( "Test package\n" );
return 0;
}

3 changes: 3 additions & 0 deletions recipes/tree-sitter/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.17.3":
folder: all