Example #1
0
  def __init__(self, build_dir, target_platform, nohooks_on_update=False,
               custom_deps_list=None, target_os=None):
    """Creates a WebRTC factory.

    This factory can also be used to build stand-alone projects.

    Args:
      build_dir: Directory to perform the build relative to. Usually this is
        trunk/build for WebRTC and other projects.
      target_platform: Platform, one of 'win32', 'darwin', 'linux2'
      nohooks_on_update: If True, no hooks will be executed in the update step.
      custom_deps_list: List of tuples to override directories in the gclient
        spec.
      target_os: Used to sync down OS-specific dependencies, if specified.
    """
    chromium_factory.ChromiumFactory.__init__(
         self, build_dir, target_platform=target_platform,
         nohooks_on_update=nohooks_on_update, target_os=target_os)

    svn_url = config.Master.webrtc_url + '/trunk'

    custom_deps_list = custom_deps_list or []

    # Use root_dir=src since many Chromium scripts rely on that path.
    custom_vars_list = [self.CUSTOM_VARS_ROOT_DIR]

    # Overwrite solutions of ChromiumFactory since we sync WebRTC, not Chromium.
    self._solutions = []
    self._solutions.append(gclient_factory.GClientSolution(
        svn_url, name='src', custom_deps_list=custom_deps_list,
        custom_vars_list=custom_vars_list))
    if config.Master.webrtc_limited_url:
      self._solutions.append(gclient_factory.GClientSolution(
          config.Master.webrtc_limited_url, name='webrtc-limited',
          custom_vars_list=custom_vars_list))
Example #2
0
    def __init__(self,
                 build_dir,
                 target_platform,
                 use_supplement=False,
                 alternate_url=None,
                 custom_deps_list=None):
        solutions = []
        self.target_platform = target_platform
        nacl_url = config.Master.nacl_url
        if alternate_url:
            nacl_url = alternate_url
        main = gclient_factory.GClientSolution(
            nacl_url,
            custom_deps_list=custom_deps_list,
            custom_vars_list=[
                self.CUSTOM_VARS_WEBKIT_MIRROR,
                self.CUSTOM_VARS_GOOGLECODE_URL,
                self.CUSTOM_VARS_SOURCEFORGE_URL
            ])
        solutions.append(main)

        if use_supplement:
            supplement = gclient_factory.GClientSolution(
                config.Master.nacl_trunk_url + '/deps/supplement.DEPS')
            solutions.append(supplement)

        gclient_factory.GClientFactory.__init__(
            self, build_dir, solutions, target_platform=target_platform)
Example #3
0
  def __init__(self, build_dir, target_platform=None, pull_internal=True,
               full_checkout=False, additional_repos=None, name=None,
               custom_deps_list=None, nohooks_on_update=False, target_os=None,
               swarm_client_canary=False, internal_custom_deps_list=None,
               got_revision_mapping_overrides=None):
    if full_checkout:
      needed_components = None
    else:
      needed_components = self.NEEDED_COMPONENTS
    main = gclient_factory.GClientSolution(config.Master.trunk_url_src,
               needed_components=needed_components,
               name=name,
               custom_deps_list=custom_deps_list,
               custom_vars_list=[self.CUSTOM_VARS_WEBKIT_MIRROR,
                                 self.CUSTOM_VARS_GOOGLECODE_URL,
                                 self.CUSTOM_VARS_SOURCEFORGE_URL,
                                 self.CUSTOM_VARS_LLVM_URL,
                                 self.CUSTOM_VARS_NACL_TRUNK_URL])
    solutions = [main]
    if config.Master.trunk_internal_url_src and pull_internal:
      if full_checkout:
        needed_components = None
      else:
        needed_components = self.NEEDED_COMPONENTS_INTERNAL
      internal = gclient_factory.GClientSolution(
                     config.Master.trunk_internal_url_src,
                     needed_components=needed_components,
                     custom_deps_list=internal_custom_deps_list)
      solutions.append(internal)

    additional_repos = additional_repos or []
    for name, url in additional_repos:
      solution = gclient_factory.GClientSolution(url, name=name)
      solutions.append(solution)

    got_rev_mappings = self.CHROMIUM_GOT_REVISION_MAPPINGS
    if got_revision_mapping_overrides:
      # We need to reverse the key/value in the got revision mapping dict
      # because values are unique and keys are not.
      bw_mappings = dict(
          (v, k) for k, v in got_rev_mappings.iteritems())
      bw_mapping_overrides = dict(
          (v, k) for k, v in got_revision_mapping_overrides.iteritems())
      bw_mappings.update(bw_mapping_overrides)
      got_rev_mappings = dict(
          (v, k) for k, v in bw_mappings.iteritems())
      got_rev_mappings.update(got_revision_mapping_overrides)

    gclient_factory.GClientFactory.__init__(self,
        build_dir, solutions, target_platform=target_platform,
        nohooks_on_update=nohooks_on_update, target_os=target_os,
        revision_mapping=got_rev_mappings)
    if swarm_client_canary:
      # Contrary to other canaries like blink, v8, we don't really care about
      # having one build per swarm_client commits by having an additional source
      # change listener so just fetching @ToT all the time is good enough.
      self._solutions[0].custom_vars_list.append(('swarming_revision', ''))
Example #4
0
    def __init__(self, build_dir, target_platform=None):
        self.target_platform = target_platform
        main = gclient_factory.GClientSolution(config.Master.syzygy_url +
                                               'trunk',
                                               name='src')

        custom_deps_list = [main]
        if config.Master.syzygy_internal_url:
            internal = gclient_factory.GClientSolution(
                config.Master.syzygy_internal_url, name='syzygy')
            custom_deps_list.append(internal)

        gclient_factory.GClientFactory.__init__(
            self, build_dir, custom_deps_list, target_platform=target_platform)
Example #5
0
 def new_solution(deps_url, custom_vars, custom_deps, custom_deps_file, name):
   return  gclient_factory.GClientSolution(
       deps_url,
       name=name,
       custom_vars_list=custom_vars,
       custom_deps_list=custom_deps,
       custom_deps_file=custom_deps_file)
Example #6
0
    def __init__(self, build_dir='omaha', target_platform='win32'):
        omaha_svn_url = 'http://omaha.googlecode.com/svn/trunk'
        main = gclient_factory.GClientSolution(omaha_svn_url, name='omaha')
        custom_deps_list = [main]

        gclient_factory.GClientFactory.__init__(
            self, build_dir, custom_deps_list, target_platform=target_platform)
Example #7
0
    def __init__(self,
                 build_dir,
                 target_platform,
                 alternate_url=None,
                 custom_deps_list=None,
                 target_os=None):
        solutions = []
        self.target_platform = target_platform
        nacl_url = config.Master.nacl_url
        if alternate_url:
            nacl_url = alternate_url
        main = gclient_factory.GClientSolution(
            nacl_url,
            custom_deps_list=custom_deps_list,
            custom_vars_list=[
                self.CUSTOM_VARS_WEBKIT_MIRROR,
                self.CUSTOM_VARS_GOOGLECODE_URL,
                self.CUSTOM_VARS_SOURCEFORGE_URL
            ])
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self,
            build_dir,
            solutions,
            target_platform=target_platform,
            target_os=target_os)
Example #8
0
    def __init__(self,
                 build_dir,
                 target_platform=None,
                 use_supplement=False,
                 alternate_url=None,
                 branch='trunk'):
        solutions = []
        self.target_platform = target_platform
        nacl_sdk_url = posixpath.join(config.Master.nacl_sdk_root_url, branch,
                                      'src')
        if alternate_url:
            nacl_sdk_url = alternate_url
        main = gclient_factory.GClientSolution(
            nacl_sdk_url,
            custom_vars_list=[
                self.CUSTOM_VARS_WEBKIT_MIRROR,
                self.CUSTOM_VARS_GOOGLECODE_URL,
                self.CUSTOM_VARS_SOURCEFORGE_URL
            ],
            custom_deps_list=[('src/pdf', None), ('src-pdf', None)],
            needed_components=self.NEEDED_COMPONENTS)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self, build_dir, solutions, target_platform=target_platform)
Example #9
0
    def __init__(self,
                 build_dir,
                 target_platform,
                 nohooks_on_update=False,
                 target_os=None):
        """Creates a Libyuv factory.

    Args:
      build_dir: Directory to perform the build relative to. Usually this is
        src/build.
      target_platform: Platform, one of 'win32', 'darwin', 'linux2'.
      nohooks_on_update: If True, no hooks will be executed in the update step.
      target_os: Set to sync additional OS dependencies.
    """
        chromium_factory.ChromiumFactory.__init__(
            self,
            build_dir,
            target_platform=target_platform,
            nohooks_on_update=nohooks_on_update,
            target_os=target_os)

        # Use root_dir=src since many Chromium scripts rely on that path.
        custom_vars_list = [self.CUSTOM_VARS_ROOT_DIR]
        svn_url = config.Master.libyuv_url + '/trunk'

        # Overwrite solutions of ChromiumFactory since we sync Libyuv, not Chromium.
        self._solutions = []
        self._solutions.append(
            gclient_factory.GClientSolution(svn_url,
                                            name='src',
                                            custom_vars_list=custom_vars_list))
Example #10
0
    def __init__(self,
                 channel=None,
                 build_dir='sdk',
                 target_platform='posix',
                 target_os=None,
                 custom_deps_list=None,
                 nohooks_on_update=False,
                 is_standalone=False):
        solutions = []
        self.target_platform = target_platform

        # Default to the bleeding_edge channel
        if not channel:
            channel = CHANNELS_BY_NAME['be']
        self.channel = channel

        deps_url = dart_sdk_mirror

        if not custom_deps_list:
            custom_deps_list = []

        main = gclient_factory.GClientSolution(
            deps_url,
            needed_components=self.NEEDED_COMPONENTS,
            custom_deps_list=custom_deps_list,
            custom_vars_list=custom_vars_list)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self,
            build_dir,
            solutions,
            target_platform=target_platform,
            target_os=target_os,
            nohooks_on_update=nohooks_on_update)
 def _ConfigureWhatToBuild(self):
     """Returns a string with the contents of a .gclient file."""
     solution = gclient_factory.GClientSolution(
         name=self.gclient_solution_name,
         svn_url=self.svn_url,
         custom_deps_list=self.custom_deps_list,
         safesync_url=self.safesync_url)
     return 'solutions = [ %s ]' % solution.GetSpec()
 def FirefoxAddOnFactory(self, target='Release', clobber=False,
                         tests=None, mode=None, slave_type='BuilderTester',
                         options=None, compile_timeout=1200, build_url=None,
                         project=None, factory_properties=None):
   # For firefox addon we don't use the default DEPS file.
   self._solutions[0] = gclient_factory.GClientSolution(
       "http://page-speed.googlecode.com/svn/firefox_addon/trunk/src")
   return self.PageSpeedFactory(target, clobber, tests, mode, slave_type,
                                options, compile_timeout, build_url, project,
                                factory_properties)
  def __init__(self, build_dir, target_platform=None,
               branch='trunk'):
    solutions = []
    self.target_platform = target_platform
    nacl_sdk_url = posixpath.join(config.Master.nacl_sdk_root_url,
                                  branch, 'src')
    main = gclient_factory.GClientSolution(nacl_sdk_url)
    solutions.append(main)

    gclient_factory.GClientFactory.__init__(self, build_dir, solutions,
                                            target_platform=target_platform)
Example #14
0
  def __init__(self, build_dir, target_platform=None,
               branch='branches/bleeding_edge',
               custom_deps_list=None):
    self.checkout_url = config.Master.v8_url + '/' + branch

    main = gclient_factory.GClientSolution(self.checkout_url, name='v8',
                                           custom_deps_list=custom_deps_list)
    custom_deps_list = [main]

    gclient_factory.GClientFactory.__init__(self, build_dir, custom_deps_list,
                                            target_platform=target_platform)
Example #15
0
  def __init__(self, build_dir, target_platform=None,
               branch='branches/bleeding_edge', sputnik_revision=None):
    self.checkout_url = config.Master.v8_url + '/' + branch
    self.CUSTOM_DEPS_SPUTNIK = ('v8/test/sputnik/sputniktests',
                           'http://sputniktests.googlecode.com/svn/trunk@' +
                           sputnik_revision)

    main = gclient_factory.GClientSolution(self.checkout_url, name='v8')
    custom_deps_list = [main]

    gclient_factory.GClientFactory.__init__(self, build_dir, custom_deps_list,
                                            target_platform=target_platform)
Example #16
0
  def WebRTCFactory(self, target='Debug', clobber=False, tests=None, mode=None,
                    slave_type='BuilderTester', options=None,
                    compile_timeout=1200, build_url=None, project=None,
                    factory_properties=None, gclient_deps=None):
    options = options or ''
    tests = tests or []
    factory_properties = factory_properties or {}
    factory_properties['gclient_env'] = \
        factory_properties.get('gclient_env', {}).copy()

    if factory_properties.get('needs_valgrind'):
      self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND]
    elif factory_properties.get('needs_tsan_win'):
      self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_TSAN_WIN]
    elif factory_properties.get('needs_drmemory'):
      if 'drmemory.DEPS' not in [s.name for s in self._solutions]:
        self._solutions.append(gclient_factory.GClientSolution(
            config.Master.trunk_url +
            '/deps/third_party/drmemory/drmemory.DEPS',
            'drmemory.DEPS'))

    # Ensure GYP errors out if files referenced in .gyp files are missing.
    self.ForceMissingFilesToBeFatal(project, factory_properties['gclient_env'])

    factory = self.BuildFactory(target, clobber, tests, mode, slave_type,
                                options, compile_timeout, build_url, project,
                                factory_properties, gclient_deps)

    # Get the factory command object to create new steps to the factory.
    cmds = chromium_commands.ChromiumCommands(factory, target, self._build_dir,
                                              self._target_platform)
    # Override test runner script paths with our own that can run any test and
    # have our suppressions configured.
    valgrind_script_path = cmds.PathJoin('src', 'tools', 'valgrind-webrtc')
    cmds._posix_memory_tests_runner = cmds.PathJoin(valgrind_script_path,
                                                    'webrtc_tests.sh')
    cmds._win_memory_tests_runner = cmds.PathJoin(valgrind_script_path,
                                                  'webrtc_tests.bat')

    if (self._target_platform == 'win32' and factory_properties.get(
        'syzyasan')):
      cmds.AddWindowsSyzyASanStep()

    # Add check/start step for virtual webcams, if needed.
    if factory_properties.get('virtual_webcam'):
      cmds.AddVirtualWebcamCheck()

    cmds.AddWebRTCTests(tests, factory_properties)
    return factory
Example #17
0
  def __init__(self, build_dir='dart', target_platform='posix',
               extra_deps=None, deps_file=None, java=False):
    self.target_platform = target_platform
    self._build_dir = build_dir
    deps_url = deps_file or 'https://github.com/dart-lang/package-bots.git'
    extra_deps = extra_deps or []
    custom_deps_list = extra_deps
    if config.Master.trunk_internal_url and java:
      custom_deps_list.append(CUSTOM_DEPS_JAVA)
      custom_deps_list.append(CUSTOM_TZ)

    main = gclient_factory.GClientSolution(deps_url,
                                           custom_deps_list=custom_deps_list)
    gclient_factory.GClientFactory.__init__(self, build_dir, [main],
                                            target_platform=target_platform)
Example #18
0
    def __init__(self,
                 build_dir,
                 target_platform=None,
                 use_supplement=False,
                 alternate_url=None):
        solutions = []
        self.target_platform = target_platform
        nacl_ports_url = config.Master.nacl_ports_url
        if alternate_url:
            nacl_ports_url = alternate_url
        main = gclient_factory.GClientSolution(
            nacl_ports_url, needed_components=self.NEEDED_COMPONENTS)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self, build_dir, solutions, target_platform=target_platform)
Example #19
0
    def __init__(self,
                 channel=None,
                 build_dir='dart',
                 target_platform='posix',
                 target_os=None,
                 custom_deps_list=None,
                 nohooks_on_update=False,
                 is_standalone=False):
        solutions = []
        self.target_platform = target_platform

        # Default to the bleeding_edge channel
        if not channel:
            channel = CHANNELS_BY_NAME['be']
        self.channel = channel

        # 'channel.all_deps_path' can be for example:
        #   "/branches/bleeding_edge/deps/all.deps"
        # config.Master.dart_url will be the base svn url. It will point to the
        # mirror if we're in golo and otherwise to the googlecode location.
        if is_standalone:
            deps_url = config.Master.dart_url + self.channel.standalone_deps_path
        else:
            deps_url = config.Master.dart_url + self.channel.all_deps_path

        if not custom_deps_list:
            custom_deps_list = []

        if config.Master.trunk_internal_url:
            custom_deps_list.append(self.CUSTOM_DEPS_JAVA)
            custom_deps_list.append(self.CUSTOM_TZ)

        main = gclient_factory.GClientSolution(
            deps_url,
            needed_components=self.NEEDED_COMPONENTS,
            custom_deps_list=custom_deps_list,
            custom_vars_list=custom_vars_list)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self,
            build_dir,
            solutions,
            target_platform=target_platform,
            target_os=target_os,
            nohooks_on_update=nohooks_on_update)
Example #20
0
    def __init__(self, build_dir, target_platform):
        """Creates a Libyuv factory.

    Args:
      build_dir: Directory to perform the build relative to. Usually this is
        src/build.
      target_platform: Platform, one of 'win32', 'darwin', 'linux2'
    """
        # Use root_dir=src since many Chromium scripts rely on that path.
        custom_vars_list = [self.CUSTOM_VARS_ROOT_DIR]
        svn_url = config.Master.libyuv_url + '/trunk'
        solutions = []
        solutions.append(
            gclient_factory.GClientSolution(svn_url,
                                            name='src',
                                            custom_vars_list=custom_vars_list))
        gclient_factory.GClientFactory.__init__(
            self, build_dir, solutions, target_platform=target_platform)
Example #21
0
 def ChromiumBranchFactory(self,
                           target='Release',
                           clobber=False,
                           tests=None,
                           mode=None,
                           slave_type='BuilderTester',
                           options=None,
                           compile_timeout=1200,
                           build_url=None,
                           project=None,
                           factory_properties=None,
                           trunk_src_url=None):
     self._solutions = [
         gclient_factory.GClientSolution(trunk_src_url, 'src')
     ]
     return self.ChromiumFactory(target, clobber, tests, mode, slave_type,
                                 options, compile_timeout, build_url,
                                 project, factory_properties)
Example #22
0
    def __init__(self, build_dir, target_platform=None, trunk=False):
        solutions = []
        self.target_platform = target_platform
        deps_file = '/deps/all.deps'
        dart_url = config.Master.dart_bleeding + deps_file
        # If this is trunk use the deps file from there instead.
        if trunk:
            dart_url = config.Master.dart_trunk + deps_file
        custom_deps_list = []

        if config.Master.trunk_internal_url:
            custom_deps_list.append(self.CUSTOM_DEPS_JAVA)

        main = gclient_factory.GClientSolution(
            dart_url,
            needed_components=self.NEEDED_COMPONENTS,
            custom_deps_list=custom_deps_list)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self, build_dir, solutions, target_platform=target_platform)
Example #23
0
    def __init__(self,
                 build_dir='dart',
                 target_platform='posix',
                 trunk=False,
                 milestone=False,
                 target_os=None,
                 custom_deps_list=None,
                 nohooks_on_update=False):
        solutions = []
        self.target_platform = target_platform
        deps_file = '/deps/all.deps'
        dart_url = config.Master.dart_bleeding + deps_file
        # If this is trunk use the deps file from there instead.
        if trunk:
            dart_url = config.Master.dart_trunk + deps_file
        if milestone:
            dart_url = dart_milestone_url + deps_file

        if not custom_deps_list:
            custom_deps_list = []

        if config.Master.trunk_internal_url:
            custom_deps_list.append(self.CUSTOM_DEPS_JAVA)
            custom_deps_list.append(self.CUSTOM_TZ)

        main = gclient_factory.GClientSolution(
            dart_url,
            needed_components=self.NEEDED_COMPONENTS,
            custom_deps_list=custom_deps_list,
            custom_vars_list=custom_vars_list)
        solutions.append(main)

        gclient_factory.GClientFactory.__init__(
            self,
            build_dir,
            solutions,
            target_platform=target_platform,
            target_os=target_os,
            nohooks_on_update=nohooks_on_update)
Example #24
0
 def __init__(self, build_dir, **kw):
     main = gclient_factory.GClientSolution(self.svn_url)
     super(GYPFactory, self).__init__(build_dir, [main], **kw)
Example #25
0
  def __init__(self, do_upload_results=False,
               build_subdir='trunk', other_subdirs=None,
               target_platform=None, configuration='Debug',
               default_timeout=600,
               environment_variables=None, gm_image_subdir=None,
               perf_output_basedir=None, builder_name=None):
    """Instantiates a SkiaFactory as appropriate for this target_platform.

    do_upload_results: whether we should upload bench/gm results
    build_subdir: subdirectory to check out and then build within
    other_subdirs: list of other subdirectories to also check out (or None)
    target_platform: a string such as TARGET_PLATFORM_LINUX
    configuration: 'Debug' or 'Release'
    default_timeout: default timeout for each command, in seconds
    environment_variables: dictionary of environment variables that should
        be passed to all commands
    gm_image_subdir: directory containing images for comparison against results
        of gm tool
    perf_output_basedir: path to directory under which to store performance
        data, or None if we don't want to store performance data
    builder_name: name of the builder associated with this factory
    """
    # Create gclient solutions corresponding to the main build_subdir
    # and other directories we also wish to check out.
    solutions = [gclient_factory.GClientSolution(
        svn_url=config.Master.skia_url + build_subdir, name=build_subdir)]
    if other_subdirs:
      for other_subdir in other_subdirs:
        solutions.append(gclient_factory.GClientSolution(
            svn_url=config.Master.skia_url + other_subdir, name=other_subdir))
    gclient_factory.GClientFactory.__init__(
        self, build_dir='', solutions=solutions,
        target_platform=target_platform)

    self._do_upload_results = do_upload_results
    self._configuration = configuration
    self._factory = self.BaseFactory(factory_properties=None)
    self._gm_image_subdir = gm_image_subdir
    self._builder_name = builder_name
    self._target_platform = target_platform

    # Set _default_clobber based on config.Master
    self._default_clobber = getattr(config.Master, 'default_clobber', False)

    # Platform-specific stuff.
    if target_platform == TARGET_PLATFORM_WIN32:
      self.TargetPathJoin = ntpath.join
      self._make_flags = 'BUILDTYPE=%s' % self._configuration
    else:
      self.TargetPathJoin = posixpath.join
      self._make_flags = '--jobs --max-load=4.0 BUILDTYPE=%s' % (
          self._configuration)

    # Figure out where we are going to store performance output.
    if perf_output_basedir:
      self._perf_data_dir = self.TargetPathJoin(
          perf_output_basedir, builder_name, 'data')
      self._perf_graphs_dir = self.TargetPathJoin(
          perf_output_basedir, builder_name, 'graphs')
    else:
      self._perf_data_dir = None
      self._perf_graphs_dir = None

    # Figure out where we are going to store images generated by GM.
    self._gm_actual_dir = self.TargetPathJoin('..', '..', 'gm', 'actual')
    self._gm_actual_svn_baseurl = '%s/%s' % (AUTOGEN_SVN_BASEURL, 'gm-actual')
    self._autogen_svn_username_file = '.autogen_svn_username'
    self._autogen_svn_password_file = '.autogen_svn_password'

    # Get an implementation of SkiaCommands as appropriate for
    # this target_platform.
    workdir = self.TargetPathJoin('build', build_subdir)
    self._skia_cmd_obj = skia_commands.SkiaCommands(
        target_platform=target_platform, factory=self._factory,
        configuration=configuration, workdir=workdir,
        target_arch=None, default_timeout=default_timeout,
        environment_variables=environment_variables)
Example #26
0
 def new_solution(deps_url, custom_vars, custom_deps):
   return  gclient_factory.GClientSolution(
       deps_url,
       'dartium.deps',
       custom_vars_list = custom_vars,
       custom_deps_list = custom_deps)
Example #27
0
    def __init__(self,
                 other_repos=None,
                 do_upload_render_results=False,
                 do_upload_bench_results=False,
                 do_patch_step=False,
                 build_subdir='skia',
                 target_platform=None,
                 configuration=CONFIG_DEBUG,
                 default_timeout=8 * 60 * 60,
                 deps_target_os=None,
                 environment_variables=None,
                 perf_output_basedir=None,
                 builder_name=None,
                 flavor=None,
                 make_flags=None,
                 test_args=None,
                 gm_args=None,
                 bench_args=None,
                 bench_pictures_cfg='default',
                 compile_warnings_as_errors=False,
                 gyp_defines=None,
                 build_targets=None):
        """Instantiates a SkiaFactory as appropriate for this target_platform.
    do_upload_render_results: whether we should upload render results
    do_upload_bench_results: whether we should upload bench results
    do_patch_step: whether the build should include a step which applies a
        patch.  This is only applicable for trybots.
    build_subdir: subdirectory to check out and then build within
    other_repos: list of other repositories to also check out (or None). Each
        repo is specified as a tuple: (name, url), where "name" is the target
        directory and "url" is the source code url.
    target_platform: a string such as TARGET_PLATFORM_LINUX
    configuration: 'Debug' or 'Release'
    default_timeout: default timeout for each command, in seconds
    deps_target_os: string; the target_os to be specified in the gclient config.
    environment_variables: dictionary of environment variables that should
        be passed to all commands
    perf_output_basedir: path to directory under which to store performance
        data, or None if we don't want to store performance data
    builder_name: name of the builder associated with this factory
    flavor: which "flavor" of slave-side scripts this factory should use
    make_flags: list of extra flags to pass to the compile step
    test_args: list of extra flags to pass to the 'tests' executable
    gm_args: list of extra flags to pass to the 'gm' executable
    bench_args: list of extra flags to pass to the 'bench' executable
    bench_pictures_cfg: config name to use for bench_pictures
    compile_warnings_as_errors: boolean; whether to build with "-Werror" or
        some equivalent.
    gyp_defines: optional dict; GYP_DEFINES to be used in the build.
    build_targets: optional list; the targets to build. Default is set depending
        on which Build() function is called.
    """
        properties = {}

        self.skipsteps = utils.GetListFromEnvVar(
            config_private.SKIPSTEPS_ENVIRONMENT_VARIABLE)
        self.dontskipsteps = utils.GetListFromEnvVar(
            config_private.DONTSKIPSTEPS_ENVIRONMENT_VARIABLE)

        if not make_flags:
            make_flags = []
        self._make_flags = make_flags
        # Platform-specific stuff.
        if target_platform == TARGET_PLATFORM_WIN32:
            self.TargetPath = ntpath
        else:
            self.TargetPath = posixpath

        # Create gclient solutions corresponding to the main build_subdir
        # and other directories we also wish to check out.
        self._gclient_solutions = [
            gclient_factory.GClientSolution(svn_url=SKIA_GIT_URL,
                                            name=build_subdir).GetSpec()
        ]

        if not other_repos:
            other_repos = []
        repos_to_checkout = set(other_repos)

        for other_repo in repos_to_checkout:
            self._gclient_solutions.append(
                gclient_factory.GClientSolution(svn_url=other_repo[1],
                                                name=other_repo[0]).GetSpec())

        self._deps_target_os = deps_target_os

        # Set _default_clobber based on config.Master
        self._default_clobber = getattr(config.Master, 'default_clobber',
                                        False)

        self._do_upload_render_results = do_upload_render_results
        self._do_upload_bench_results = (do_upload_bench_results
                                         and perf_output_basedir != None)
        self._do_patch_step = do_patch_step

        if not environment_variables:
            self._env_vars = {}
        else:
            self._env_vars = dict(environment_variables)

        self._gyp_defines = dict(gyp_defines or {})
        self._gyp_defines['skia_warnings_as_errors'] = \
            '%d' % int(compile_warnings_as_errors)

        self._build_targets = list(build_targets or [])

        # Get an implementation of SkiaCommands as appropriate for
        # this target_platform.
        self._workdir = self.TargetPath.join('build', build_subdir)
        self._skia_cmd_obj = skia_commands.SkiaCommands(
            target_platform=target_platform,
            factory=self,
            configuration=configuration,
            workdir=self._workdir,
            target_arch=None,
            default_timeout=default_timeout,
            environment_variables=self._env_vars)

        self._perf_output_basedir = perf_output_basedir

        self._configuration = configuration
        if self._configuration not in CONFIGURATIONS:
            raise ValueError('Invalid configuration %s.  Must be one of: %s' %
                             (self._configuration, CONFIGURATIONS))

        self._skia_svn_username_file = '.skia_svn_username'
        self._skia_svn_password_file = '.skia_svn_password'
        self._builder_name = builder_name
        self._flavor = flavor

        def _DetermineRevision(build):
            """ Get the 'revision' property at build time. WithProperties returns the
      empty string if 'revision' is not defined, which causes failures when we
      try to pass the revision over a command line, so we use the string "None"
      to indicate that the revision is not defined.

      build: instance of Build for the current build.
      """
            props = build.getProperties().asDict()
            if props.has_key('revision'):
                if props['revision'][0]:
                    return props['revision'][0]
            return 'None'

        if not test_args:
            test_args = []
        if not gm_args:
            gm_args = []
        if not bench_args:
            bench_args = []

        self._common_args = [
            # See http://skbug.com/2663 before deleting the next line.
            '--autogen_svn_baseurl',
            'bogusValueToFixSkBug2663',
            '--configuration',
            configuration,
            '--deps_target_os',
            self._deps_target_os or 'None',
            '--builder_name',
            builder_name,
            '--build_number',
            WithProperties('%(buildnumber)s'),
            '--target_platform',
            target_platform,
            '--revision',
            WithProperties('%(rev)s', rev=_DetermineRevision),
            '--got_revision',
            WithProperties('%(got_revision:-None)s'),
            '--perf_output_basedir',
            perf_output_basedir or 'None',
            '--make_flags',
            '"%s"' % ' '.join(self._make_flags),
            '--test_args',
            '"%s' % ' '.join(test_args),
            '--gm_args',
            '"%s"' % ' '.join(gm_args),
            '--bench_args',
            '"%s"' % ' '.join(bench_args),
            '--is_try',
            str(self._do_patch_step),
            '--bench_pictures_cfg',
            bench_pictures_cfg,
            '--issue_number',
            WithProperties('%(issue:-None)s'),
        ]
        BuildFactory.__init__(self, build_factory_properties=properties)
  def __init__(self, build_dir, target_platform=None):
    main = gclient_factory.GClientSolution(
        "http://page-speed.googlecode.com/svn/lib/trunk/src")

    gclient_factory.GClientFactory.__init__(self, build_dir, [main],
                                            target_platform=target_platform)