Skip to content

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ehrmann committed May 12, 2015
1 parent e22a241 commit d2ce668
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Apache Thrift Ant Task #

Thrift-task is an native(ish) cross-platform Ant task for the [Apache Thrift](http://incubator.apache.org/thrift/) project. It also includes a full Java implementation of `thrift` than can be used from the command line.
Thrift-task is an native(ish) cross-platform Ant task for the [Apache Thrift](https://thrift.apache.org/)
project. It also includes a full Java implementation of `thrift` than can be used from the command line.

## Usage ##
1. Put thrift\_task.jar into your project directory.
1. Put `thrift-task-0.0.2-SNAPSHOT.jar` into your project directory.
1. Define the task in your build file, setting classpath to the relative path to the jar:
```
<taskdef name="thrift" classname="com.nsegment.thrift.ThriftTask" classpath="thrift_task.jar"/>
<taskdef name="thrift" classname="com.nsegment.thrift.ThriftTask" classpath="thrift-task-0.0.2-SNAPSHOT.jar" />
```
1. Now add a task to your build file:
```
Expand All @@ -16,15 +17,19 @@ Thrift-task is an native(ish) cross-platform Ant task for the [Apache Thrift](ht

To run `thrift` as a standalone process (not from Ant), do
```
java -jar thrift_task.jar -help
java -jar thrift-task-0.0.2-SNAPSHOT.jar -help
# or
java -cp thrift_task.jar com.nsegment.thrift.Thriftc -help
java -cp thrift-task-0.0.2-SNAPSHOT.jar com.nsegment.thrift.Thriftc -help
```

Windows users using thrift-task *outside* of Ant should use absolute paths like `/c:/Path/to/file.thrift`. Directory
separators are forward slashes, a leading forward slash is added before the drive letter, and the drive letter is
lower-case. When using the Ant task, this conversion is handled for you.

## Usage details ##
Thrift-task is a [MatchingTask](http://www.jajakarta.org/ant/ant-1.6.1/docs/en/manual/api/org/apache/tools/ant/taskdefs/MatchingTask.html), so it supports filesets, includes, and excludes like `<javac />`.

--gen flags are passed as attributes to the task, and their options are comma-separated attribute values:
`--gen` flags are passed as attributes to the task, and their options are comma-separated attribute values:

```
<thrift srcdir="." includes="**/*.thrift" destdir="bin" java="hashcode,include_prefix" />
Expand Down Expand Up @@ -67,11 +72,15 @@ The following languages and options are supported and behave the same as those i
* xsd

## Implementation details ##
Rather than being a native Java implementation, thrift-task uses code translated from a MIPS build of `thrift` to Java byte code by the [NestedVM project](http://nestedvm.ibex.org/) and a modified Unix runtime. It's essentially emulated MIPS code, but in a compiled form. While it's noticeably slower than a native executable or native Java code, it's far easier to perfectly match existing behavior or change behavior to match a specific build.
Rather than being a native Java implementation, thrift-task uses code translated from a MIPS build of `thrift` to Java
byte code by the [NestedVM project](http://nestedvm.ibex.org/) and a modified Unix runtime. It's essentially emulated
MIPS code, but in a compiled form. While it's noticeably slower than a native executable or native Java code, it's far
easier to perfectly match existing behavior or change behavior to match a specific build.

The process for building the emulated class blob is documented in [toolchain](toolchain). Once built, jars just need to be copied to `repo`, and `pom.xml` modified to relfect the new versions.
The process for building the emulated class blob is documented in [toolchain](toolchain). Once built, jars just need
to be copied to `repo`, and `pom.xml` modified to relfect the new versions.

## Limitations ##
* It's a little slow, but tolerable. This is because the code is emulated.
* It doesn't detect if source files need to be rebuilt, so it always rebuilds. Part of the reason is detecting modification times requires parsing the file to find its includes.
* 0.9.2 hasn't been tested on Windows, yet.
* It doesn't detect if source files need to be rebuilt, so it always rebuilds. Part of the reason is detecting
modification times requires parsing the file to find its includes.

0 comments on commit d2ce668

Please sign in to comment.