asciidoctor / asciidoclet

:clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
https://github.com/asciidoctor/asciidoclet
Apache License 2.0
132 stars 40 forks source link

Building with asciidoctorj 1.5.3 results in "Ignoring..." messages #52

Closed johncarl81 closed 8 years ago

johncarl81 commented 8 years ago

When building with an upgraded version of asciidoctorj, log messages are issued noting that it is ignoring a given library and to try to run a gem command:

john@john-desktop:~/dev/asciidoclet-sample$ ./gradlew clean build javadoc
:project:clean
:project:compileJava
:project:processResources UP-TO-DATE
:project:classes
:project:jar
:project:assemble
:project:compileTestJava UP-TO-DATE
:project:processTestResources UP-TO-DATE
:project:testClasses UP-TO-DATE
:project:test UP-TO-DATE
:project:check UP-TO-DATE
:project:build
:project:jrubyPrepareGems
Successfully installed asciidoctor-diagram-1.3.1
Successfully installed asciidoctor-1.5.3
2 gems installed
:project:javadoc
Ignoring bigdecimal-1.2.7 because its extensions are not built.  Try: gem pristine bigdecimal --version 1.2.7
Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
Ignoring ffi-1.9.10 because its extensions are not built.  Try: gem pristine ffi --version 1.9.10
Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
Ignoring io-console-0.4.5 because its extensions are not built.  Try: gem pristine io-console --version 0.4.5
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring psych-2.0.17 because its extensions are not built.  Try: gem pristine psych --version 2.0.17
Ignoring psych-2.0.15 because its extensions are not built.  Try: gem pristine psych --version 2.0.15
Ignoring rjb-1.5.4 because its extensions are not built.  Try: gem pristine rjb --version 1.5.4
Ignoring rjb-1.5.3 because its extensions are not built.  Try: gem pristine rjb --version 1.5.3
Ignoring rjb-1.4.9 because its extensions are not built.  Try: gem pristine rjb --version 1.4.9
WARN: tilt autoloading 'tilt/haml' in a non thread-safe way; explicit require 'tilt/haml' suggested.

@mojavelinux or @robertpanzer any thoughts on this one?

mojavelinux commented 8 years ago

Which version of AsciidoctorJ and JRuby?

Very likely this is a change in JRuby and the warning is harmless (though annoying). JRuby doesn't build extensions, hence why it claims they aren't built.

The other possibility is that the extensions are marked as built (in some way) with one version of JRuby and running under a different version.

@pepijnve may have some ideas as well.

johncarl81 commented 8 years ago

asciidoctorj: 1.5.3.2 jruby: 1.7.21

mojavelinux commented 8 years ago

Wait, I remember what this is. When you get that message, it means that there are locally installed gems visible to the JRuby runtime, likely installed using MRI (CRuby). Whenever you use AsciidoctorJ, it's a good idea to make sure you don't have RVM active, or other gems installed.

$ rvm use system

While we do isolate from loading these gems, it appears that JRuby is still analyzing them (at least, I hope it's not trying to load them too).

johncarl81 commented 8 years ago

Ah, that did the trick. Thanks Dan!

mojavelinux commented 8 years ago

What this tells me is that when you invoke AsciidoctorJ, you aren't isolating from the system gems. I don't get this warning when using the main Gradle plugin. Stay tuned for details.

johncarl81 commented 8 years ago

Ah, I'll reopen then.

johncarl81 commented 8 years ago

FYI, I do have the gem-path set.

I also spoke too soon, it seems the build now fails on asciidoctor-diagram not being available:

javadoc: error - In doclet class org.asciidoctor.Asciidoclet,  method start has thrown an exception java.lang.reflect.InvocationTargetException
org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- asciidoctor-diagram
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
    at RUBY.require(/mnt/hd1/home/john/.m2/repository/org/asciidoctor/asciidoclet/1.5.3-SNAPSHOT/asciidoclet-1.5.3-SNAPSHOT.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
    at RUBY.(root)(<script>:1)
mojavelinux commented 8 years ago

Where is this sample project?

johncarl81 commented 8 years ago

Here: https://github.com/johncarl81/asciidoclet-sample

build with ./gradlew clean build javadoc

mojavelinux commented 8 years ago

So here's your problem regarding the warnings:

options.addStringOption "-gem-path", System.getenv('GEM_PATH')

You should never be setting the gem path to the system (unless you really intend to do that, so we leave it as an option). It makes the build system dependent.

To use the gem that jrubyPrepareGems installs, you should use a build-local path:

options.addStringOption "-gem-path", "build/vendor"

So, in total, those two options are:

options.addStringOption "r", "asciidoctor-diagram"
options.addStringOption "-gem-path", "build/vendor"

Btw, you don't have to install the asciidoctor-diagram gem manually anymore since you can now use asciidoctorj-diagram (see https://bintray.com/asciidoctor/maven/asciidoctorj-diagram/1.3.1/view). Then, you can get rid of both options and the jrubyPrepareGems business.

mojavelinux commented 8 years ago

Btw, it might be good to add this sample project to the https://github.com/asciidoctor/asciidoctor-gradle-examples for exposure (even though technically it is not the Asciidoctor Gradle plugin, it still fits in the ecosystem there).

johncarl81 commented 8 years ago

Ah, good idea, I'll make a PR with the updated project soon. On Jan 2, 2016 4:52 PM, "Dan Allen" notifications@github.com wrote:

Btw, it might be good to add this sample project to the https://github.com/asciidoctor/asciidoctor-gradle-examples for exposure (even though technically it is not the Asciidoctor Gradle plugin, it still fits in the ecosystem there).

— Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoclet/issues/52#issuecomment-168440118 .

mojavelinux commented 8 years ago

:+1:

johncarl81 commented 8 years ago

What do you think about the gradle file now, did I capture everything you mentioned: https://github.com/johncarl81/asciidoclet-sample/blob/master/build.gradle

It's a little strange to register the asciidoctor-diagram plugin twice... is there any way to automatically register it with Asciidoctorj so to avoid the -r asciidoctor-diagram redundancy?

johncarl81 commented 8 years ago

WDYT @mojavelinux: https://github.com/asciidoctor/asciidoclet/pull/53

mojavelinux commented 8 years ago

The options.addStringOption "r", "asciidoctor-diagram" is redundant if you use AsciidoctorJ Diagram. It automatically loads the asciidoctor-diagram gem. Otherwise, looks good!

johncarl81 commented 8 years ago

Hmm, removing the ptions.addStringOption "r", "asciidoctor-diagram" gives the following warnings then (and doesn't render the diagrams):

asciidoctor: WARNING: <stdin>: line 16: invalid style for listing block: plantuml
asciidoctor: WARNING: <stdin>: line 24: invalid style for listing block: plantuml
asciidoctor: WARNING: <stdin>: line 32: invalid style for literal block: ditaa
robertpanzer commented 8 years ago

Hi,

-r asciidoctor-diagram is still required. Only in case of using other backends via -b pdf or some other attributes a gem is auto-required: https://github.com/asciidoctor/asciidoctorj/blob/master/asciidoctorj-core/src/main/java/org/asciidoctor/internal/RubyGemsPreloader.java#L19-L25

Cheers Robert

Am 03.01.2016 um 08:18 schrieb John Ericksen notifications@github.com:

Hmm, removing the ptions.addStringOption "r", "asciidoctor-diagram" gives the following warnings then (and doesn't render the diagrams):

asciidoctor: WARNING: : line 16: invalid style for listing block: plantuml asciidoctor: WARNING: : line 24: invalid style for listing block: plantuml asciidoctor: WARNING: : line 32: invalid style for literal block: ditaa — Reply to this email directly or view it on GitHub.

mojavelinux commented 8 years ago

Ah, my mistake.