Don't transform the object passed to extraDirectories.paths.path.from immediately
See original GitHub issueEnvironment:
- Jib version: 2.6.0
- *Build tool:*Gradle 6.7.1
- OS: macOS
Description of the issue:
I’d like to configure extraDirectories with the output from another task, however during the gradle configuration the task didn’t run yet, the files dod not exist yet
jib {
extraDirectories {
paths {
path {
from = {
unpackLibsodium.outputs
.files
.asFileTree
.matching { include "**/*.so" }
.singleFile
.parentFile
}
// ...
}
tasks.jibBuildTar.dependsOn unpackLibsodium
tasks.jibDockerBuild.dependsOn unpackLibsodium
tasks.jib.dependsOn unpackLibsodium
This leads to the following error
* What went wrong:
A problem occurred evaluating project ':password-encryption-cli'.
> Expected task 'unpackLibsodium' output files to contain exactly one file, however, it contains no files.
And it is likely caused by the setFrom
method that immediately pass the object to project.file
, thus immediately executing the closure, however as the task has been executed it fails because there’s no output yet.
The only option is to use a string constant.
Expected behavior:
It would be nice if jib called the closure at execution time. In other word moving the project.files(from).toPath()
outside the setter, at the place it is really needed. Maybe in the getFrom()
method ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
google/jib - Gitter
Hello, does anyone have a practical example of using container.extraClasspath with the Gradle plugin? I have Flyway migration classes stored in a different ......
Read more >Keyboard Control - mpv.io
For paths passed to suboptions, the situation is further complicated by the need to escape special characters. To work this around, the path...
Read more >Cross Platform Make - CMake
The argument after DOC will be used for the documentation string in the cache. PATH_SUFFIXES specifies additional subdirectories to check below each search...
Read more >Frequently Asked Questions (FAQ) - GitHub
### How do I run the image I built? If you built your image directly to the Docker daemon using `jib:dockerBuild` (Maven) or...
Read more >Configuring the Salt Master - Salt Project Documentation
The Salt mine and publish.publish do not work between minion types. ... The path to the master's configuration file. conf_file: /etc/salt/master ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just in case if you are blocked, at least I think there’s an easy workaround: set
extraDirectories.paths
to a temporary directory (e.g.,extraDirectories.paths = ['build/my-libs-dir']
), set up aCopy
task to copy.so
files intomy-libs-dir
, and have Jib depend on the Copy task. A bit of unnecessary copying here, but I think it will work. However, I’m not versed in Gradle at all, and I’m not sure if there’s a better workaround or even this makes sense.And we still want to go deeper into this issue to figure out what can be done generally, so it’ll be helpful for us to have a reproducible case.
@loosebazooka Sorry, I missed this message, I have reworked the unpacking task for another reason.
Before when it didn’t work, the unpacking task was
This approach don’t work well as the task outputs (
unpackLibsodium.outputs
) are not present if the task didn’t run, also referring tounpackLibsodium.linuxLibraryFile
don’t work (https://github.com/gradle/gradle/issues/15284).After my refactoring the unpack task looks like this
With this setup, the
outDir
property is known before the unpack task is run, and as it is declared in theext
block of the task, it can be referred to asunpackLibsodium.outDir
in the jib, which does seem to work. Your suggestion to work around the issue is in fact very similar.Still I think having the possibility to pass a closure there would be useful.