google / EarlGrey

:tea: iOS UI Automation Test Framework
http://google.github.io/EarlGrey/
Apache License 2.0
5.62k stars 744 forks source link

EarlGrey needs to be built twice via Carthage so that OCMock gets built as well #818

Open juraj-blahunka opened 5 years ago

juraj-blahunka commented 5 years ago

Xcode 10.2 Build version 10E125

Cartfile:

github "google/EarlGrey" "master"

Let's initialize Cartfile.resolved via update, but not build yet:

$ carthage update --no-build

Cartfile.resolved:

github "google/EarlGrey" "87ffa7ac2517cc8931e4e6ba11714961cbac6dd7"

At this point, the Carthage/Checkouts/EarlGrey folder has been populated with the following:

-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users  25082 Apr 12 10:43 CHANGELOG.md
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   6039 Apr 12 10:43 CONTRIBUTING.md
drwxr-xr-x   4 jblahunka  SKYDIVE\Domain Users    128 Apr 12 10:43 Demo
drwxr-xr-x  17 jblahunka  SKYDIVE\Domain Users    544 Apr 12 10:43 EarlGrey
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   1265 Apr 12 10:43 EarlGrey-Info.plist
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   1749 Apr 12 10:43 EarlGrey.podspec.json
drwxr-xr-x   5 jblahunka  SKYDIVE\Domain Users    160 Apr 12 10:43 EarlGrey.xcodeproj
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users  29977 Apr 12 10:43 LICENSE
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   5578 Apr 12 10:43 README.md
drwxr-xr-x   8 jblahunka  SKYDIVE\Domain Users    256 Apr 12 10:43 Scripts
drwxr-xr-x   4 jblahunka  SKYDIVE\Domain Users    128 Apr 12 10:43 Tests
drwxr-xr-x  14 jblahunka  SKYDIVE\Domain Users    448 Apr 12 10:43 docs
drwxr-xr-x  12 jblahunka  SKYDIVE\Domain Users    384 Apr 12 10:43 gem

Let's try building the framework:


*** No cache found for EarlGrey, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/48/sy74dwmd3_n9ym1dc0fh1fhhj37rwj/T/carthage-xcodebuild.p1bMKl.log
*** Building scheme "EarlGrey" in EarlGrey.xcodeproj

which produces the following in Carthage/Build/iOS:

drwxr-xr-x  7 jblahunka  SKYDIVE\Domain Users  224 Apr 12 11:06 EarlGrey.framework
drwxr-xr-x  3 jblahunka  SKYDIVE\Domain Users   96 Apr 12 11:06 EarlGrey.framework.dSYM

However there is no OCMock! When I inspect the checkout folders, I can now see a new entry OCHamcrest.framework:

-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users  25082 Apr 12 11:04 CHANGELOG.md
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   6039 Apr 12 11:04 CONTRIBUTING.md
drwxr-xr-x   4 jblahunka  SKYDIVE\Domain Users    128 Apr 12 11:04 Demo
drwxr-xr-x  17 jblahunka  SKYDIVE\Domain Users    544 Apr 12 11:04 EarlGrey
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   1265 Apr 12 11:04 EarlGrey-Info.plist
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   1749 Apr 12 11:04 EarlGrey.podspec.json
drwxr-xr-x   5 jblahunka  SKYDIVE\Domain Users    160 Apr 12 11:04 EarlGrey.xcodeproj
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users  29977 Apr 12 11:04 LICENSE
drwxr-xr-x   6 jblahunka  SKYDIVE\Domain Users    192 Apr 12 11:05 OCHamcrest.framework
-rw-r--r--   1 jblahunka  SKYDIVE\Domain Users   5578 Apr 12 11:04 README.md
drwxr-xr-x   8 jblahunka  SKYDIVE\Domain Users    256 Apr 12 11:05 Scripts
drwxr-xr-x   4 jblahunka  SKYDIVE\Domain Users    128 Apr 12 11:04 Tests
drwxr-xr-x  14 jblahunka  SKYDIVE\Domain Users    448 Apr 12 11:04 docs
drwxr-xr-x   7 jblahunka  SKYDIVE\Domain Users    224 Jan 20  2016 fishhook
drwxr-xr-x  12 jblahunka  SKYDIVE\Domain Users    384 Apr 12 11:04 gem

Let's rebuild the framework:

$ rm -rf Carthage/Build
$ carthage build --platform iOS --cache-builds EarlGrey

*** No cache found for EarlGrey, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/48/sy74dwmd3_n9ym1dc0fh1fhhj37rwj/T/carthage-xcodebuild.pwKX6R.log
*** Building scheme "EarlGrey" in EarlGrey.xcodeproj
*** Building scheme "OCMock iOS" in OCMock.xcodeproj

Suddenly the OCMock framework appears in the Carthage/Build/iOS folder:

-rw-------  1 jblahunka  SKYDIVE\Domain Users  29632 Apr 12 11:13 E2F985D7-F7AC-3254-BE7F-64BF7A55CA97.bcsymbolmap
drwxr-xr-x  7 jblahunka  SKYDIVE\Domain Users    224 Apr 12 11:13 EarlGrey.framework
drwxr-xr-x  3 jblahunka  SKYDIVE\Domain Users     96 Apr 12 11:13 EarlGrey.framework.dSYM
-rw-------  1 jblahunka  SKYDIVE\Domain Users  26770 Apr 12 11:13 FDF11BB2-FFF9-352D-8510-DB72FFA2EE02.bcsymbolmap
drwxr-xr-x  6 jblahunka  SKYDIVE\Domain Users    192 Apr 12 11:13 OCMock.framework
drwxr-xr-x  3 jblahunka  SKYDIVE\Domain Users     96 Apr 12 11:13 OCMock.framework.dSYM
tirodkar commented 5 years ago

We don't have a direct dependency on OCMock in EarlGrey. Could this be tweaked so that OCMock gets built only at one of the steps?

carthage build --platform iOS --cache-builds EarlGrey Why is OCMock being built here?

juraj-blahunka commented 5 years ago

carthage build --platform iOS --cache-builds EarlGrey Why is OCMock being built here?

I haven't investigated, however this is what happens in a clean project with a single EarlGrey dependency in Cartfile.