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

Download Kindlegen if it can't be found #44

Closed
mojavelinux opened this issue Oct 29, 2015 · 14 comments
Closed

Download Kindlegen if it can't be found #44

mojavelinux opened this issue Oct 29, 2015 · 14 comments

Comments

@mojavelinux
Copy link
Member

If Kindlegen can't be found (because the gem wasn't install or we can't install gems like in AsciidoctorJ), then download Kindlegen on demand, extract it to a temporary location and use that executable. This will allow mobi generation to work consistently everywhere and will give us control over the Kindlegen download.

@ysb33r
Copy link
Member

ysb33r commented Mar 31, 2019

In the Gradle plugin for Asciidoctor we take care of this automatically, but it fails on Windows due to an issue on how kindlegen access is implemented in the GEM.

@slonopotamus
Copy link
Contributor

slonopotamus commented Jan 22, 2020

@ysb33r Could you provide more details please? Do you have a bugreport against gradle plugin + kindlegen? We could possibly send a PR to kindlegen gem to fix that?

Overall, I don't quite understand this issue. Kindlegen should not be any different from epubcheck, for example.

@ysb33r
Copy link
Member

ysb33r commented Jan 22, 2020

IIRC the issue is that the only way to run it is to have it on the path, otherwise the GEM does not find it. Setting KINDLEGEN environmental variable does not seem to work for Windows even though it should. See

KINDLEGEN = ENV['KINDLEGEN'] || 'kindlegen'

The issue is described here asciidoctor/asciidoctorj#659.

Ideally if the kindlegen location is passed via seom option or attribute it could also help.

@slonopotamus
Copy link
Contributor

Thanks for the link, I'll try to figure out what's going on.

@ysb33r
Copy link
Member

ysb33r commented Jan 22, 2020

It only occurs under JRuby. A good solution for us might be to only half-generate the files and then post-process them. IOW tell the GEM to only generate the files require by kindlegen, but not call it. In that way we can post-process from maven or gradle by calling kindlegen from the build tool after the GEM has generated the intermediate artifacts.

@mojavelinux
Copy link
Member Author

That seems like a bad idea. We shouldn't be putting workarounds in place because of a bug. Instead, the focus should be on why it is failing. The invocation of kindlegen should be encapsulated by this converter.

@ysb33r
Copy link
Member

ysb33r commented Jan 22, 2020

@mojavelinux Irrespective on that concern, having the ability to set the exact path to kindlegen without relying on setting an environmental variable is very useful. For instance is we run asciidoctorj inside the same JVm we cannot use an envVar.

Also having access to the intermediate artifacts can be useful in certain cases.

@mojavelinux
Copy link
Member Author

I don't see why we are even talking about an environment variable. The call to kindlegen should be encapsulated inside the gem. There should be no environment variable involved.

Also having access to the intermediate artifacts can be useful in certain cases.

I'm not arguing against that and I can definitely see the value.

@slonopotamus
Copy link
Contributor

slonopotamus commented Jan 22, 2020

I don't see why we are even talking about an environment variable.

  1. Because the world is not ideal and sometimes people will have to know that we have kindlegen inside. In ideal world, asciidoctor-gradle-examples would even have a test project that reproduces current bug instead of 46 comments in issue that requests to create such project.
  2. Because there is an environment variable to control path to kindlegen

Anyway, if we're failing to run kindlegen on Windows while running from within Gradle, it is a bug that we can reproduce, analyze and finally fix. And I'm actually going to do that in some maybe-even-nearest future.

@mojavelinux
Copy link
Member Author

Because the world is not ideal and sometimes people will have to know that we have kindlegen inside.

I get that. I'm not advocating against the environment variable. I'm advocating against relying on it to fix a bug of kindlegen not being found.

Anyway, if we're failing to run kindlegen on Windows while running from within Gradle, it is a bug that we can reproduce, analyze and finally fix.

1000% Exactly what I'm saying. If we have to download it ourselves because the kindlegen gem fails to do so (or properly), then let's just bite that bullet and do it.

@slonopotamus
Copy link
Contributor

@mojavelinux while we're at it: asciidoctor/asciidoctor-gradle-examples seems to be very much abandoned. Would someone be able to review and merge PRs there if I submitted them or it is better to request commit access from you?

@mojavelinux
Copy link
Member Author

I don't manage that project. I would suggest asking in the asciidoctor/asciidoctorj gitter channel.

@slonopotamus
Copy link
Contributor

Okay

@slonopotamus
Copy link
Contributor

I declare that this issue is a duplicate of #154.

@slonopotamus slonopotamus removed this from the v1.5.0 milestone Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants