Skip to content

Commit 68df442

Browse files
committed
add samples for 'pod try'
1 parent 54d929f commit 68df442

File tree

3 files changed

+49
-25
lines changed

3 files changed

+49
-25
lines changed

build.swift

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,39 @@ func cp(from source: String, to destination: String) -> Void {
5959
guard task.terminationStatus == 0 else { exit(task.terminationStatus) }
6060
}
6161

62+
func ln(from source: String, to destination: String) -> Void {
63+
let task = Process()
64+
task.launchPath = "/bin/ln"
65+
task.arguments = ["-s", source, destination]
66+
task.launch()
67+
task.waitUntilExit()
68+
guard task.terminationStatus == 0 else { exit(task.terminationStatus) }
69+
}
70+
71+
/// Moves files to trash
72+
func rm(_ path: String, isDirectory: Bool, isStrict: Bool) -> Void {
73+
let url = URL(fileURLWithPath: path, isDirectory: isDirectory)
74+
let fileManager = FileManager()
75+
do {
76+
try fileManager.trashItem(at: url, resultingItemURL: nil)
77+
} catch (let error) {
78+
if (isStrict) {
79+
print(fileManager.currentDirectoryPath)
80+
print(error)
81+
exit(1)
82+
}
83+
}
84+
}
85+
86+
func zip(_ input: String, output: String) -> Void {
87+
let task = Process()
88+
task.launchPath = "/usr/bin/zip"
89+
task.arguments = ["-r", "-9", "-y", output, input]
90+
task.launch()
91+
task.waitUntilExit()
92+
guard task.terminationStatus == 0 else { exit(task.terminationStatus) }
93+
}
94+
6295
mkdir(DerivedDataDir)
6396
mkdir(BuiltProductsDir)
6497

@@ -223,34 +256,25 @@ cp(from: "README.md", to: BuiltProductsDir)
223256

224257
// copy sample projects
225258
cp(from: "samples", to: BuiltProductsDir)
259+
cp(from: "FirebaseUI_dev_auth.podspec", to: BuiltProductsDir)
260+
cp(from: "FirebaseUI_dev_db.podspec", to: BuiltProductsDir)
261+
cp(from: "FirebaseUI_dev_fb.podspec", to: BuiltProductsDir)
262+
cp(from: "FirebaseUI_dev_ggl.podspec", to: BuiltProductsDir)
263+
cp(from: "FirebaseUI_dev_storage.podspec", to: BuiltProductsDir)
264+
cp(from: "FirebaseUI_dev_tw.podspec", to: BuiltProductsDir)
265+
rm(BuiltProductsDir + "samples/objc/Pods", isDirectory: true, isStrict: false)
266+
rm(BuiltProductsDir + "samples/objc/Podfile.lock", isDirectory: false, isStrict: false)
267+
rm(BuiltProductsDir + "samples/objc/GoogleService-Info.plist", isDirectory: false, isStrict: false)
268+
rm(BuiltProductsDir + "samples/swift/Pods", isDirectory: true, isStrict: false)
269+
rm(BuiltProductsDir + "samples/swift/Podfile.lock", isDirectory: false, isStrict: false)
270+
rm(BuiltProductsDir + "samples/swift/GoogleService-Info.plist", isDirectory: false, isStrict: false)
271+
ln(from: "./objc/FirebaseUIChat.xcworkspace", to: BuiltProductsDir + "samples/FirebaseUI-demo-objc.xcworkspace")
272+
ln(from: "./swift/uidemo.xcworkspace", to: BuiltProductsDir + "samples/FirebaseUI-demo-swift.xcworkspace")
226273

227274
// clean up build artifacts afterward
228-
229-
/// Moves files to trash
230-
func rm(_ path: String, isDirectory: Bool) -> Void {
231-
let url = URL(fileURLWithPath: path, isDirectory: isDirectory)
232-
let fileManager = FileManager()
233-
do {
234-
try fileManager.trashItem(at: url, resultingItemURL: nil)
235-
} catch (let error) {
236-
print(fileManager.currentDirectoryPath)
237-
print(error)
238-
exit(1)
239-
}
240-
}
241-
242-
func zip(_ input: String, output: String) -> Void {
243-
let task = Process()
244-
task.launchPath = "/usr/bin/zip"
245-
task.arguments = ["-r", "-9", output, input]
246-
task.launch()
247-
task.waitUntilExit()
248-
guard task.terminationStatus == 0 else { exit(task.terminationStatus) }
249-
}
250-
251275
zip("FirebaseUIFrameworks", output: "FirebaseUIFrameworks.zip")
252276

253-
rm(DerivedDataDir, isDirectory: true)
254-
rm(BuiltProductsDir, isDirectory: true)
277+
rm(DerivedDataDir, isDirectory: true, isStrict: true)
278+
rm(BuiltProductsDir, isDirectory: true, isStrict: true)
255279

256280
exit(0)
-350 KB
Binary file not shown.
-350 KB
Binary file not shown.

0 commit comments

Comments
 (0)