|
1 | 1 | class ExternalDownloadSource |
2 | 2 | { |
| 3 | + // Most of these archives live under the Firebase analytics path, but Google publishes |
| 4 | + // other SDKs under different hosts/paths, so the prefix is overridable. |
| 5 | + const string DefaultUrlPrefix = "https://dl.google.com/firebase/ios/analytics"; |
| 6 | + |
3 | 7 | public string Id { get; } |
4 | 8 | public string Version { get; } |
5 | 9 | public string ArchiveKey { get; } |
| 10 | + public string UrlPrefix { get; } |
6 | 11 |
|
7 | | - public ExternalDownloadSource (string id, string version, string archiveKey) |
| 12 | + public ExternalDownloadSource (string id, string version, string archiveKey, string urlPrefix = DefaultUrlPrefix) |
8 | 13 | { |
9 | 14 | Id = id; |
10 | 15 | Version = version; |
11 | 16 | ArchiveKey = archiveKey; |
| 17 | + UrlPrefix = urlPrefix; |
12 | 18 | } |
13 | 19 |
|
14 | 20 | public string ArchiveFileName => $"{Id}-{Version}.tar.gz"; |
15 | 21 | public string ExtractionRootName => $"{Id}-{Version}"; |
16 | | - public string Url => $"https://dl.google.com/firebase/ios/analytics/{ArchiveKey}/{ArchiveFileName}"; |
| 22 | + public string Url => $"{UrlPrefix}/{ArchiveKey}/{ArchiveFileName}"; |
17 | 23 | } |
18 | 24 |
|
19 | 25 | // *.tar.gz URLs can be found in the podspecs (e.g., CocoaPods Specs repo paths), such as: |
20 | 26 | // FirebaseAnalytics: https://github.com/CocoaPods/Specs/tree/master/Specs/e/2/1/FirebaseAnalytics |
21 | 27 | // GoogleAppMeasurement: https://github.com/CocoaPods/Specs/tree/master/Specs/e/3/b/GoogleAppMeasurement |
| 28 | +// GooglePlaces: https://github.com/CocoaPods/Specs/tree/master/Specs/c/3/2/GooglePlaces |
22 | 29 | var ExternalDownloads = new Dictionary<string, ExternalDownloadSource> { |
23 | 30 | { "FirebaseAnalytics", new ExternalDownloadSource ("FirebaseAnalytics", "12.10.0", "3c185b45848d98d8") }, |
24 | 31 | { "GoogleAppMeasurement", new ExternalDownloadSource ("GoogleAppMeasurement", "12.10.0", "5f5e4d8cb469941e") }, |
| 32 | + { "GooglePlaces", new ExternalDownloadSource ("GooglePlaces", "7.4.0", "3e8dc2602895d53405d075ff4eb569bff93ff1af97e69915d1e657c07ef28dd8", "https://dl.google.com/dl/geosdk") }, |
25 | 33 | }; |
26 | 34 |
|
27 | 35 | FilePath GetArchivePath (ExternalDownloadSource source, DirectoryPath externalsPath) => |
@@ -97,6 +105,27 @@ void FirebaseAnalyticsDownload () |
97 | 105 | }); |
98 | 106 | } |
99 | 107 |
|
| 108 | +void GooglePlacesDownload () |
| 109 | +{ |
| 110 | + var source = ExternalDownloads["GooglePlaces"]; |
| 111 | + |
| 112 | + DownloadAndExtract ( |
| 113 | + source, |
| 114 | + () => DirectoryExists (new DirectoryPath ("./externals/GooglePlaces.xcframework")), |
| 115 | + (extractionRoot, externalsPath, deleteSettings) => { |
| 116 | + var frameworkSource = extractionRoot.Combine ("Frameworks").Combine ("GooglePlaces.xcframework"); |
| 117 | + var frameworkDestination = externalsPath.Combine ("GooglePlaces.xcframework"); |
| 118 | + |
| 119 | + if (!DirectoryExists (frameworkSource)) |
| 120 | + throw new Exception ($"Expected GooglePlaces.xcframework at {frameworkSource} after extraction."); |
| 121 | + |
| 122 | + if (DirectoryExists (frameworkDestination)) |
| 123 | + DeleteDirectory (frameworkDestination, deleteSettings); |
| 124 | + |
| 125 | + CopyDirectory (frameworkSource, frameworkDestination); |
| 126 | + }); |
| 127 | +} |
| 128 | + |
100 | 129 | void GoogleAppMeasurementDownload () |
101 | 130 | { |
102 | 131 | var source = ExternalDownloads["GoogleAppMeasurement"]; |
|
0 commit comments