Skip to content

Commit 56807f3

Browse files
authored
GoogleUtilities to testspec and pod gen (#2908)
1 parent 93ebe6f commit 56807f3

File tree

6 files changed

+45
-18
lines changed

6 files changed

+45
-18
lines changed

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,23 @@ jobs:
102102
script:
103103
- travis_retry ./scripts/if_changed.sh ./scripts/build.sh $PROJECT $PLATFORM $METHOD
104104

105+
- stage: test
106+
env:
107+
- PROJECT=GoogleUtilities PLATFORM=iOS METHOD=pod-lib-lint
108+
before_install:
109+
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
110+
script:
111+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb GoogleUtilities.podspec
112+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb GoogleUtilities.podspec --use-libraries
113+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb GoogleUtilities.podspec --use-modular-headers
114+
105115
# pod lib lint to check build and warnings for dynamic framework build (use_frameworks!)
106116
- stage: test
107117
env:
108118
- PROJECT=Firebase PLATFORM=iOS METHOD=pod-lib-lint
109119
before_install:
110120
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
111121
script:
112-
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb GoogleUtilities.podspec
113122
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseAnalyticsInterop.podspec
114123
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseAuth.podspec
115124
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseAuthInterop.podspec
@@ -136,7 +145,6 @@ jobs:
136145
before_install:
137146
- ./scripts/install_prereqs.sh
138147
script:
139-
- travis_retry ./scripts/pod_lib_lint.rb GoogleUtilities.podspec --use-libraries
140148
- travis_retry ./scripts/pod_lib_lint.rb FirebaseAnalyticsInterop.podspec --use-libraries
141149
- travis_retry ./scripts/pod_lib_lint.rb FirebaseAuth.podspec --use-libraries
142150
- travis_retry ./scripts/pod_lib_lint.rb FirebaseAuthInterop.podspec --use-libraries

GoogleUtilities.podspec

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,12 @@ other Google CocoaPods. They're not intended for direct public usage.
9999
ud.private_header_files = 'GoogleUtilities/UserDefaults/Private/*.h'
100100
ud.dependency 'GoogleUtilities/Logger'
101101
end
102+
103+
s.test_spec 'unit' do |unit_tests|
104+
# All tests require arc except Tests/Network/third_party/GTMHTTPServer.m
105+
unit_tests.source_files = 'GoogleUtilities/Example/Tests/**/*.[mh]'
106+
unit_tests.requires_arc = 'GoogleUtilities/Example/Tests/*/*.[mh]'
107+
unit_tests.requires_app_host = true
108+
unit_tests.dependency 'OCMock'
109+
end
102110
end

GoogleUtilities/Example/Tests/Network/third_party/GTMHTTPServer.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ - (void)dealloc {
127127
[super dealloc];
128128
}
129129

130-
#if !TARGET_OS_IPHONE
131-
- (void)finalize {
132-
[self stop];
133-
[super finalize];
134-
}
135-
#endif
136-
137130
- (id)delegate {
138131
return delegate_;
139132
}

GoogleUtilities/Example/Tests/Swizzler/GULAppDelegateSwizzlerTest.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ @implementation GULTestAppDelegate
9191
/** YES if GULTestAppDelegate responds to application:openURL:sourceApplication:annotation:, NO
9292
* otherwise.
9393
*/
94+
#if TARGET_OS_IOS || TARGET_OS_TV
9495
static BOOL gRespondsToOpenURLHandler_iOS8;
96+
#endif
9597

9698
/** YES if GULTestAppDelegate responds to application:openURL:options:, NO otherwise. */
9799
static BOOL gRespondsToOpenURLHandler_iOS9;
@@ -109,10 +111,13 @@ @implementation GULTestAppDelegate
109111
+ (void)load {
110112
#pragma clang diagnostic push
111113
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
114+
112115
// Before being proxied, it should be only be able to respond to
113116
// application:openURL:sourceApplication:annotation:.
117+
#if TARGET_OS_IOS || TARGET_OS_TV
114118
gRespondsToOpenURLHandler_iOS8 = [self
115119
instancesRespondToSelector:@selector(application:openURL:sourceApplication:annotation:)];
120+
#endif
116121
gRespondsToOpenURLHandler_iOS9 =
117122
[self instancesRespondToSelector:@selector(application:openURL:options:)];
118123
gRespondsToHandleBackgroundSession =

GoogleUtilities/README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@ Instructions on how to adopt the app delegate swizzler for use by your SDK are a
1515

1616
## Development
1717

18-
Follow the subsequent instructions to develop, debug, and unit test
19-
GoogleUtilities:
20-
21-
```
22-
$ git clone [email protected]:firebase/firebase-ios-sdk.git
23-
$ cd firebase-ios-sdk/GoogleUtilities/Example
24-
$ pod update
25-
$ open GoogleUtilities.xcworkspace
26-
```
18+
Follow the subsequent instructions to develop, debug, unit test, and
19+
integration test FirebaseFunctions:
20+
21+
### Prereqs
22+
23+
- At least CocoaPods 1.7.0
24+
25+
### To Develop
26+
27+
- Run `pod gen GoogleUtilities.podspec`
28+
- `open gen/GoogleUtilities/GoogleUtilities.xcworkspace`
29+
30+
OR these two commands can be combined with
31+
32+
- `pod gen GoogleUtilities.podspec --auto-open --gen-directory="gen" --clean`
33+
34+
You're now in an Xcode workspace generate for building, debugging and
35+
testing the GoogleUtilities CocoaPod.
2736

2837
### Running Unit Tests
2938

scripts/if_changed.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ else
7878
check_changes '^(Firebase/Core|Functions|GoogleUtilities|FirebaseFunctions.podspec)'
7979
;;
8080

81+
GoogleUtilities-*)
82+
check_changes '^(GoogleUtilities|GoogleUtilities.podspec)'
83+
;;
84+
8185
InAppMessaging-*)
8286
check_changes '^(Firebase/InAppMessagingDisplay|InAppMessagingDisplay|InAppMessaging|'\
8387
'Firebase/InAppMessaging)'

0 commit comments

Comments
 (0)