Esempio n. 1
0
  def _convert_poms(self):
    modules = PomUtils.get_modules()
    logger.debug('Re-generating {count} modules'.format(count=len(modules)))
    # Convert pom files to BUILD files
    context = GenerationContext()
    for module_name in modules:
      if not module_name in _MODULES_TO_SKIP:
        pom_file_name = os.path.join(module_name, 'pom.xml')
        PomToBuild().convert_pom(pom_file_name, rootdir=self.baseroot, generation_context=context)
    context.os_to_java_homes = JavaHomesInfo.from_pom('parents/base/pom.xml',
                                                      self.baseroot).home_map
    # Write jvm platforms and distributions.
    with open(context.generated_ini_file, 'w+') as f:
      f.write('# Generated by regenerate_all.py. Do not hand-edit.\n\n')
      f.write('\n'.join(context.get_pants_ini_gen()))

    local_ini = 'pants-local.ini'
    if not os.path.exists(local_ini):
      with open(local_ini, 'w') as f:
        f.write('\n'.join([
          '# Local pants.ini file, not tracked by git.',
          '# Use this to make your own custom changes/overrides to pants settings.',
          '# Note: This is for local settings only.  Changes you make here will',
          '# not be used in CI (use pants.ini for that).',
          '',
          '# Uncomment to use local build cache ',
          '# (Saves time when switching between branches frequently.)',
          '#[cache]',
          '#read_from: ["~/.cache/pants/local-build-cache"]',
          '#read: True',
          '#write_to: ["~/.cache/pants/local-build-cache"]',
          '#write: True',
          '',
        ]))
Esempio n. 2
0
    def _convert_poms(self):
        modules = PomUtils.get_modules()
        logger.debug(
            'Re-generating {count} modules'.format(count=len(modules)))
        # Convert pom files to BUILD files
        context = GenerationContext()
        for module_name in modules:
            if not module_name in _MODULES_TO_SKIP:
                pom_file_name = os.path.join(module_name, 'pom.xml')
                PomToBuild().convert_pom(pom_file_name,
                                         rootdir=self.baseroot,
                                         generation_context=context)
        context.os_to_java_homes = JavaHomesInfo.from_pom(
            'parents/base/pom.xml', self.baseroot).home_map
        # Write jvm platforms and distributions.
        with open(context.generated_ini_file, 'w+') as f:
            f.write('# Generated by regenerate_all.py. Do not hand-edit.\n\n')
            f.write('\n'.join(context.get_pants_ini_gen()))

        local_ini = 'pants-local.ini'
        if not os.path.exists(local_ini):
            with open(local_ini, 'w') as f:
                f.write('\n'.join([
                    '# Local pants.ini file, not tracked by git.',
                    '# Use this to make your own custom changes/overrides to pants settings.',
                    '# Note: This is for local settings only.  Changes you make here will',
                    '# not be used in CI (use pants.ini for that).',
                    '',
                    '# Uncomment to use local build cache ',
                    '# (Saves time when switching between branches frequently.)',
                    '#[cache]',
                    '#read_from: ["~/.cache/pants/local-build-cache"]',
                    '#read: True',
                    '#write_to: ["~/.cache/pants/local-build-cache"]',
                    '#write: True',
                    '',
                ]))