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

Add API for fetching binary resources with project.resources.binary helpers #25237

Open
vlsi opened this issue May 31, 2023 · 3 comments
Open
Labels
a:feature A new functionality in:resource-handler resources files

Comments

@vlsi
Copy link
Contributor

vlsi commented May 31, 2023

Expected Behavior

There should be a possibility to refer binary resources just like there's project.resources.text.

Certain data formats can't be converted to text.

For instance, XML is a binary format, not a text one, and XML might contain the encoding in the <?xml version="1.0" encoding="..."?> pragma.
That means, project.resources.fromUri("..") is not a valid option to fetch XML contents, as Gradle would somehow decode the result to text form, and there's no proper way to decode XML without fully-workable XML decoder.

I would expect an API like project.resources.binary.fromUri("https://gist.githubusercontent.com/hsz/5bf5c84a6a2e36f2a6716f28f287783c/raw/b0ba02f53f5937643701b848cb3728b0f3dfb144/updates.xml").
In that case Gradle must not re-encode the contents, and it must tread the data as binary.

Current Behavior (optional)

Currently, only project.resources.text is available

Context

JetBrains/intellij-platform-gradle-plugin#1389 (comment)

Gradle 8.1.1

@eskatos
Copy link
Member

eskatos commented Jun 2, 2023

Thank you for your interest in Gradle!

This feature request is in the backlog of the relevant team, but this area of Gradle is currently not a focus one, so it might take a while before it gets implemented.

@Omico
Copy link

Omico commented Mar 29, 2024

Any updates? I'm getting fucked by this issue. I should really write by myself.
image

@mlopatkin
Copy link
Member

The request makes sense. However, the ResouceHandler API needs some work to integrate with the Provider API better, and we're reluctant to adding new ResourceHandler methods until this adaptation is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:resource-handler resources files
Projects
None yet
Development

No branches or pull requests

4 participants