class Podage::IOSBuilder

Public Instance Methods

build(configuration, &block) click to toggle source
Calls superclass method Podage::Builder#build
# File lib/podage/builders/ios_builder.rb, line 31
def build(configuration, &block)

        super

        build_frameworks configuration
        generate_universal_frameworks

        copy_frameworks

end
platform() click to toggle source
# File lib/podage/builders/ios_builder.rb, line 146
def platform

        return :ios

end
target_name() click to toggle source
# File lib/podage/builders/ios_builder.rb, line 140
def target_name

        return 'iOS'

end

Private Instance Methods

build_framework(project, scheme, configuration) click to toggle source

Build Frameworks

# File lib/podage/builders/ios_builder.rb, line 133
def build_framework(project, scheme, configuration)
        xcodebuild_framework(project, scheme, configuration, SIMULATOR_ARCHS, SIMULATOR_BUILD_PATH, SIMULATOR_PLATFORM)
        xcodebuild_framework(project, scheme, configuration, DEVICE_ARCHS, DEVICE_BUILD_PATH, DEVICE_PLATFORM)
end
build_frameworks(configuration) click to toggle source

Share all schemes

# File lib/podage/builders/ios_builder.rb, line 113
def build_frameworks(configuration)
        
        schemes = Dir.glob(PODS_PROJECT_PATH + "/xcshareddata/**/*.xcscheme")

        schemes.each do |scheme|
        
                name = File.basename scheme
                no_extension = File.basename(scheme, ".*" )

                puts ""
                puts "Building ".bold + no_extension.green
                puts ""
                
                build_framework(BUILD_PATH + "/Pods/Pods.xcodeproj",no_extension, configuration)

        end
end
copy_frameworks() click to toggle source
# File lib/podage/builders/ios_builder.rb, line 92
def copy_frameworks

        FileUtils.rm_rf IOS_OUTPUT_PATH
        FileUtils.mkpath IOS_OUTPUT_PATH

        if Dir.exists?(DEVICE_BUILD_PATH)
                FileUtils.cp_r DEVICE_BUILD_PATH, DEVICE_OUTPUT_PATH
        end
        
        if Dir.exists?(SIMULATOR_BUILD_PATH)
                FileUtils.cp_r SIMULATOR_BUILD_PATH, SIMULATOR_OUTPUT_PATH
        end
        
        if Dir.exists?(UNIVERSAL_BUILD_PATH)
                FileUtils.cp_r UNIVERSAL_BUILD_PATH, UNIVERSAL_OUTPUT_PATH
        end

end
generate_universal_dSYMs() click to toggle source
# File lib/podage/builders/ios_builder.rb, line 44
def generate_universal_dSYMs

        puts "Generating universal dSYM files".green

        dSYMs = Dir.glob(SIMULATOR_BUILD_PATH + "/*.framework.dSYM")
        
        dSYMs.each do |dSYM|
        
                name = File.basename(File.basename(dSYM, ".*"), ".*" )

                FileUtils.cp_r dSYM, UNIVERSAL_BUILD_PATH + "/" + File.basename(dSYM)

                simulator = [SIMULATOR_BUILD_PATH, File.basename(dSYM), DSYM_PATH, name].join('/')
                device = [DEVICE_BUILD_PATH, File.basename(dSYM), DSYM_PATH, name].join('/')
                output = [UNIVERSAL_BUILD_PATH, File.basename(dSYM), DSYM_PATH, name].join('/')

                execute_cmd('lipo -create "' + device +'" "' + simulator +'" -output "' + output +'"')

        end

end
generate_universal_frameworks() click to toggle source
# File lib/podage/builders/ios_builder.rb, line 66
def generate_universal_frameworks

        puts "Generating universal frameworks".green

        schemes = Dir.glob(SIMULATOR_BUILD_PATH + "/*.framework")
        
        FileUtils.mkdir UNIVERSAL_BUILD_PATH

        schemes.each do |scheme|
        
                name = File.basename(scheme, ".*" )

                FileUtils.cp_r scheme, UNIVERSAL_BUILD_PATH + "/" + File.basename(scheme)

                simulator = [DEVICE_BUILD_PATH, File.basename(scheme), name].join('/')
                device = [SIMULATOR_BUILD_PATH, File.basename(scheme), name].join('/')
                output = [UNIVERSAL_BUILD_PATH, File.basename(scheme), name].join('/')

                execute_cmd('lipo -create "' + simulator +'" "' + device +'" -output "' + output +'"')

        end
        
        generate_universal_dSYMs

end