Skip to content

Fix: Ensure that cache directory exists#21

Merged
aalmiray merged 2 commits into
jbangdev:mainfrom
koppor:add-mkdir
Dec 29, 2025
Merged

Fix: Ensure that cache directory exists#21
aalmiray merged 2 commits into
jbangdev:mainfrom
koppor:add-mkdir

Conversation

@koppor

@koppor koppor commented Dec 26, 2025

Copy link
Copy Markdown
Contributor

With 94850ed, we get

type 'dev.jbang.gradle.tasks.JBangTask' property 'installDir' specifies directory '/home/runner/.gradle/caches/jbang' which doesn't exist.

A simple createDirectories should do the trick, doesn't it?

@aalmiray

Copy link
Copy Markdown
Contributor

Please reword the commit message using conventional commits.

@koppor koppor closed this Dec 27, 2025
@koppor koppor reopened this Dec 27, 2025
@koppor koppor changed the title Create directory Fix: Ensure that cache directory exists Dec 27, 2025
@koppor

koppor commented Dec 27, 2025

Copy link
Copy Markdown
Contributor Author

@Siedlerchr worked on this. Instead of using .gradle, .jbang/cache is used. Is this OK?

@aalmiray

Copy link
Copy Markdown
Contributor

Why change the value?

Co-authored-by: Christoph <siedlerkiller@gmail.com>
@koppor

koppor commented Dec 27, 2025

Copy link
Copy Markdown
Contributor Author

Why change the value?

We had an internal discussion. Was not intended.

I updated - force push to keep one commit with conventual commit message.

@Siedlerchr

Copy link
Copy Markdown
Contributor

The thing we needed to change is the access to "project." in the constructor. This breaks the configuration cache and is not allowed. But with this fixes the plugin works now at JabRef

@koppor

koppor commented Dec 27, 2025

Copy link
Copy Markdown
Contributor Author

Maybe related:

 JBang not found. Checking cached version latest
Downloading https://www.jbang.dev/releases/latest/download/version.txt
100%
JBang not found. Downloading version 0.135.1
Downloading https://github.com/jbangdev/jbang/releases/download/v0.135.1/jbang-0.135.1.zip
10%.20%.30%.40%.50%.60%.70%.80%.90%.100%
The process cannot access the file because it is being used by another process.


> Task :jablib:generateLtwaListMV
Caching disabled for task ':jablib:generateLtwaListMV' because:
  Caching has not been enabled for the task
Task ':jablib:generateLtwaListMV' is not up-to-date because:
  No history is available.
Found JBang v.0.135.1

Executing JBang command: jbang.cmd run D:\a\jabref\jabref\build-support\src\main\java\LtwaListMvGenerator.java
The process cannot access the file because it is being used by another process.

C:\Users\runneradmin\.jbang\cache\27838.jbang.tmp

@aalmiray

Copy link
Copy Markdown
Contributor

Oh gees. Windows is the gift that keeps on giving.

@Siedlerchr

Copy link
Copy Markdown
Contributor

A rerun helped here

@aalmiray

Copy link
Copy Markdown
Contributor

Is this a problem on Windows at all?

@koppor

koppor commented Dec 27, 2025

Copy link
Copy Markdown
Contributor Author

Is this a problem on Windows at all?

Maybe not related to this PR. We try to download jbang before.

It is only an issue for users having

  • multiple independent JBang tasks
  • org.gradle.parallel=true activated

@koppor

koppor commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

@aalmiray We think our patch works. Would it be possible to include it in main and craft a release? Currently we test with a jitpack variant which introduces another variable.

@Siedlerchr Siedlerchr force-pushed the add-mkdir branch 2 times, most recently from 6b3669c to 29b4737 Compare December 28, 2025 18:38
@Siedlerchr

Copy link
Copy Markdown
Contributor

The latest change (making the property internal) now ensure that it also works inside docker based environment.

@koppor

koppor commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

The latest change (making the property internal) now ensure that it also works inside docker based environment.

Build says:

 Caused by: org.gradle.internal.execution.WorkValidationException: Plugin validation failed with 1 problem:
  - Error: Type 'dev.jbang.gradle.tasks.JBangTask' property 'installDir' annotated with @Internal should not be also annotated with @InputDirectory.

…side docker

Co-authored-by: koppor <kopp.dev@gmail.com>
@koppor

koppor commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

I am not sure how we can make the install directory configurable with a default value based on the gradle directory layout.

Changing it to @Internal doesn't seem to allow @Input or @InputDirectory., but it "magically" fixes running on gradle's docker image (https://hub.docker.com/_/gradle)

@Siedlerchr

Copy link
Copy Markdown
Contributor

@koppor Fixed now. As far as I understand, this internal still allows you to change the value, but it will not be considered for out of date checks which is okay because the other properties are annoated as input.

@koppor

koppor commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

Then, we accept that changing JBang installations (e.g., down/upgrading versions) don't trigger a rebuild. -- Could be OK, because it is a seldom use case to switch between JBang installations.

@koppor

koppor commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

Discussion result: This is only the cache directory. the input version matters. This really triggers the change of the version.

Thus, I am also fine with the latest update and vote for merge and a release 😅.

@aalmiray aalmiray merged commit 5533166 into jbangdev:main Dec 29, 2025
2 checks passed
@koppor koppor deleted the add-mkdir branch December 29, 2025 20:04
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 this pull request may close these issues.

3 participants