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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FileSystem.RESOURCES on GraalVM #1293

Open
jeancharles-roger opened this issue Jul 13, 2023 · 1 comment
Open

Support FileSystem.RESOURCES on GraalVM #1293

jeancharles-roger opened this issue Jul 13, 2023 · 1 comment

Comments

@jeancharles-roger
Copy link

Hi,

I've been using Okio (version 3.3.0) to manage files on a multi-platform project and it works just fine, thanks 馃憤.

In this project I build a cli tool using GraalVM to produce an executable. I copy a set of files on initialization to a tmp dir, it works just fine with jvm but I can't get it to work in a GraalVM executable.

val source = "/modules".toPath()
FileSystem.RESOURCES.listRecursively(source).forEach {
    if (FileSystem.RESOURCES.metadata(it).isRegularFile) {
        val stream = Common::class.java.getResourceAsStream(it.toString())
        if (stream != null) {
            val local = it.relativeTo(source)
            val target = modules.resolve(local)
            target.parent?.let { FS.createDirectories(it) }
            FS.write(target) { write(stream.readAllBytes()) }
        }
    }
}

I build the executable with this ressource inclusion file:

{
  "resources": {
    "includes": [
      {
        "pattern": "version.properties"
      },
      {
        "pattern": "modules/.*"
      }
    ]
  }
}

I believe that listing resources is not supported in a GraalVM executable but I may have used Okio in a wrong way.
I haven't any indication that it is not supported.
Can you tell if it is possible to list and copy resources using Okio from a GraalVM execute ?

Thanks for your help.

@swankjesse
Copy link
Member

Thanks for reporting this.

Our current implementation isn鈥檛 appropriate for GraalVM and we should fix that.

@swankjesse swankjesse changed the title FileSystem.RESOURCES problems with GraalVM Support FileSystem.RESOURCES on GraalVM Oct 2, 2023
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

2 participants