JTRANSC
-------
![JTransc](extra/logo-256.png)
[![Maven Version](https://img.shields.io/github/tag/jtransc/jtransc.svg?style=flat&label=maven)](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jtransc-maven-plugin%22)
[![Build Status](https://secure.travis-ci.org/jtransc/jtransc.svg)](http://travis-ci.org/jtransc/jtransc)
[![Build status](https://ci.appveyor.com/api/projects/status/qnd0g966t1b54q4a?svg=true)](https://ci.appveyor.com/project/soywiz/jtransc)
[![Code coverage](https://codecov.io/gh/jtransc/jtransc/branch/master/graph/badge.svg)](https://codecov.io/gh/jtransc/jtransc)
[![gitter](https://img.shields.io/gitter/room/jtransc/general.svg)](https://gitter.im/jtransc/general)
# Documentation
You can find documentation at the [wiki](https://jtransc.soywiz.com/).
# What is this?
JTransc (Java Trans Compiler) is an AOT (ahead of time compiler) that compiles .class and .jar files
into a target programming language / executable bundling all the required dependencies in a single file or folder,
without requiring a jitter or an external runtime.
# Why using JTransc?
There are a lot of technologies in order to convert languages into other ones. For example, converting Java into JavaScript.
Or KotlinJS Kotlin backend that already targets JavaScript. So why using JTransc?
### Mixed input code:
One reason is that JTransc allows mixed projects. You can use Java libraries with Kotlin code for example.
### Multiple targets:
Instead of using several technologies, JTransc allows you to target to several languages and platforms.
### Consistency:
Using just one technology guarantees consistency between targets. For example, Kotlin JS doesn't support full Java reflection.
### Native:
Instead of generating C++ and then using emscripten or other technologies, JTransc allows you to generate code that is
native to your platform. For example: when targeting JS you will use native JS best-in-class GC instead of a GC
emulated in C++ & emscripten. And no need to know a proper heap size beforehand targeting JS.
### Native facilities:
Some classes like String, StringBuilder or ArrayList are implemented in a way that it uses native JavaScript/AS3/Dart... facilities.
Like JavaScript String, Array and so on.
### Treeshaking:
Instead of generating huge projects including everything, or having complex proguard configuration files.
JTransc includes treeshaking in a simple way. You can use annotations to keep methods, classes and fields or another annotations.
It works for all targets and it is fully integrated in the workflow.
### Thread and sync I/O support in JS:
JTransc supports plain Java applications using Threads and sync I/O in JS converting that into an asynchronous version in JS
using await/async detecting branches not using Threads/sync I/O for fastest performance.
# Support this project
Along JTransc, I'm writting a set of libraries to be able to use JTransc.
[https://github.com/soywiz/korlibs](https://github.com/soywiz/korlibs)
Kotlin Game Engine that uses JTransc for multiplatform: [https://github.com/soywiz/korge](https://github.com/soywiz/korge)
Also there is a GDX backend using JTransc+Haxe: [https://github.com/jtransc/gdx-backend-jtransc](https://github.com/jtransc/gdx-backend-jtransc)
JTransc
# Detailed: What is this?
JTransc (Java Trans Compiler) is an AOT (ahead of time compiler) that compiles .class and .jar files
into a target programming language / executable bundling all the required dependencies in a single file or folder, without requiring
a jitter or an external runtime.
At the beginning it generated as3 and javascript, but right now there are several targets: Javascript, Haxe, C++, and D.
Haxe itself allow to target several other languages: JS, AS3, C++, C#, Java, PHP and Python.
This in turn allows running the program on different platforms such as desktop, browsers and mobile.
The aim of this project is to bring the high productivity of Kotlin (and other JVM languages)
to the highly portable Haxe platform.
It already supports most of the core Java APIs and plain Java reflection API out of the box.
The initial focus is on JVM6, Kotlin and Games, but it will get better in the future supporting newer jvm versions,
and other use cases like frontend and backend applications.
Right now JTransc support Java8 lambdas and default methods.
There is a module called jtransc-rt-core that could be included in any project (whether using JTransc or not).
It provides the `com.jtransc` package, specific annotations, fast memory access and asynchronous APIs,
that will use JTransc features when compiling using JTransc.
These is also a couple of projects for multimedia applications using jtransc:
* [jtransc-media](https://github.com/jtransc/jtransc-media) - Which provides a very simple and portable high-level API for multimedia
* [gdx-backend-jtransc](https://github.com/jtransc/gdx-backend-jtransc) - Which provides a gdx-compatible backend so any gdx project will be able to work (still some rough edges)
# How to use it?
You can find examples here [jtransc/jtransc-examples](https://github.com/jtransc/jtransc-examples).
## Plain:
```
# jtransc script can be found under the jtransc-main-run folder
javac com/test/Main.java -d target/classes
jtransc dependency.jar target/classes -main com.test.Main -out program.js
node program.js
```
## Gradle:
This is the preferred way of using JTransc. You can include it from maven central or directly from gradle plugins repository:
```
plugins {
id "com.jtransc" version "0.6.8"
}
```
This will add several tasks for building your application.
There is a gradle block called jtransc, that allows you to specify stuff for the build.
For example `gradle runJs` would generate a JS file at `build/jtransc-js/program.js` and run it using node.js.
[You can see how to use it in the documentation](https://jtransc.soywiz.com/usage/gradle).
## Maven:
You can also use Maven, though due to the nature of JTransc gradle fits better.
[You can see how to use it in the documentation](https://jtransc.soywiz.com/usage/maven).
## intelliJ:
There is a plugin in the works that will allow to run and debug within intelliJ. Though it is not ready yet.
You can find it in [jtransc-intellij-plugin](https://github.com/jtransc/jtransc/tree/master/jtransc-intellij-plugin) folder.
# How does it work internally?
* It locates all the required dependencies (specifying dependencies using gradle, maven, intelliJ or CLI)
* It includes jtransc-rt-core and jtransc-rt which is a java-6-like (with some Java8 support) RT with some of its methods marked as native
* Other dependencies than the RT are included without modifications
* It uses ASM library to load class files, and has code to generate a class-method-statement-expression AST
* That AST is easily serializable
* That AST allows feature stripping
* Your target language don't support gotos? It will generate an AST without gotos. Just plain if/while/switch...
* It generates your target source code, replacing some classes like String, ArrayList and so on, to make them fast in your target language.
* It joins or compiles that code into your final runnable program (using available compilers when required)
* It allows to run directly executing the executable or using an appropiate interpreter (php, node, electron...) depending on the build
Eventually that intermediate AST will be able to be generated or consumed.
So others could generate that without JVM and others could generate other targets from that AST directly without all the complexities of stack-based IRs.
## Tool dependencies:
### Java:
- Oracle JDK8 (Verified 8u131)
- Android SDK Tools (Verified 25.2.3)
### For the Haxe target:
- Haxe 3.4.2
- NekoVM 2.1.0
- Lime 5.5.0
- hxcpp 3.4.64
### For Node.JS running:
- NodeJS 7.10.0 with npm 4.2.0
### For D target:
- DMD2 or GDC or LDC (Verified dmd-2.074.0)
### For C++ target:
- Clang++ or g++ (At least gcc 4.8)
### For Dart target:
- Tested with Dart VM vers
没有合适的资源?快使用搜索试试~ 我知道了~
Bytecode to source converting Java & Kotlin code into .zip
共1825个文件
java:1286个
kt:269个
md:47个
需积分: 5 0 下载量 5 浏览量
2024-02-04
10:14:26
上传
评论
收藏 4.34MB ZIP 举报
温馨提示
Bytecode to source converting Java & Kotlin code into
资源推荐
资源详情
资源评论
收起资源包目录
Bytecode to source converting Java & Kotlin code into .zip (1825个子文件)
com.jtransc.ast.AstMethodFeature 245B
com.jtransc.ast.AstProgramFeature 52B
gradlew.bat 3KB
gradlew.bat 3KB
gradlew.bat 3KB
gradlew.bat 3KB
gradlew.bat 2KB
gradlew.bat 2KB
deploy.bat 73B
update_version.bat 36B
Example.class 420B
custombuildtest.cmd 406B
CNAME 18B
CNAME 17B
JNI.cpp 73KB
Base.cpp 50KB
GC.cpp 19KB
jni_impl.cpp 0B
Base.cs 15KB
program.csproj 461B
bootstrap.css 143KB
bootstrap.min.css 118KB
font-awesome.css 34KB
font-awesome.min.css 28KB
font-mfizz.css 8KB
search.css 4KB
simple-sidebar.css 3KB
Base.dart 44KB
deploy 72B
asm-xml.dtd 12KB
.editorconfig 86B
fontawesome-webfont.eot 75KB
font-mfizz.eot 49KB
glyphicons-halflings-regular.eot 20KB
SystemTest.expected 68B
com.jtransc.gen.GenTargetDescriptor 31B
com.jtransc.gen.GenTargetDescriptor 31B
com.jtransc.gen.GenTargetDescriptor 29B
com.jtransc.gen.GenTargetDescriptor 27B
jtransc-icon.gif 2KB
.gitattribute 8B
.gitignore 862B
.gitignore 59B
.gitignore 40B
.gitignore 33B
.gitignore 33B
.gitignore 33B
.gitignore 23B
.gitignore 23B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 22B
.gitignore 15B
build.gradle 9KB
build.gradle 2KB
build.gradle 1KB
build.gradle 1KB
build.gradle 1006B
build.gradle 875B
build.gradle 865B
build.gradle 680B
build.gradle 655B
build.gradle 646B
build.gradle 385B
settings.gradle 300B
build.gradle 220B
build.gradle 206B
build.gradle 202B
build.gradle 186B
build.gradle 172B
build.gradle 158B
build.gradle 65B
settings.gradle 1B
settings.gradle 1B
settings.gradle 0B
gradlew 6KB
gradlew 6KB
gradlew 6KB
gradlew 6KB
gradlew 5KB
gradlew 5KB
jdk1.3.1_19.txt.gz 125KB
jdk1.2.2_017.txt.gz 111KB
combined_jni.h 67KB
index.html 6KB
package.html 6KB
package.html 4KB
default.html 4KB
package.html 3KB
package.html 3KB
共 1825 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
码农阿豪
- 粉丝: 9907
- 资源: 1750
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功