@@ -19,18 +19,40 @@ import Foundation
19
19
import FirebaseManifest
20
20
import Utils
21
21
22
+ private enum Destination {
23
+ case cpdc, trunk
24
+ }
25
+
22
26
enum Push {
23
27
static func pushPodsToCPDC( gitRoot: URL ) {
28
+ push ( to: . cpdc, gitRoot: gitRoot)
29
+ }
30
+
31
+ static func publishPodsToTrunk( gitRoot: URL ) {
32
+ push ( to: . trunk, gitRoot: gitRoot)
33
+ }
34
+
35
+ private static func push( to destination: Destination , gitRoot: URL ) {
24
36
let cpdcLocation = findCpdc ( gitRoot: gitRoot)
25
37
let manifest = FirebaseManifest . shared
26
38
27
39
for pod in manifest. pods. filter ( { $0. releasing } ) {
28
- let warningsOK = pod. allowWarnings ? " --allow-warnings " : " "
40
+ let warningsOK = pod. allowWarnings ? " --allow-warnings " : " "
41
+
42
+ let command : String = {
43
+ switch destination {
44
+ case . cpdc:
45
+ return " pod repo push --skip-tests --use-json \( warningsOK) \( cpdcLocation) " +
46
+ pod. skipImportValidation ( ) + " \( pod. podspecName ( ) ) " +
47
+ " --sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org "
29
48
30
- Shell . executeCommand ( " pod repo push --skip-tests --use-json \( warningsOK) \( cpdcLocation) " +
31
- pod. skipImportValidation ( ) + " \( pod. podspecName ( ) ) " +
32
- " --sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org " ,
33
- workingDir: gitRoot)
49
+ case . trunk:
50
+ return " pod trunk push --skip-tests --synchronous \( warningsOK) " +
51
+ pod. skipImportValidation ( ) + " ~/.cocoapods/repos/ \( cpdcLocation) /Specs/ \( pod. name) / " +
52
+ " \( manifest. versionString ( pod) ) / \( pod. name) .podspec.json "
53
+ }
54
+ } ( )
55
+ Shell . executeCommand ( command, workingDir: gitRoot)
34
56
}
35
57
}
36
58
0 commit comments