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

[SR-2866] [SwiftPM] Need a way to include resources with targets #5199

Closed
ddunbar opened this issue Oct 5, 2016 · 21 comments
Closed

[SR-2866] [SwiftPM] Need a way to include resources with targets #5199

ddunbar opened this issue Oct 5, 2016 · 21 comments
Labels

Comments

@ddunbar
Copy link
Contributor

ddunbar commented Oct 5, 2016

Previous ID SR-2866
Radar rdar://problem/34480872
Original Reporter @ddunbar
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 115
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: ff37c4c7be00b80a1eb47bf7e441933b

is duplicated by:

  • SR-2751 Errors using Swift Package Manager
  • SR-8260 Implementation story for resources

relates to:

  • SR-4725 Support Test Collateral in Package Manager

Issue Description:

The Swift package manager needs a story for how packages should specify resources to include with products.

On Darwin, this would traditionally be done with a Resources folder in a framework. On Linux, it is less clear what should happen, and we will want users to have access to a reliable cross-platform mechanism for resources.

@swift-ci
Copy link
Contributor

Comment by Ondrej Rafaj (JIRA)

So I think that a cool way to allow this would be to import of thirdparty code into the Package.swift file so people can do their own implementation.

At the moment I have a lib like this https://github.com/LiveUI/SwiftResources which imports my resources at the runtime but having something that would execute it during build (or at least to be able to create a target which would be a dependency to my main target and executed before I run my main target) would solve this issue for me at least a bit.

@belkadan
Copy link

SR-8260 has a writeup of how this could look.

@swift-ci
Copy link
Contributor

Comment by Werner Altewischer (JIRA)

Any progress on this?

@swift-ci
Copy link
Contributor

Comment by Alban Deflandre (JIRA)

Any update?

@swift-ci
Copy link
Contributor

Comment by Bastian Mueller (JIRA)

@ddunbar @belkadan Any update on this? Using Swift Package Manager is great and using XCTest is great as well, but without support for resources/assets/fixtures it's really painful to write some tests, i.e., currently expected output needs to be inlined.

@ddunbar
Copy link
Contributor Author

ddunbar commented Mar 18, 2019

turbolent (JIRA User) I don't have any update on the comment, but a common trick I use for tests is to find resources relative to Swift's #file.

@swift-ci
Copy link
Contributor

swift-ci commented Apr 3, 2019

Comment by Guillermo Ignacio Enriquez Gutierrez (JIRA)

I am also interested in an official support for resources too.

I haven't checked tests very well but when using resources in the Sources directory results are different according environment.

I have a simple program here

  1. In macos swift run: program works as expected (resources are reachable).

  2. In macos swift package generate-xcodeproj then run in Xcode: program does NOT work as expected (paths are NOT found, because resources are not imported into Xcode project).

  3. In linux (via Docker) swift run: program does NOT work as expected (paths are NOT found).

I checked at some sources like Kitura swift server framework and they try really hard to find absolute paths... I wish there was a standard and easy way to find resources within the application.

@swift-ci
Copy link
Contributor

Comment by Richard Venable (JIRA)

Any progress being made on Anders' proposal? https://github.com/abertelrud/swift-evolution/blob/package-manager-resources/proposals/NNNN-package-manager-resources.md

@swift-ci
Copy link
Contributor

swift-ci commented Jun 7, 2019

Comment by Pavan (JIRA)

I think it would be great support if it's get included in before final Xcode11 releases

@swift-ci
Copy link
Contributor

swift-ci commented Jun 8, 2019

Comment by Christophe Braud (JIRA)

Totally agree with pavm035 (JIRA User) 👍 😃

@swift-ci
Copy link
Contributor

swift-ci commented Jun 8, 2019

Comment by Ondrej Rafaj (JIRA)

If we only could add custom code to the package file to happen on execution. That way any missing feature could be handled by the developer.

@swift-ci
Copy link
Contributor

swift-ci commented Jun 8, 2019

Comment by Alban Deflandre (JIRA)

We all agree with Pavan, but is someone listening us?

@swift-ci
Copy link
Contributor

Comment by Pavan (JIRA)

Any update, we really keep looking for this feature!!!

@swift-ci
Copy link
Contributor

swift-ci commented Aug 7, 2019

Comment by Guillermo Ignacio Enriquez Gutierrez (JIRA)

Some discussion is happening here:
https://forums.swift.org/t/swift-pm-bundles-and-resources/13981/34

Not very active recently but maybe there is an update there. (I just wrote my opinion about the proposal there)

I am really looking forward resources support in SPM 🙂

@swift-ci
Copy link
Contributor

swift-ci commented Sep 5, 2019

Comment by Basem Emara (JIRA)

Embedding resources are a show-stopper for a large chunk of Swift frameworks out there. Is there still time to get one released before beta ends?

@swift-ci
Copy link
Contributor

swift-ci commented Sep 5, 2019

Comment by Petro Rovenskyy (JIRA)

Please add a possibility to embedding resources. It's not fair that Xcode 11 has sPM support but sPM package can't handle even localizations. Please prioritize.

@idrougge
Copy link

What Petro said. So many non-trivial tools depend on proper localisation support.�

@JaviSoto
Copy link

There's now a draft proposal for this: https://forums.swift.org/t/draft-proposal-package-resources/29941

@swift-ci
Copy link
Contributor

Comment by Emma Foster (JIRA)

The proposal above has been accepted with modifications: https://forums.swift.org/t/se-0271-package-manager-resources/30730/63

@MaxDesiatov
Copy link
Contributor

Would anyone mind if this is resolved as "Done"?

@swift-ci
Copy link
Contributor

swift-ci commented Mar 2, 2021

Comment by Jason Wray (JIRA)

This happened in Swift tools version 5.3 and Xcode 12 — here's a doc on how to get started with resources in packages.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants