SwiftGen / SwiftGenKit

The framework behind SwiftGen, responsible for parsing various resources and turn them into Stencil contexts
MIT License
9 stars 8 forks source link

Add "path" to the fonts contexts #25

Closed AliSoftware closed 7 years ago

AliSoftware commented 7 years ago

So that we can later add templates to generate th Info.plist's UIAppFonts key content

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
{% for family in families %}
  <!-- {{family.name}} -->
  {% for font in family.fonts %}
  <string>{{font.path}}</string>
  {% endfor %}
{% endfor %}
</array>
</plist>

See also SwiftGen/templates#37

AliSoftware commented 7 years ago

Mmmmh tests pass locally on my machine, not sure why they don't pass the CI… will have to investigate later (I didn't see I wasn't logged in at first and thus didn't see the artefacts, which was a bit puzzling… time to :zzz: I guess)

djbe commented 7 years ago

Is it possible for a font to be in a subfolder? (and not just the root of the bundle) If so, is it a use case we want to cover?

Edit: never mind, too early in the morning. Just re-read the implementation and noticed that parent is the path to the directory you're scanning, so you support sub-folders 🎉

djbe commented 7 years ago

Seeing the diff on github, your templates commit (submodule) also seems to have changes for storyboards, but looking at the diff for the templates PR, that isn't the case... weird stuff 😆

AliSoftware commented 7 years ago

Submodules joy I guess

AliSoftware commented 7 years ago

Ah, I think #27 and #30 forgot to update the submodules on SwiftGenKit?

Because with this commit I've moved the submodule from f963082efbada6cce373aeb0b58f6905d6f24451 (HEAD) to 0171473e1be23304caa3aa884082b7b3f2d39dc3, but template's masters 2 commits after f963082efbada6cce373aeb0b58f6905d6f24451 . So when you're in SwiftGenKit's master, its submodules doesn't point to templates' master, that's where the divergence comes from I think.

AliSoftware commented 7 years ago

capture d ecran 2017-04-21 a 16 36 18 (submodule was on "HEAD" before I pushed my changes, so the storyboards diff comes from between HEAD and Master)

djbe commented 7 years ago

Huh, weird that could happen. Will have to see if we can verify this in Danger. Created a quick PR to address this: https://github.com/SwiftGen/SwiftGenKit/pull/26

djbe commented 7 years ago

LGTM, I'll update #24 to match this.

djbe commented 7 years ago

Btw, don't forget (as I did) to update this PR to point to templates master after https://github.com/SwiftGen/templates/pull/37 is merged.

AliSoftware commented 7 years ago

Haha good point! :wink: