b0VIM 8.0\a bpjoshJoshs-MacBook-Pro.local~josh/Projects/fastlane/fastlane/fastlane/lib/fastlane/actions/update_project_provisioning.rbutf-8 3210#"! UtpQ5R'adNQz!v(' G z I r 4 &   o F  K . Yd;l]s@2\R # complete project.save end end build_configuration.build_settings["PROVISIONING_PROFILE_SPECIFIER"] = data["Name"] build_configuration.build_settings["PROVISIONING_PROFILE"] = data["UUID"] end end build_configuration.build_settings[setting] = code_signing_identity codesign_build_settings_keys.each do |setting| codesign_build_settings_keys = build_configuration.build_settings.keys.select { |key| key.to_s.match(/CODE_SIGN_IDENTITY.*/) } if code_signing_identity end next UI.important("Skipping configuration #{config_name} as it doesn't match the filter '#{configuration}'") else UI.success("Updating configuration #{config_name}...") if !configuration || config_name.match(configuration) config_name = build_configuration.name target.build_configuration_list.build_configurations.each do |build_configuration| end next UI.important("Skipping target #{target.name} as it doesn't match the filter '#{target_filter}'") else UI.success("Updating target #{target.name}...") if !target_filter || target.name.match(target_filter) || (target.respond_to?(:product_type) && target.product_type.match(target_filter)) project.targets.each do |target| project = Xcodeproj::Project.open(folder) require 'xcodeproj' UI.success("Going to update project '#{folder}' with UUID") # manipulate project file code_signing_identity = params[:code_signing_identity] configuration = params[:build_configuration] target_filter = params[:target_filter] || params[:build_configuration_filter] data = Plist.parse_xml(p7.data) p7.verify([cert], store) store.add_cert(cert) cert = OpenSSL::X509::Certificate.new(File.read(params[:certificate])) UI.user_error!("Could not find valid certificate at '#{params[:certificate]}'") unless File.size(params[:certificate]) > 0 store = OpenSSL::X509::Store.new p7 = OpenSSL::PKCS7.new(profile) profile = File.read(params[:profile]) UI.message("Parsing mobile provisioning profile from '#{params[:profile]}'") # parsing mobileprovision file end end file.write(open(ROOT_CERTIFICATE_URL, "rb").read) File.open(params[:certificate], "w:ASCII-8BIT") do |file| require 'open-uri' UI.message("Downloading root certificate from (#{ROOT_CERTIFICATE_URL}) to path '#{params[:certificate]}'") unless File.exist?(params[:certificate]) # download certificate UI.user_error!("Could not find path to project config '#{project_file_path}'. Pass the path to your project (not workspace)!") unless File.exist?(project_file_path) project_file_path = File.join(folder, "project.pbxproj") # validate folder folder = params[:xcodeproj] || Dir["*.xcodeproj"].first # assign folder from parameter or search for xcodeproj file UI.message("https://docs.fastlane.tools/codesigning/GettingStarted/") UI.message("You’re updating provisioning profiles directly in your project, but have you considered easier ways to do code signing?") def self.run(params) ROOT_CERTIFICATE_URL = "https://www.apple.com/appleca/AppleIncRootCertificate.cer" class UpdateProjectProvisioningAction < Action end module SharedValues module Actionsmodule Fastlane# coding: utf-8ad 'Y,? A | R H G s  4 '    end end end end :code_signing def self.category end ] )' code_signing_identity: "iPhone Development" # optionally specify the codesigning identity build_configuration: "Release", target_filter: ".*WatchKit Extension.*", # matches name or type of a target profile: "./watch_app_store.mobileprovision", # optional if you use sigh xcodeproj: "Project.xcodeproj", 'update_project_provisioning( [ def self.example_code end [:ios, :mac].include?(platform) def self.is_supported?(platform) end ["tobiasstrebitzer", "czechboy0"] def self.authors end ] optional: true) description: "Code sign identity for build configuration", env_name: "FL_PROJECT_PROVISIONING_CODE_SIGN_IDENTITY", FastlaneCore::ConfigItem.new(key: :code_signing_identity, default_value: "/tmp/AppleIncRootCertificate.cer"), description: "Path to apple root certificate", env_name: "FL_PROJECT_PROVISIONING_CERTIFICATE_PATH", FastlaneCore::ConfigItem.new(key: :certificate, end), UI.user_error!("build_configuration should be Regexp or String") unless [Regexp, String].any? { |type| value.kind_of?(type) }