Skip to content

Commit

Permalink
(#5059) Add djinni generator
Browse files Browse the repository at this point in the history
* Add djinni generator

* add LICENSE
  • Loading branch information
a4z authored Mar 31, 2021
1 parent 1796e61 commit d406bec
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
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"

0 comments on commit d406bec

Please sign in to comment.