scripts/gha/integration_testing/xcode_tool.rb
# Performs all the product-specific changes to the xcode project provided by
# the xcodeProjectDir flag.
Performs all the product-specific changes to the xcode project provided by
the xcodeProjectDir flag.
Performs all the product - specific changes to the xcode project provided by the xcodeProjectDir flag .
def main
  OptionParser.new do |opts|
    opts.banner = 'Usage: xcode_tool.rb [options]'
    opts.on('-d', '--XCodeCPP.xcodeProjectDir [dir]',
      'XCode project directory (required)') do |xcode_project_dir|
      @xcode_project_dir = xcode_project_dir
    end
    opts.on('-t', '--XCodeCPP.target [target]',
      'Assume target to match the .xcodeproj name. (required)') do |target|
      @target_name = target
    end
    opts.on('-f', '--XCodeCPP.frameworks [frameworks]',
      'Paths to the custom frameworks. (required)') do |frameworks|
      @frameworks = frameworks.split(",")
    end
    opts.on('-e', '--XCodeCPP.entitlement [entitlement_path]',
      'Path to entitlements (optional)') do |entitlement_path|
      @entitlement_path = entitlement_path
    end
    opts.on('-i', '--XCodeCPP.include [include_path]',
      'Path to additional include files (optional)') do |include_path|
      @include_path = include_path
    end
  end.parse!
  raise OptionParser::MissingArgument,'-d' if @xcode_project_dir.nil?
  raise OptionParser::MissingArgument,'-t' if @target_name.nil?
  raise OptionParser::MissingArgument,'-f' if @frameworks.nil?
  project_path = "#@xcode_project_dir/integration_test.xcodeproj"
  @project = Xcodeproj::Project.open(project_path)
  for t in @project.targets
    if t.name == @target_name
      @target = t
      puts "Find target #@target"
      break
    end 
  end
  path_components = project_path.split('/')
  if path_components.include?('FirebaseAuth')
    make_changes_for_auth
  elsif path_components.include?('FirebaseMessaging')
    make_changes_for_messaging
  elsif path_components.include?('FirebaseDynamicLinks')
    make_changes_for_dynamiclinks
  end
  framework_dir = "#@xcode_project_dir/Frameworks"
  set_build_setting('FRAMEWORK_SEARCH_PATHS', ['${inherited}', framework_dir])
  if !@include_path.nil?
    append_to_build_setting('HEADER_SEARCH_PATHS', @include_path)
  end
  @frameworks.each do |framework|
    add_custom_framework(framework)
  end
  set_build_setting('ENABLE_BITCODE', 'NO')
  @project.save
end
def main OptionParser . new do | opts | opts . banner = 'Usage: xcode_tool.rb [options]' opts . on ( '-d' , '--XCodeCPP.xcodeProjectDir [dir]' , 'XCode project directory (required)' ) do | xcode_project_dir | @xcode_project_dir = xcode_project_dir end opts . on ( '-t' , '--XCodeCPP.target [target]' , 'Assume target to match the .xcodeproj name. (required)' ) do | target | @target_name = target end opts . on ( '-f' , '--XCodeCPP.frameworks [frameworks]' , 'Paths to the custom frameworks. (required)' ) do | frameworks | @frameworks = frameworks . split ( "," ) end opts . on ( '-e' , '--XCodeCPP.entitlement [entitlement_path]' , 'Path to entitlements (optional)' ) do | entitlement_path | @entitlement_path = entitlement_path end opts . on ( '-i' , '--XCodeCPP.include [include_path]' , 'Path to additional include files (optional)' ) do | include_path | @include_path = include_path end end . parse! raise OptionParser :: MissingArgument , '-d' if @xcode_project_dir . nil? raise OptionParser :: MissingArgument , '-t' if @target_name . nil? raise OptionParser :: MissingArgument , '-f' if @frameworks . nil? project_path = "#@xcode_project_dir/integration_test.xcodeproj" @project = Xcodeproj :: Project . open ( project_path ) for t in @project . targets if t . name == @target_name @target = t puts "Find target #@target" break end end path_components = project_path . split ( '/' ) if path_components . include? ( 'FirebaseAuth' ) make_changes_for_auth elsif path_components . include? ( 'FirebaseMessaging' ) make_changes_for_messaging elsif path_components . include? ( 'FirebaseDynamicLinks' ) make_changes_for_dynamiclinks end framework_dir = "#@xcode_project_dir/Frameworks" set_build_setting ( 'FRAMEWORK_SEARCH_PATHS' , [ '${inherited}' , framework_dir ] ) if ! @include_path . nil? append_to_build_setting ( 'HEADER_SEARCH_PATHS' , @include_path ) end @frameworks . each do | framework | add_custom_framework ( framework ) end set_build_setting ( 'ENABLE_BITCODE' , 'NO' ) @project . save end
Performs all the product-specific changes to the xcode project provided by
the xcodeProjectDir flag.
Performs all the product - specific changes to the xcode project provided by the xcodeProjectDir flag .
# Examine components rather than substrings to minimize false positives. # Note: this is not ideal. This tool should not be responsible for figuring # out which project it's modifying. That responsibility should belong to # the Python tool invoking this. # Bitcode is unnecessary, as we are not submitting these to the Apple store. # Disabling bitcode significantly speeds up builds.