Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
johncarl81 opened this issue Jan 2, 2016 · 19 comments
Closed

Comments

@johncarl81
Copy link
Member

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
Copy link
Member

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
Copy link
Member Author

asciidoctorj: 1.5.3.2
jruby: 1.7.21

@mojavelinux
Copy link
Member

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
Copy link
Member Author

Ah, that did the trick. Thanks Dan!

@mojavelinux
Copy link
Member

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
Copy link
Member Author

Ah, I'll reopen then.

@johncarl81 johncarl81 reopened this Jan 2, 2016
@johncarl81
Copy link
Member Author

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
Copy link
Member

Where is this sample project?

@johncarl81
Copy link
Member Author

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

build with ./gradlew clean build javadoc

@mojavelinux
Copy link
Member

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
Copy link
Member

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
Copy link
Member Author

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
#52 (comment)
.

@mojavelinux
Copy link
Member

👍

@johncarl81
Copy link
Member Author

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
Copy link
Member Author

WDYT @mojavelinux: #53

@mojavelinux
Copy link
Member

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

@johncarl81
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member

Ah, my mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants