You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Benjamin Gould (JIRA)" <ji...@apache.org> on 2017/01/21 05:57:27 UTC

[jira] [Commented] (THRIFT-3581) Pure Java build of the Thrift compiler using NestedVM [WIP]

    [ https://issues.apache.org/jira/browse/THRIFT-3581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15832829#comment-15832829 ] 

Benjamin Gould commented on THRIFT-3581:
----------------------------------------

I have been using and refining this for some months now, and I am confident that it is stable and behaves consistently with native builds of the Thrift compiler.

The branch I am using for development is here; the contrib/nestedvm/README.md file has the most up-to-date documentation on any features I have developed:

https://github.com/bgould/thrift/tree/nestedvm/contrib/nestedvm

In addition to all of the functionality normally included in the Thrift compiler, a zip of the Thrift source tree is included inside the JAR, and this zip can be extracted or unzipped via command line flags.  This is useful for using/building Thrift support libraries that correspond to the version of the compiler implemented by the JAR file.  

I also added some logic to command line runner to make it "smart" (famous last words) and try to use a native build of the Thrift compiler if it is on one's $PATH... details about this behavior and how to override are documented in README.md

Since the NestedVM toolchain can be a pain to build, I've made sources, javadocs, and a pre-built binary available here (requires Java 7+):

https://github.com/bgould/thrift/releases/tag/nestedvm-0.10.0-beta1

If you all have the inclination and some time, I would appreciate if you could test out the pre-built JAR and give me your feedback; I am almost ready to make a pull request to add this to contrib/ ... ultimately if possible I would like to see if this build can be added to CI and have the JARs become part of a future release to Maven Central.

I also have modified the thrift-maven-plugin so that it can be run using this JAR as an alternative to using a native executable, which can be discussed further in another JIRA ticket if interested.  I think this would be very useful for Java developers, as it means they would just need to add the plugin to their pom.xml run their build without worrying about having the Thrift executable installed on the build system.  That branch is here:

https://github.com/bgould/thrift/tree/nestedvm-with-maven-plugin/contrib/thrift-maven-plugin

Again, any feedback you have (positive or negative) is greatly appreciated.

> Pure Java build of the Thrift compiler using NestedVM [WIP]
> -----------------------------------------------------------
>
>                 Key: THRIFT-3581
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3581
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (General)
>            Reporter: Benjamin Gould
>            Assignee: Benjamin Gould
>            Priority: Minor
>         Attachments: thrift-compiler-0.9.4-SNAPSHOT.jar, thrift-compiler-0.9.4-SNAPSHOT-sources.jar
>
>
> I've developed a build process for building the Thrift compiler as a JAR file that can be run on a JVM and requires no dependencies by cross-compiling the executable with NestedVM.
> I think this could be use for the following, among other things:
> 1) Building Thrift plugins for IDEs written in Java
> 2) Integration into Java build tools like Ant and Maven
> 3) Calling the compiler from a Java program when the host platform is unknown
> Also, I see this as providing a way to potentially allow people to create third party "plugins" for the compiler... Java and the plethora of JVM language available might make creating new generators much more approachable for people not comfortable with C++... and also in Java it is not complicated to load code dynamically based on a class name as long as it is on the classpath.
> In any case, I have a working prototype, but it is far from battle tested.
> For the inpatient, I'm attaching a snapshot build to this ticket, but you can also find the source and build instructions here:
> https://github.com/bgould/thrift/tree/nestedvm/contrib/nestedvm
> Will open a pull request when I feel all of the wrinkles have been ironed out (it is close, and quite usuable already) to see if it might be appropriate to bring this into the contrib/ folder, or even include as an artifact in the Maven repos for a future release.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)