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

Output of JBake compilation is incorrect #11

Closed
hmf opened this issue May 11, 2022 · 9 comments · Fixed by #12
Closed

Output of JBake compilation is incorrect #11

hmf opened this issue May 11, 2022 · 9 comments · Fixed by #12
Milestone

Comments

@hmf
Copy link

hmf commented May 11, 2022

I was trying to serve the site using the following command:

~/VSCodeProjects/hashnode-pubs$ ./mill -i site.jbakeServe

Unfortunately that will fail because JBake serving expects the site to be in an output directory. In my case the jbake command placed the compile site into:

/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest

But as the output below shows, serving requires the output to be in:

/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output

Here is the output:

[8/8] site.jbakeServe 
JBake v2.6.7 (2021-05-14 21:54:29[GMT+01:00]) [http://jbake.org]

18:19:47.956 INFO  org.jbake.launcher.BakeWatcher - Watching for (content, template, asset) changes in [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest]
18:19:48.025 INFO  org.jbake.launcher.JettyServer - Serving out contents of: [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output] on http://localhost:8820/
18:19:48.025 INFO  org.jbake.launcher.JettyServer - (To stop server hit CTRL-C)

The JBake documentation says:

"The -b option without any parameters will assume your source content is in the current working directory and will place the baked output into a directory named output in the current directory:"

I don't think the FIXME of the def jbakeServe(): Command[Unit] target is the problem. I am assuming that the def jbake: T[PathRef] target is setting both the input and output directories. So to solve this I think it is only necessary to add an /output to the jbake output path. Note that setting the path in the server command doesn't help because JBake always adds /output to the path. Here is an example showing this:

./mill -i site.jbakeRun -s /home/hmf/VSCodeProjects/hashnode-pubs/out/site/

And here is the output:

[6/6] site.jbakeRun 
JBake v2.6.7 (2021-05-14 21:54:29[GMT+01:00]) [http://jbake.org]

18:04:16.930 INFO  org.jbake.launcher.BakeWatcher - Watching for (content, template, asset) changes in [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest]
18:04:17.000 INFO  org.jbake.launcher.JettyServer - Serving out contents of: [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/output] on http://localhost:8820/
18:04:17.000 INFO  org.jbake.launcher.JettyServer - (To stop server hit CTRL-C)
@lefou
Copy link
Owner

lefou commented May 11, 2022

Yes, there is an issue with the output dir, that's why we there is that FIXME. We require most probably a solution specific to the selected JBake version.

TBH, I'm not exactly sure what you're proposing to solve the issue. Create an output dir in the current destination dir?

FTR, here is my Gitter question about this issue: https://gitter.im/jbake-org/jbake?at=5c68865080df6804a1b83744

Unfortunately, there was no response.

@lefou
Copy link
Owner

lefou commented May 12, 2022

Here is the relevant PR in JBake repo

Unfortunately, it's from 2019, yet not merged 🤔

@lefou
Copy link
Owner

lefou commented May 12, 2022

From the JBake usage help, you could try to specify to destination directory as a second argument. Can you try that?

@hmf
Copy link
Author

hmf commented May 12, 2022

TBH, I'm not exactly sure what you're proposing to solve the issue. Create an output dir in the current destination dir?

Yes. Exactly that.

FTR, here is my Gitter question about this issue: https://gitter.im/jbake-org/jbake?at=5c68865080df6804a1b83744

Unfortunately, there was no response.

That was what I was afraid of. Hence the suggestion of making the change on this side.

@hmf
Copy link
Author

hmf commented May 12, 2022

From the JBake usage help, you could try to specify to destination directory as a second argument. Can you try that?

I assume you referring to the "baking"? As I said above, serving won't work because it always appends the /output. To make serving work, I can set the paths for the "baking". Here is an example:

./mill -i site.jbakeRun -b /home/hmf/VSCodeProjects/hashnode-pubs/site/src /home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest/ouput

Note that I am forced to set /output as the destination. This works but is cumbersome because I must determine and define the paths.

@hmf
Copy link
Author

hmf commented May 12, 2022

Yes, there is an issue with the output dir, that's why we there is that FIXME. We require most probably a solution specific to the selected JBake version.

I was hoping JBake's behavior had not changed. Hence the suggestion "just" to conform to the "server path". I see now this is not quite as simple. 8-(

@lefou
Copy link
Owner

lefou commented May 12, 2022

From a short look at the source code of JBake, I think it will use the specified destination directory as a base for serving, but only when it is given explicitly. This requires to specify it somehow. But I lack the time and a useful test project to try that atm.

Could you checkout and patch mill-jbake locally to test your approach? If it works somehow you already have a draft PR, which I can take over.

lefou added a commit that referenced this issue May 12, 2022
@lefou
Copy link
Owner

lefou commented May 12, 2022

@hmf Can you checkout and test this branch?

Build with:

$ mill __.publishLocal
Publishing Artifact(de.tototec,de.tobiasroeser.mill.jbake_mill0.10_2.12,0.2.2-1-35e8f7) to ivy repo /home/lefou/.ivy2/local

Then use version 0.2.2-1-35e8f7 in your plugin import.

@hmf
Copy link
Author

hmf commented May 12, 2022

@lefou Tested. Repeated the init, bake and serve. Worked perfectly.

I looked for the output but their is none. The serving output shows:

10:19:40.052 INFO  c.o.orient.core.db.OrientDBEmbedded - - shutdown storage: cache...
10:19:40.091 INFO  org.jbake.launcher.BakeWatcher - Watching for (content, template, asset) changes in [/home/hmf/VSCodeProjects/hashnode-pubs/site/src]
10:19:40.141 INFO  org.jbake.launcher.JettyServer - Serving out contents of: [/home/hmf/VSCodeProjects/hashnode-pubs/out/site/jbake.dest] on http://localhost:8820/
10:19:40.141 INFO  org.jbake.launcher.JettyServer - (To stop server hit CTRL-C)

I am curious, how did you do that?
EDIT: Ok. Compared the code. You now set source and destination.

Thank you very much.
EDIT: If you need additional testing, just say so. Tested with "2.6.7".

lefou added a commit that referenced this issue May 12, 2022
@lefou lefou closed this as completed in #12 May 12, 2022
lefou added a commit that referenced this issue May 12, 2022
* Fix #11

* Exclude 0.10.4 itest

* CI: windows tests no longer optional

Pull request: #12
@lefou lefou added this to the after 0.2.2 milestone May 12, 2022
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

Successfully merging a pull request may close this issue.

2 participants