def bazel_build_flags(config_platform, arch):
  """Returns an array of command line flags for bazel."""
  if config_platform == 'darwin':
    options = ['--apple_platform_type=macos']
  else:
    options = ['--apple_platform_type=%s' % config_platform]
  if config_platform in ['ios', 'darwin']:
    options.append('--cpu=%s_%s' % (config_platform, arch))
  else:
    options.append('--%scpus=%s' % (config_platform, arch))
  # Set watchos_cpus for bundled watch apps.
  if config_platform == 'ios':
    if arch.startswith('arm'):
      options.append('--watchos_cpus=armv7k')
    else:
      options.append('--watchos_cpus=i386')

  return options