• Stars
    star
    22
  • Rank 1,015,160 (Top 21 %)
  • Language
    Crystal
  • Created over 7 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java Native Interface (JNI) bindings (and generator) for Crystal

Java Native Interface (JNI) bindings (and generator) for Crystal

Generate Java bindings through the Java Native Interface (JNI) automatically from Java classes using the javap tool distributed with the JDK.

The main goal is to generate bindings for the Android SDK. This project is thus for the most usable widget and communication classes (e.g. android.app.Activity, android.os.Handler or android.widget.TextView). More complex classes, mostly those relying on generics and wildcards will probably fail, or generate invalid Crystal code.

Install

Add the shard to your shard.yml dependencies:

dependencies:
  java:
    github: ysbaddaden/java.cr

Usage

Let's generate some bindings for an Android project. First we must add the target platform android.jar to CLASSPATH. For example. Let's also add the project local folder where the Android SDK will store the compiled classes.

export CLASSPATH=bin/classes:/opt/android-sdk/platforms/android-23/android.jar

Let's generate some bindings, this will load the definition of the specified classes, potentially following classes found, then generate the Crystal bindings into namespace separated folders. Pass --help for the full list of options.

lib/java/bin/generator --output src --no-follow \
    android.app.Activity \
    android.os.Bundle \
    android.os.Message \
    android.os.Handler

You may now just use it:

require "android/os/bundle"
require "android/os/message"

bundle = Android::Os::Bundle.new
bundle.put_char_sequence("action", "setText")
bundle.put_char_sequence("text", "hello world")

message = Android::Os::Message.new
message.set_data(bundle)

TODO

  • fix bugs
  • write tests

Authors

  • Julien Portalier (creator, maintainer)

More Repositories

1

prax

Rack proxy server for development
Ruby
475
star
2

prax.cr

Rack proxy server for development (Crystal port)
Crystal
150
star
3

minitest.cr

Test Unit for the Crystal programming language
Crystal
144
star
4

frost

Web Framework for Crystal
Crystal
117
star
5

sdl.cr

SDL2 bindings for Crystal
Crystal
99
star
6

earl

Service Objects for Crystal (Agents, Artists, Supervisors, Pools, ...)
Crystal
94
star
7

http2

HTTP/2 Protocol Implementation for the Crystal Language
Crystal
93
star
8

gc

A garbage collector for Crystal
C
91
star
9

pool

Generic (connection) pools for Crystal
Crystal
76
star
10

artanis

Sinatra-like DSL for the Crystal language (abusing macros)
Crystal
56
star
11

selenium-webdriver-crystal

Selenium Webdriver client for the Crystal programming language
Crystal
56
star
12

posix

POSIX/C bindings generator for the Crystal programming language
Crystal
33
star
13

panzer

Multi-process, zero-downtime service monitor for Crystal
Crystal
29
star
14

android.cr

Create Android applications using Crystal and the NDK
Crystal
22
star
15

scrypt-crystal

Crystal bindings for Colin Percival's scrypt key derivation function
Crystal
21
star
16

muco

Multithreaded Coroutines library
C
20
star
17

crystal_library

Static/Shared libraries written in Crystal (Proof of Concept)
Crystal
20
star
18

crystal-cmark

Crystal wrapper for libcmark, the reference CommonMark C library
Crystal
18
star
19

syn

Synchronization primitives to build concurrent and parallel-safe data structures in Crystal
Crystal
17
star
20

nanolib.cr

Crystal
15
star
21

ruby-akismet

Ruby library for the Akismet anti-spam service.
Ruby
13
star
22

rome

Crystal
12
star
23

janus

Authentication engine for Ruby on Rails.
Ruby
12
star
24

shards-registry

Crystal
8
star
25

minitest-js

A JavaScript port of the minitest ruby gem
JavaScript
7
star
26

sql

SQL query builder for Crystal
Crystal
7
star
27

jsruby

Ruby Virtual Machine using node.js
JavaScript
6
star
28

microtest.cr

A test framework for raw Crystal (empty prelude)
Crystal
6
star
29

siphash.cr

SipHash family of pseudo random functions implemented in Crystal
Crystal
5
star
30

php5-redis

Yet another Redis client for PHP.
PHP
5
star
31

teascript

An attempt at creating a Ruby inspired language that compiles to JavaScript.
JavaScript
4
star
32

misago

Yet Another PHP 5 Framework
PHP
4
star
33

sinapse

Push service for Ruby using EventSource
Ruby
4
star
34

alpha

JavaScript
4
star
35

calliope

Blog engine for Ruby on Rails
Ruby
3
star
36

earl.rb

Service Objects for Ruby (Agents, Artists, Supervisors, Pools, ...)
Ruby
3
star
37

acts_as_enum

Treat an integer or string ActiveRecord column as a list of symbols.
Ruby
3
star
38

960-atatonic

CSS framework experiment based on 960 and Atatonic
3
star
39

pdoc

A minimalistic documentation tool for PHP.
PHP
3
star
40

ewkb

Crystal
2
star
41

pake

pake is meant to provide centralized CLI scripts to your PHP 5 projects
PHP
2
star
42

ng-rails-ujs

Angular directives for Rails UJS
JavaScript
2
star
43

markup

Ruby
2
star
44

redis_model

Ruby
2
star
45

zombie_admin

A brainless alternative to ActiveAdmin that speaks zombie fluently.
Ruby
2
star
46

mdown

Markdown editor with live preview (web app experiment)
Ruby
2
star
47

wyme

JavaScript
2
star
48

imhotep

Wiki engine for Ruby on Rails.
Ruby
2
star
49

acts_as_publish

Provides ActiveRecords with publishing capabilities
Ruby
2
star
50

alpha-control

JavaScript
2
star
51

ejs

ruby-like template engine for javascript
JavaScript
2
star
52

alpha-core

An obstrusive JavaScript library that aims at fixing, implementing and emulating standard JavaScript and DOM in broken and old browsers.
JavaScript
2
star
53

acts_as_sanitize

Sanitizes user data within ActiveRecord
Ruby
2
star
54

commentable

Ruby
2
star
55

sechat

Q&A engine for Ruby on Rails
Ruby
2
star
56

erb_assets

Render your Rails views into the Assets Pipeline
Ruby
1
star
57

rbs

Ruby inspired language that transcompiles to simple JavaScript
Ruby
1
star
58

dockerdev.cr

Crystal
1
star
59

swagger.cr

Crystal
1
star
60

brium-app

Crystal
1
star
61

calliper

Protractor for Ruby, or testing your Angular application with elegance
Ruby
1
star
62

execution_context

Crystal
1
star