e-sites / Natrium

A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
https://www.e-sites.nl
MIT License
146 stars 15 forks source link

AppIcon contents.json generation #10

Closed mpsnp closed 6 years ago

mpsnp commented 6 years ago

Here is the problem: if i entirelly ignore and remove AppIcon.appiconset folder, then natrium fails to generate it. but if i commit only contents.json inside of it, natrium doesn't use ordering while generating this json, and it changes each time it is generated.

What's the best practice of using natrium with AppIcon?

basvankuijck commented 6 years ago

And what if you put Project/Resources/Assets.xcassets/AppIcon.appiconset/*.pngin your .gitignore ? But keep the Contents.json

mpsnp commented 6 years ago

@basvankuijck natrium reorders keys inside of Contents.json each time it is generated. If you use codable for that, it supports sorting alphabetically as i remember (but it works inside of objects). In order to keep "images" contents pretty, we need to sort this array somehow too.

basvankuijck commented 6 years ago

@mpsnp: I saw that too. v6.0.2 should have fixed that

mpsnp commented 6 years ago

@basvankuijck are you sure, that you don't need to add extra option here for sorting?

basvankuijck commented 6 years ago

@basvankuijck are you sure, that you don't need to add extra option here for sorting?

Yeah that should work. You can also remove the directory entirely and git ignore Project/Resources/Assets.xcassets/AppIcon.appiconset/ completely.

Because the parser now checks if the directory exists and creates it if necessary: https://github.com/e-sites/Natrium/blob/master/Sources/Parsers/AppIconParser.swift#L58

mpsnp commented 6 years ago

Great, thank's @basvankuijck for fast responce! Really helped 👍