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

Asciidoctorj cannot load external GEMs anymore #1136

Open
ysb33r opened this issue Jan 2, 2023 · 1 comment
Open

Asciidoctorj cannot load external GEMs anymore #1136

ysb33r opened this issue Jan 2, 2023 · 1 comment

Comments

@ysb33r
Copy link
Member

ysb33r commented Jan 2, 2023

I don't think asciidoctorj handles external GEMs correctly anymore. My starting point for this is asciidoctor/asciidoctor-gradle-plugin#658. After I could not figure out what the issue was in the Gradle plugin, I went straight to the asciidoctorj command-line to reproduce the issue

gem install --user-install --platform jruby asciidoctor-bibtex
sdk install asciidoctorj 2.5.7
sdk use asciidoctorj 2.5.7
GEM_HOME=$(cd ~/.local/share/gem/ruby; pwd) asciidoctorj -r asciidoctor-bibtex  -a bibtex-file=$(pwd)/biblio.bib index.adoc 

(The location for GEM_HOME might differ depending on the specific system).

The results in the error

Exception in thread "main" org.jruby.exceptions.LoadError: (LoadError) no such file to load -- asciidoctor-bibtex
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1017)
	at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:85)
	at RUBY.<main>(<script>:1)

A simple index.adoc to use for testing is

= Example bibtex

Some citation: cite:[Bogus1a]

and the corresponding biblio.bib

@book{Bogus1a,
	author = {J. Bloggs},
	title =	 {Book title},
	publisher = {Publisher},
	year =	 {2018}
}

I tested it with Asciidoctor Ruby command-line and it works, so this is definitely an AsciidoctorJ issue.

ysb33r added a commit to asciidoctor/asciidoctor-gradle-plugin that referenced this issue Jan 2, 2023
@robertpanzer
Copy link
Member

robertpanzer commented Jan 7, 2023

Right now this is the intended behavior, and it's even tested:

task pollutedTest(type: Test) {
useJUnit {
includeCategories 'org.asciidoctor.categories.Polluted'
}
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}
environment 'GEM_PATH', '/some/path'

The change was introduced in AsciidoctorJ 1.6.0 with this PR: #518

So right now I would say that this is the intended behavior, and iirc we did this because an old system installation of Asciidoctor could otherwise break asciidoctorj.

If my Google powers do not trick me, and requiring a gem on the GEM_PATH just adds it to the LOAD_PATH, it should be the same as passing it to asciidoctorj:

asciidoctorj -r asciidoctor-bibtex  -a bibtex-file=$(pwd)/biblio.bib -I /Users/rpanzer/.rvm/gems/ruby-2.7.2/gems/asciidoctor-bibtex-0.8.0/ index.adoc

I am happy to change AsciidoctorJ in whatever direction we like, but right now I'd say that this is the intended behavior.

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

2 participants