@@ -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+
6295mkdir ( DerivedDataDir)
6396mkdir ( BuiltProductsDir)
6497
@@ -223,34 +256,23 @@ cp(from: "README.md", to: BuiltProductsDir)
223256
224257// copy sample projects
225258cp ( from: " samples " , to: BuiltProductsDir)
259+ rm ( BuiltProductsDir + " samples/objc/Pods " , isDirectory: true , isStrict: false )
260+ rm ( BuiltProductsDir + " samples/objc/Podfile.lock " , isDirectory: false , isStrict: false )
261+ rm ( BuiltProductsDir + " samples/objc/GoogleService-Info.plist " , isDirectory: false , isStrict: false )
262+ rm ( BuiltProductsDir + " samples/swift/Pods " , isDirectory: true , isStrict: false )
263+ rm ( BuiltProductsDir + " samples/swift/Podfile.lock " , isDirectory: false , isStrict: false )
264+ rm ( BuiltProductsDir + " samples/swift/GoogleService-Info.plist " , isDirectory: false , isStrict: false )
265+ rm ( BuiltProductsDir + " samples/objc/FirebaseUIChat.xcodeproj/xcuserdata " , isDirectory: true , isStrict: false )
266+ rm ( BuiltProductsDir + " samples/objc/FirebaseUIChat.xcworkspace/xcuserdata " , isDirectory: true , isStrict: false )
267+ rm ( BuiltProductsDir + " samples/swift/uidemo.xcodeproj/xcuserdata " , isDirectory: true , isStrict: false )
268+ rm ( BuiltProductsDir + " samples/swift/uidemo.xcworkspace/xcuserdata " , isDirectory: true , isStrict: false )
269+ ln ( from: " ./objc/FirebaseUIChat.xcworkspace " , to: BuiltProductsDir + " samples/FirebaseUI-demo-objc.xcworkspace " )
270+ ln ( from: " ./swift/uidemo.xcworkspace " , to: BuiltProductsDir + " samples/FirebaseUI-demo-swift.xcworkspace " )
226271
227272// 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-
251273zip ( " FirebaseUIFrameworks " , output: " FirebaseUIFrameworks.zip " )
252274
253- rm ( DerivedDataDir, isDirectory: true )
254- rm ( BuiltProductsDir, isDirectory: true )
275+ rm ( DerivedDataDir, isDirectory: true , isStrict : true )
276+ rm ( BuiltProductsDir, isDirectory: true , isStrict : true )
255277
256278exit ( 0 )
0 commit comments