Building asciidoctorj with gradle

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Building asciidoctorj with gradle

ysb33r
The jruby-gradle-plugin has been making strides in the last couple of weeks. A major use case for me is the possibility of converting the asciidoctorj build over to gradle. I have posted a gist with a potential build.gradle script, which I have been updating after local testig and which I also hope can be used as a basis for discussion.

So far it builds existing asciidoctorj from master and all tests are passing. I have worked around some issues in the rubygems proxy related to broken POMs. Maven seems to handle it, but Gradle is more strict and barfs. The basics of uploading to Bintray is also in place, but some minor tweaks needs to be done.

I have some outstanding questions:

- Signing. Is signing still handled by the maven build or are there any plans to defer this to Bintray?
- Distribution. How is the command-line version currently put together? Is there a need to package a ZIP/TAR that contains a fully-functional command-line version?

Anyone that spots any missing functionality from the gradle script, please tell me - so that I can address it.

After the next release of jruby-gradle-plugin, I'll probaby be in a position to create a pull request with these changes, so feedback in the mean time would be useful.

Ole
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

Ole
- Distribution. How is the command-line version currently put together? Is there a need to package a ZIP/TAR that contains a fully-functional command-line version? 

A fully functional command line version would be great.

I patched one together myself. And it did cost me most of an evening and night.

Personally, I won't need the command line version any more if the maven plugin works fine. :-)

 Ole

Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator
In reply to this post by ysb33r
Great work Schalk! I'm really excited about this.

I want to start of by saying that I think that we should maintain both a Maven and Gradle build in AsciidoctorJ. I'm certainly in support of having the Gradle build being the main workhorse (handling integration tests and distribution), but it's useful for people to see how a project like AsciidoctorJ is built using Maven as well. As long as we have Travis CI running both builds, I don't think it's a problem to maintain it since the project is very reasonable in size.

Below you can find my responses to your questions / concerns.

Signing::

Currently the AsciidoctorJ artifacts aren't signed (at least, the .asc files aren't making it to the repository). However, we do have this configured in the Asciidoctor Maven plugin. I noticed when I was doing the release of the Maven plugin that Bintray offers this feature. I could go either way, as long as we can start doing it.

Distribution::

The command-line version is currently put together using the Maven assemble plugin. The configuration is sitting inside a profile named "distribution". I know that Gradle offers something similar, so it's just a matter of configuring it. As of yet, we do not distribute the distribution zip...but we should start.

As for the AsciidoctorJ command-line, currently it's built using jcommander. However, I suggested to Alex that we look into using warbler to create a simple wrapper around the Asciidoctor command-line so that we don't have to maintain a separate command-line implementation in AsciidoctorJ. Perhaps the JRuby Gradle plugin could provide a task for creating a jar file using warbler.

To try out warbler, just follow these steps:

   cd asciidoctor
   bundle
   gem install warbler
   warble
   java -jar asciidoctor.jar -v

You should see:

....
Asciidoctor 1.5.1.dev [http://asciidoctor.org]
Runtime Environment (jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on OpenJDK 64-Bit Server VM 1.8.0_11-b12 +indy [linux-amd64])
....

All we need to do is get whatever class Warbler is putting into that jar file into AsciidoctorJ and we've got it! No extra jars!!

-Dan


On Tue, Aug 26, 2014 at 6:02 AM, ysb33r [via Asciidoctor :: Discussion] <[hidden email]> wrote:
The jruby-gradle-plugin has been making strides in the last couple of weeks. A major use case for me is the possibility of converting the asciidoctorj build over to gradle. I have posted a gist with a potential build.gradle script, which I have been updating after local testig and which I also hope can be used as a basis for discussion.

So far it builds existing asciidoctorj from master and all tests are passing. I have worked around some issues in the rubygems proxy related to broken POMs. Maven seems to handle it, but Gradle is more strict and barfs. The basics of uploading to Bintray is also in place, but some minor tweaks needs to be done.

I have some outstanding questions:

- Signing. Is signing still handled by the maven build or are there any plans to defer this to Bintray?
- Distribution. How is the command-line version currently put together? Is there a need to package a ZIP/TAR that contains a fully-functional command-line version?

Anyone that spots any missing functionality from the gradle script, please tell me - so that I can address it.

After the next release of jruby-gradle-plugin, I'll probaby be in a position to create a pull request with these changes, so feedback in the mean time would be useful.




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Building-asciidoctorj-with-gradle-tp2078.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator
In reply to this post by ysb33r

On Tue, Aug 26, 2014 at 8:10 PM, Dan Allen <[hidden email]> wrote:

All we need to do is get whatever class Warbler is putting into that jar file into AsciidoctorJ and we've got it! No extra jars!!

https://github.com/asciidoctor/asciidoctorj/issues/193


--
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator
In reply to this post by ysb33r
Could you file an issue in AsciidoctorJ to add a Gradle build?

-Dan


On Tue, Aug 26, 2014 at 6:02 AM, ysb33r [via Asciidoctor :: Discussion] <[hidden email]> wrote:
The jruby-gradle-plugin has been making strides in the last couple of weeks. A major use case for me is the possibility of converting the asciidoctorj build over to gradle. I have posted a gist with a potential build.gradle script, which I have been updating after local testig and which I also hope can be used as a basis for discussion.

So far it builds existing asciidoctorj from master and all tests are passing. I have worked around some issues in the rubygems proxy related to broken POMs. Maven seems to handle it, but Gradle is more strict and barfs. The basics of uploading to Bintray is also in place, but some minor tweaks needs to be done.

I have some outstanding questions:

- Signing. Is signing still handled by the maven build or are there any plans to defer this to Bintray?
- Distribution. How is the command-line version currently put together? Is there a need to package a ZIP/TAR that contains a fully-functional command-line version?

Anyone that spots any missing functionality from the gradle script, please tell me - so that I can address it.

After the next release of jruby-gradle-plugin, I'll probaby be in a position to create a pull request with these changes, so feedback in the mean time would be useful.




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Building-asciidoctorj-with-gradle-tp2078.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

ysb33r
mojavelinux wrote
Could you file an issue in AsciidoctorJ to add a Gradle build?

-Dan
https://github.com/asciidoctor/asciidoctorj/issues/194
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator
Thanks Schalk!

-Dan


On Wed, Aug 27, 2014 at 2:49 AM, ysb33r [via Asciidoctor :: Discussion] <[hidden email]> wrote:
mojavelinux wrote
Could you file an issue in AsciidoctorJ to add a Gradle build?

-Dan
https://github.com/asciidoctor/asciidoctorj/issues/194


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Building-asciidoctorj-with-gradle-tp2078p2085.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

ysb33r
And the pull request - https://github.com/asciidoctor/asciidoctorj/pull/195

Torquebox has fixed the broken GEMs, so the workaround is gone. We are now at least in the experimentation space.

I'll look into Distribution & Signing when I get a chance. It is more important at this point that we actually build a working JAR with Gradle.
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator

\o/

Nice work!

Do you have a checklist of what's left? Perhaps add the checklist to the issue so folks know how to help?

-Dan

Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

ysb33r
In reply to this post by mojavelinux
mojavelinux wrote
As for the AsciidoctorJ command-line, currently it's built using
jcommander. However, I suggested to Alex that we look into using warbler to
create a simple wrapper around the Asciidoctor command-line so that we
don't have to maintain a separate command-line implementation in
AsciidoctorJ. Perhaps the JRuby Gradle plugin could provide a task for
creating a jar file using warbler.
I suggest we don't bloat the asciidoctorj jar just to make it executable. I would rather generate an additional executable JAR or create a zipped distribution which contains all of the dependent JARs + plus appropriate shell/batch wrapper.
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator

If we use warbler, the overhead is merely a single compiled class because all the logic is delegated to existing logic in the Asciidoctor gem.

I do agree we need a distribution to ship the launcher script, but I think it's reasonable to make the core jar file executable so long as the overhead is not measurable. Plus, it would be a very appealing for evaluating AsciidoctorJ or using it casually.

-Dan

On Sep 13, 2014 3:03 PM, "ysb33r [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
mojavelinux wrote
As for the AsciidoctorJ command-line, currently it's built using
jcommander. However, I suggested to Alex that we look into using warbler to
create a simple wrapper around the Asciidoctor command-line so that we
don't have to maintain a separate command-line implementation in
AsciidoctorJ. Perhaps the JRuby Gradle plugin could provide a task for
creating a jar file using warbler.
I suggest we don't bloat the asciidoctorj jar just to make it executable. I would rather generate an additional executable JAR or create a zipped distribution which contains all of the dependent JARs + plus appropriate shell/batch wrapper.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Building-asciidoctorj-with-gradle-tp2078p2198.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

ysb33r
mojavelinux wrote
If we use warbler, the overhead is merely a single compiled class because
all the logic is delegated to existing logic in the Asciidoctor gem.

I do agree we need a distribution to ship the launcher script, but I think
it's reasonable to make the core jar file executable so long as the
overhead is not measurable. Plus, it would be a very appealing for
evaluating AsciidoctorJ or using it casually.

-Dan
AFAIK if you want to run 'java -jar asciidoctorJ.jar', then all dependent JARs (except system JARs) are required to be within asciidoctorj.jar as both CLASSPATH and '-cp' will be ignored. This means the hefty jruby-complete.jar will need to be bundled.
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator

Aha, that's right. In that case, a separate jar does make sense. Something like asciidoctorj-complete.jar or asciidoctorj-cli.jar.

-Dan

On Sep 13, 2014 5:09 PM, "ysb33r [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
mojavelinux wrote
If we use warbler, the overhead is merely a single compiled class because
all the logic is delegated to existing logic in the Asciidoctor gem.

I do agree we need a distribution to ship the launcher script, but I think
it's reasonable to make the core jar file executable so long as the
overhead is not measurable. Plus, it would be a very appealing for
evaluating AsciidoctorJ or using it casually.

-Dan
AFAIK if you want to run 'java -jar asciidoctorJ.jar', then all dependent JARs (except system JARs) are required to be within asciidoctorj.jar as both CLASSPATH and '-cp' will be ignored. This means the hefty jruby-complete.jar will need to be bundled.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Building-asciidoctorj-with-gradle-tp2078p2201.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

ysb33r
In reply to this post by mojavelinux
mojavelinux wrote
If we use warbler, the overhead is merely a single compiled class because
all the logic is delegated to existing logic in the Asciidoctor gem.
Looking through the AsciidoctorJ code, would using Warbler not mean that we effectively will bypass all of AsciidoctorJ code and go straight to JRuby to just run the Asciidoctor Gem?
Reply | Threaded
Open this post in threaded view
|

Re: Building asciidoctorj with gradle

mojavelinux
Administrator

On Mon, Sep 15, 2014 at 5:25 PM, ysb33r [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Looking through the AsciidoctorJ code, would using Warbler not mean that we effectively will bypass all of AsciidoctorJ code and go straight to JRuby to just run the Asciidoctor Gem?

Nope, because then we would lose the value of having the type-safe API in Java. We would just use Warbler to handle the bridge to the cli. Of course, you *could* use Warbler to run Asciidoctor on the JVM without any extra setup, but again, it wouldn't be much use for people calling it from Java and other JVM languages because it would lack a typed interface.