|
| 1 | +# Firebase Zip File Builder |
| 2 | + |
| 3 | +This project builds the Firebase iOS Zip file for distribution. |
| 4 | +More instructions to come. |
| 5 | + |
| 6 | +## Priorities |
| 7 | + |
| 8 | +The following section describes the priorities taken while building this tool and should be followed |
| 9 | +for any modifications. |
| 10 | + |
| 11 | +### Readable and Maintainable |
| 12 | +This code will rarely be modified outside of bug fixes, but read very frequently. There should be no |
| 13 | +"magic lines" that do multiple things. Verbosity is preferred over making the code shorter and |
| 14 | +performing multiple actions at once. All functions should be well documented. |
| 15 | + |
| 16 | +### Avoid Calling bash Commands Where Possible |
| 17 | +Instead of using `cat`, `find`, `grep`, or `perl` use `String` APIs to read the contents of a file, |
| 18 | +`FileManager` to properly list contents of a directory, `RegularExpression` for pattern matching, |
| 19 | +etc. If there's a `Foundation` API available, it should be used. |
| 20 | + |
| 21 | +### Understandable Output |
| 22 | +The output of the script should make it immediately obvious if there were any issues and exactly |
| 23 | +what those issues were, without looking at the code. It should also be very clear if the Zip file |
| 24 | +was properly built and output the file location. |
| 25 | + |
| 26 | +### Show Xcode and API Output on Failures |
| 27 | +In the event that there's an Xcode build failure, the logs should be surfaced immediately to aid |
| 28 | +debugging. Release engineers should not have to find the Xcode project manually. That being said, a |
| 29 | +link to the Xcode project file should be logged as well in case it's necessary. Same goes for errors |
| 30 | +logged by exceptions (ex: `FileManager`). |
| 31 | + |
| 32 | +### Testable and Debuggable |
| 33 | +Components and functions should be split up in a way that make them easy to test and easy to debug. |
| 34 | +Prefer small functions that have proper failure conditions and input validated with `guard` |
| 35 | +statements, throwing `fatalError` with a well written error message if it's a critical issue that |
| 36 | +prevents the Zip file from being built properly. |
| 37 | + |
| 38 | +### Works from the Command Line or Xcode (Environment Agnostic) |
| 39 | +The script should be able to run from the command line to allow for easier automation and Xcode for |
| 40 | +simpler debugging and maintenance. |
| 41 | + |
| 42 | +### Any Failure Exits Immediately |
| 43 | +The script should not continue if anything necessary for a successful Zip file fails. This includes |
| 44 | +things like compiling storyboards, moving resources, missing files, etc. This is to ensure the |
| 45 | +integrity of the zip file and that any issues during testing are SDK bugs and not related to the |
| 46 | +files and folders. |
| 47 | + |
| 48 | +### Prefer File `URL`s over Strings |
| 49 | +Instead of relying on `String`s to represent file paths, use `URL`s as soon as possible to avoid any |
| 50 | +missed or double slashes along with other issues. |
0 commit comments