Skip to content

Commit

Permalink
Merge pull request #116 from morganchen12/build
Browse files Browse the repository at this point in the history
bump podspec version to 0.5.0, update sample project with new changes
  • Loading branch information
morganchen12 authored Sep 7, 2016
2 parents 6ef7be1 + 38f0af9 commit 887db45
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 185 deletions.
9 changes: 5 additions & 4 deletions FirebaseUI.podspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Pod::Spec.new do |s|
s.name = 'FirebaseUI'
s.version = '0.4.0'
s.version = '0.5.0'
s.summary = 'UI binding libraries for Firebase.'
s.homepage = 'https://github.com/firebase/FirebaseUI-iOS'
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
s.license = { :type => 'Apache 2.0' }
s.author = 'Firebase'
s.source = { :http => 'https://dl.google.com/firebase/firebaseui/ios/0_4_0/FirebaseUIFrameworks.zip' }
s.source = { :http => 'https://dl.google.com/dl/firebase/firebaseui/ios/0_5_0/FirebaseUIFrameworks.zip' }
s.platform = :ios
s.ios.deployment_target = '7.0'
s.ios.deployment_target = '8.0'
s.ios.framework = 'UIKit'
s.requires_arc = true
s.default_subspecs = 'All'
s.ios.vendored_frameworks = 'FirebaseUIFrameworks/*/Frameworks/*.framework'

s.subspec 'All' do |all|
all.dependency 'FirebaseUI/Database'
Expand Down
113 changes: 42 additions & 71 deletions FirebaseUI.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
// limitations under the License.
//

#import <Foundation/Foundation.h>

#import "FIRAuthProviderUI.h"
#import "FirebaseAuthUI.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#import <FirebaseAuth/FIRFacebookAuthProvider.h>
#import <FirebaseAuth/FIRUserInfo.h>
#import "FIRAuthUIErrorUtils.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
// limitations under the License.
//

#import <Foundation/Foundation.h>

#import "FIRAuthProviderUI.h"
#import "FirebaseAuthUI.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#import <GoogleSignIn/GoogleSignIn.h>
#import <FirebaseAuth/FIRGoogleAuthProvider.h>
#import <FirebaseAuth/FIRUserInfo.h>
#import "FIRAuthUIErrorUtils.h"

/** @var kGoogleGamesScope
@brief The OAuth scope string for the "Games" scope.
Expand Down
2 changes: 0 additions & 2 deletions FirebaseUI/Auth/AuthUI/Source/FIRAuthUIErrorUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// limitations under the License.
//

#import <Foundation/Foundation.h>

#import "FIRAuthUIErrors.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down
6 changes: 5 additions & 1 deletion FirebaseUI/Auth/AuthUI/Source/FIRAuthUIErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
// limitations under the License.
//

#import <Foundation/Foundation.h>
@import Foundation;

NS_ASSUME_NONNULL_BEGIN

/** @var FIRAuthUIErrorDomain
@brief The standard Firebase error domain.
Expand All @@ -41,3 +43,5 @@ typedef NS_ENUM(NSUInteger, FIRAuthUIErrorCode) {
*/
FIRAuthUIErrorCodeProviderError = 2,
};

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion FirebaseUI/Auth/AuthUI/Source/FirebaseAuthUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
#import "FIRAuthProviderUI.h"
#import "FIRAuthUI.h"
#import "FIRAuthUIBaseViewController.h"
#import "FIRAuthUIErrors.h"
#import "FIRAuthUIErrorUtils.h"
178 changes: 178 additions & 0 deletions build.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
#!/usr/bin/env xcrun swift

// This script builds and lipos static libraries, but doesn't
// bundle assets for any of them.

import Foundation

// TODO: Use NSFileManager instead of all these awful
// manual path appendings and mkdir/mv/cp

let DerivedDataDir = "artifacts/"
let BuiltProductsDir = DerivedDataDir + "FirebaseUIFrameworks/"

// TODO: DRY out these NSTask functions

func mkdir(dirname: String) -> Void {
let task = NSTask()
task.launchPath = "/bin/mkdir"
task.arguments = ["-p", dirname]
task.launch()
task.waitUntilExit()
}

func mv(from source: String, to destination: String) -> Void {
let task = NSTask()
task.launchPath = "/bin/mv"
task.arguments = ["-n", "-v", source, destination]
task.launch()
task.waitUntilExit()
guard task.terminationStatus == 0 else { exit(task.terminationStatus) }
}

mkdir(DerivedDataDir)
mkdir(BuiltProductsDir)

// Build

// TODO: use xcrun to invoke dev tool commands

func buildTask(args args: [String] = []) -> NSTask {
let task = NSTask()
task.launchPath = "/usr/bin/xcodebuild"
task.arguments = args
return task
}

/// A value type representing an xcodebuild call.
/// param keys are parameters and expect leading dashes,
/// i.e. `-workspace`
struct Build {

var params: [String: String]

init(_ params: [String: String]) {
self.params = params
}

var args: [String] {
var params: [String] = []
let keys = self.params.keys
for key in keys {
params.append(key)
// can't remember what this line is supposed to do
let value = self.params[key].flatMap { return $0 }
if let value = value {
params.append(value)
}
}
return params
}

func launch() {
let task = buildTask(args: self.args)
task.launch()
task.waitUntilExit()
guard task.terminationStatus == 0 else {
exit(task.terminationStatus)
}
}
}

let sdks = ["iphoneos", "iphonesimulator"]
let frameworkMapping = [
"Database": "FirebaseDatabaseUI",
"Auth": "FirebaseAuthUI",
"Facebook": "FirebaseFacebookAuthUI",
"Google": "FirebaseGoogleAuthUI",
]
let schemes = Array(frameworkMapping.keys)
print("Schemes: \(schemes)")

// Create folder structure for built products
schemes.forEach { scheme in
let schemeDir = BuiltProductsDir + scheme
mkdir(schemeDir)
mkdir(schemeDir + "/Frameworks")
mkdir(schemeDir + "/Resources")

let frameworkDir = schemeDir + "/Frameworks/"
+ frameworkMapping[scheme]! + ".framework"
mkdir(frameworkDir + "/Modules")
}

// Create xcodebuild tasks from schemes and target sdks
let builds = sdks.flatMap { sdk in
return schemes.map { scheme in
return Build([
"-workspace" : "FirebaseUI.xcworkspace",
"-scheme" : scheme,
"-configuration" : "Release",
"-sdk" : sdk,
"-derivedDataPath": DerivedDataDir
])
}
}

// build everything in release
builds.forEach { build in
build.launch()

let scheme = build.params["-scheme"]!
let sdk = build.params["-sdk"]!
let headerPath = DerivedDataDir + "Build/Products/Release-"
+ sdk + "/usr/local/include"
let framework = frameworkMapping[scheme]! + ".framework"
let destination = BuiltProductsDir + scheme + "/Frameworks/"
+ framework + "/Headers"

// Headers only need to be moved once.
if (sdk == "iphoneos") {
mv(from: headerPath, to: destination)
}
}

// Lipo

/// A value type representing an invocation of `lipo -create`.
struct Lipo {
var inputs: [String]
var output: String

func launch() {
print("lipo \(output)")
let task = NSTask()
task.launchPath = "/usr/bin/lipo"
task.arguments = ["-create"] + self.inputs
+ ["-output"] + [output]
task.launch()
task.waitUntilExit()
guard task.terminationStatus == 0 else {
exit(task.terminationStatus)
}
}
}

let productsPaths = sdks.map {
return DerivedDataDir + "Build/Products/Release-" + $0 + "/"
}

// create lipo tasks from built products
let lipos: [Lipo] = schemes.map { scheme in
let lib = "lib" + scheme + ".a"
let chunks = productsPaths.map { path in
return path + lib
}

let framework = frameworkMapping[scheme]! + ".framework"
let binary = frameworkMapping[scheme]!

let output = "\(BuiltProductsDir)\(scheme)/Frameworks/\(framework)/\(binary)"
return Lipo(inputs: chunks, output: output)
}

// lipo everything
lipos.forEach { $0.launch() }

exit(0)

88 changes: 0 additions & 88 deletions build_database.sh

This file was deleted.

2 changes: 1 addition & 1 deletion samples/swift/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target 'uidemo' do
use_frameworks!

pod 'FirebaseUI'
pod 'FirebaseUI', :podspec => '../../FirebaseUI.podspec'

target 'uidemoTests' do
inherit! :search_paths
Expand Down
4 changes: 2 additions & 2 deletions samples/swift/uidemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import UIKit
import Firebase
import FirebaseAuthUI
import FirebaseAuthUI.FIRAuthUI

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -36,7 +36,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String?
if FIRAuthUI.authUI()?.handleOpenURL(url, sourceApplication: sourceApplication ?? "") ?? false {
if FIRAuthUI.defaultAuthUI()?.handleOpenURL(url, sourceApplication: sourceApplication) ?? false {
return true
}
// other URL handling goes here.
Expand Down
Loading

0 comments on commit 887db45

Please sign in to comment.