diff --git a/recipes/djinni-generator/all/conandata.yml b/recipes/djinni-generator/all/conandata.yml new file mode 100644 index 0000000000000..7a2f752e8d1d3 --- /dev/null +++ b/recipes/djinni-generator/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.1": + url: https://github.com/cross-language-cpp/djinni-generator/releases/download/v0.3.1/djinni + sha256: "052925e2590b40982a64d5386f79078cf61718d660b876e0a26670df4fc36838" diff --git a/recipes/djinni-generator/all/conanfile.py b/recipes/djinni-generator/all/conanfile.py new file mode 100644 index 0000000000000..88cc8b79ba87e --- /dev/null +++ b/recipes/djinni-generator/all/conanfile.py @@ -0,0 +1,36 @@ +import os + +from conans import ConanFile, tools + + +class Djinni(ConanFile): + name = "djinni-generator" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://djinni.xlcpp.dev" + description = "Djinni is a tool for generating cross-language type declarations and interface bindings." + topics = ("java", "Objective-C", "ios", "Android") + license = "Apache-2.0" + settings = "os", "arch" + + + def source(self): + filename = os.path.basename(self.conan_data["sources"][self.version]["url"]) + tools.download(filename=filename, **self.conan_data["sources"][self.version]) + tools.download(filename="LICENSE", url="https://raw.githubusercontent.com/cross-language-cpp/djinni-generator/main/LICENSE") + + def build(self): + pass # avoid warning for missing build steps + + def package(self): + if tools.detected_os() == "Windows": + os.rename('djinni','djinni.bat') + self.copy("djinni.bat", dst="bin", keep_path=False) + else: + self.copy("djinni", dst="bin", keep_path=False) + executable = os.path.join(self.package_folder, "bin", "djinni") + os.chmod(executable, os.stat(executable).st_mode | 0o111) + self.copy("LICENSE", dst="licenses", keep_path=False) + + def package_info(self): + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + diff --git a/recipes/djinni-generator/all/test_package/conanfile.py b/recipes/djinni-generator/all/test_package/conanfile.py new file mode 100644 index 0000000000000..456428a9a8670 --- /dev/null +++ b/recipes/djinni-generator/all/test_package/conanfile.py @@ -0,0 +1,21 @@ + +from io import StringIO +from conans import ConanFile, tools + +class TestPackageConan(ConanFile): + settings = "os", "arch" + + def build(self): + pass # please no warning that we build nothing + + def test(self): + if not tools.cross_building(self.settings): + output = StringIO() + self.run("djinni --help", output=output, run_environment=True) + output.seek(0, 0) + found_usage = False + for line in output: + if "Usage: djinni [options]" in line: + found_usage = True + break + assert(found_usage) diff --git a/recipes/djinni-generator/config.yml b/recipes/djinni-generator/config.yml new file mode 100644 index 0000000000000..bf78e3c43a008 --- /dev/null +++ b/recipes/djinni-generator/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.1": + folder: "all"