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

Add djinni generator #5059

Merged
merged 2 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/djinni-generator/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
36 changes: 36 additions & 0 deletions recipes/djinni-generator/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"))

21 changes: 21 additions & 0 deletions recipes/djinni-generator/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions recipes/djinni-generator/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.3.1":
folder: "all"