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

[Question] How to deal with resources/localization keys? #120

Open
acecilia opened this issue Sep 11, 2019 · 0 comments
Open

[Question] How to deal with resources/localization keys? #120

acecilia opened this issue Sep 11, 2019 · 0 comments

Comments

@acecilia
Copy link

acecilia commented Sep 11, 2019

Hi:

In order to get compile time checks on the resources and localization files used in my app, I do the following:
1- I create a standalone library called Resources.
2- I use SwiftGen to populate that library with a binary representation of the resources of the app App1.
3- At this point I use Resources as a dependency of other libraries to safely retrieve resources or localized strings.

The folder structure + dependency graph is as follows:

- App1
  * Depends on: //OtherLibraries/OtherLibrary1
  |
  |- Resources

- OtherLibraries
  |
  |- OtherLibrary1
     * Depends on: //App1/Resources

The problem comes when adding a second app to the repository:

- App1
  * Depends on: //OtherLibraries/OtherLibrary1
  |
  |- Resources

- App2
  * Depends on: //OtherLibraries/OtherLibrary1 <-- Here the Resources library that is being used is the one under App1, and this is wrong: it should be the one under App2
  |
  |- Resources

- OtherLibraries
  |
  |- OtherLibrary1
     * Depends on: //App1/Resources

The way this is done in Xcode is by using implicit dependencies inside the Xcode projects that get resolved when that project is inside a workspace (yonaskolb/XcodeGen#224 (comment)).

Is there any way to work around this problem in Buck? For example:

  • By somehow inject the location of the Resources dependency to OtherLibrary1?
  • By not fully specifying the location of the Resources library in OtherLibrary1, and letting App1 and App2 rules control it?
  • By having a unique Resources library that depends on a genrule in charge of generating the code from the resources? But, in this case, how to tell the genrule which app resources to use during code generation?
  • Any other completely different way that enables compile time safety on resources and lozalization files?

Thanks!

PD: I tried joining the slack channel in order to post this question, but I couldn't because it's limited to employees of specific companies, so I decided to open this issue.

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

No branches or pull requests

1 participant