Mike Dougherty | d8947a59 | 2020-05-07 19:43:46 | [diff] [blame] | 1 | # Developing Chrome for iOS with the Xcode IDE |
| 2 | |
| 3 | This document contains notes used during a presentation about how to use Xcode |
| 4 | to develop Chrome for iOS. |
| 5 | |
| 6 | ## Background |
| 7 | |
Sylvain Defresne | fc11bcd | 2020-06-26 13:42:00 | [diff] [blame] | 8 | ### .xcodeproj |
Mike Dougherty | d8947a59 | 2020-05-07 19:43:46 | [diff] [blame] | 9 | |
Sylvain Defresne | fc11bcd | 2020-06-26 13:42:00 | [diff] [blame] | 10 | * Open all.xcodeproj only. |
Mike Dougherty | d8947a59 | 2020-05-07 19:43:46 | [diff] [blame] | 11 | * Generated from BUILD.gn files. |
| 12 | * Don't make changes to it as it is a "fake" representation of the project |
| 13 | - changes will not be committed |
| 14 | - changes will be overwritten without warning |
| 15 | * Modify BUILD files instead |
| 16 | * Added BUILD.gn files/`source_sets` need to be referenced from other ones as |
| 17 | a `dep` in order for it to be shown in xcode. |
| 18 | |
Mike Dougherty | d8947a59 | 2020-05-07 19:43:46 | [diff] [blame] | 19 | ### Adding new files |
| 20 | |
| 21 | * Create new files with `tools/boilerplate.py` |
| 22 | * Add files to BUILD.gn `mate ios/chrome/...BUILD.gn` |
| 23 | * Add new source_set target as a dep of another target |
| 24 | * Execute `gclient runhooks` or `gclient sync` |
| 25 | |
| 26 | ### Simulators |
| 27 | |
| 28 | * Simulators build for Mac architecture, not emulators. Fast, generally good |
| 29 | for most development |
| 30 | * To run on device, need provisioning profiles and certificate |
| 31 | |
| 32 | ## Xcode |
| 33 | |
Sylvain Defresne | fc11bcd | 2020-06-26 13:42:00 | [diff] [blame] | 34 | * Project location is `src/out/build/`, open `all.xcodeproj` |
Mike Dougherty | d8947a59 | 2020-05-07 19:43:46 | [diff] [blame] | 35 | * Choose "Automatically generate targets" after a `gclient sync` |
| 36 | * Start typing while dropdowns are presented to filter the displayed items |
| 37 | |
| 38 | ### Targets |
| 39 | |
| 40 | * `chrome' is the main application target |
| 41 | * `ios_web_shell` and `ios_web_view_shell` test lower level of application |
| 42 | |
| 43 | ### Tests |
| 44 | |
| 45 | * Unittests/Inttests |
| 46 | - Add flags to specify tests to run (Option-Click on unittest target name, |
| 47 | select Run from left panel, add to "Arguments Passed on Launch") |
| 48 | - `gtest_filter=TestClass.*` |
| 49 | - `gtest_repeat=20` |
| 50 | - Full list of options available by sending an unknown option |
| 51 | |
| 52 | * EarlGrey |
| 53 | - EG1 deprecated |
| 54 | - EG2 are current UI tests |
| 55 | - A separate "test" process communicates with "the app". |
| 56 | - EDO is term for "distant object" on "the other side". |
| 57 | - egtest files can run under both EG1 and EG2 with correct setup in |
| 58 | BUILD.gn because the layer of helpers encapsulate the necessary |
| 59 | differences. |