Exemple #1
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.project_name = context.options.ide_gen_project_name
    self.python = context.options.ide_gen_python
    self.skip_java = not context.options.ide_gen_java
    self.skip_scala = not context.options.ide_gen_scala

    self.java_language_level = context.options.ide_gen_java_language_level
    if context.config.get('idea', 'gen_java_jdk'):
      self.java_jdk = context.config.get('idea', 'gen_java_jdk')
    elif context.options.ide_gen_java_jdk:
      self.java_jdk = context.options.ide_gen_java_jdk
    else:
      self.java_jdk = '1.%d' % self.java_language_level

    self.work_dir = os.path.abspath(
      context.options.ide_gen_project_dir
      or os.path.join(
        context.config.get('ide', 'workdir'), self.__class__.__name__, self.project_name
      )
    )
    self.cwd = (
      os.path.abspath(context.options.ide_gen_project_cwd) if context.options.ide_gen_project_cwd
      else self.work_dir
    )

    self.intransitive = context.options.ide_gen_intransitive

    checkstyle_suppression_files = context.config.getdefault(
      'checkstyle_suppression_files', type=list, default=[]
    )
    debug_port = context.config.getint('ide', 'debug_port')

    self.classes_conf = context.config.get('ide', 'classes_conf')
    self.sources_conf = context.config.get('ide', 'sources_conf')

    scala_compiler_profile = None
    if not self.skip_scala:
      scala_compiler_profile = context.config.getdefault('scala_compile_profile')

    targets, self._project = self.configure_project(
      context.targets(),
      checkstyle_suppression_files,
      debug_port,
      scala_compiler_profile
    )

    self.configure_compile_context(targets)

    if self.python:
      self.context.products.require('python')
    if not self.skip_java:
      self.context.products.require('java')
    if not self.skip_scala:
      self.context.products.require('scala')

    self.context.products.require('jars')
    self.context.products.require('source_jars')
Exemple #2
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.outdir = context.options.bundle_create_outdir or context.config.get("bundle-create", "outdir")
        self.archiver = context.options.bundle_create_archive

        self.context.products.require("jars", predicate=self.is_binary)
        self.require_jar_dependencies()
Exemple #3
0
 def setup_parser(cls, option_group, args, mkflag):
     JvmBinaryTask.setup_parser(option_group, args, mkflag)
     option_group.add_option(
         mkflag("archive"),
         dest="bundle_create_archive",
         type="choice",
         choices=list(ARCHIVER_BY_TYPE.keys()),
         help="[%%default] Create an archive from the bundle. "
         "Choose from %s" % ARCHIVER_BY_TYPE.keys())
Exemple #4
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.project_name = context.options.ide_gen_project_name
    self.python = context.options.ide_gen_python
    self.skip_java = not context.options.ide_gen_java
    self.skip_scala = not context.options.ide_gen_scala

    self.java_language_level = context.options.ide_gen_java_language_level
    if context.options.ide_gen_java_jdk:
      self.java_jdk = context.options.ide_gen_java_jdk
    else:
      self.java_jdk = '1.%d' % self.java_language_level

    self.work_dir = os.path.abspath(
      context.options.ide_gen_project_dir
      or os.path.join(
        context.config.get('ide', 'workdir'), self.__class__.__name__, self.project_name
      )
    )
    self.cwd = (
      os.path.abspath(context.options.ide_gen_project_cwd) if context.options.ide_gen_project_cwd
      else self.work_dir
    )

    self.intransitive = context.options.ide_gen_intransitive

    self.checkstyle_suppression_files = context.config.getdefault(
      'checkstyle_suppression_files', type=list, default=[]
    )
    self.debug_port = context.config.getint('ide', 'debug_port')

    self.classes_conf = context.config.get('ide', 'classes_conf')
    self.sources_conf = context.config.get('ide', 'sources_conf')

    self.checkstyle_bootstrap_key = 'checkstyle'
    checkstyle = context.config.getlist('checkstyle', 'bootstrap-tools',
                                        default=[':twitter-checkstyle'])
    self._bootstrap_utils.register_jvm_build_tools(self.checkstyle_bootstrap_key, checkstyle)

    self.scalac_bootstrap_key = None
    if not self.skip_scala:
      self.scalac_bootstrap_key = 'scalac'
      scalac = context.config.getlist('scala-compile', 'compile-bootstrap-tools',
                                      default=[':scala-compile-2.9.3'])
      self._bootstrap_utils.register_jvm_build_tools(self.scalac_bootstrap_key, scalac)

    if self.python:
      self.context.products.require('python')
    if not self.skip_java:
      self.context.products.require('java')
    if not self.skip_scala:
      self.context.products.require('scala')

    self.context.products.require('jars')
    self.context.products.require('source_jars')
Exemple #5
0
 def setup_parser(cls, option_group, args, mkflag):
     JvmBinaryTask.setup_parser(option_group, args, mkflag)
     option_group.add_option(
         mkflag("compressed"),
         mkflag("compressed", negate=True),
         dest="binary_create_compressed",
         default=True,
         action="callback",
         callback=mkflag.set_bool,
         help="[%default] Create a compressed binary jar.")
Exemple #6
0
  def setup_parser(cls, option_group, args, mkflag):
    JvmBinaryTask.setup_parser(option_group, args, mkflag)
    option_group.add_option(mkflag("compressed"), mkflag("compressed", negate=True),
                            dest="binary_create_compressed", default=True,
                            action="callback", callback=mkflag.set_bool,
                            help="[%default] Create a compressed binary jar.")

    option_group.add_option(mkflag("zip64"), mkflag("zip64", negate=True),
                            dest="binary_create_zip64", default=False,
                            action="callback", callback=mkflag.set_bool,
                            help="[%default] Create the binary jar with zip64 extensions.")
Exemple #7
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.outdir = (context.options.jvm_binary_create_outdir
                       or context.config.get('binary-create', 'outdir'))
        self.compression = ZIP_DEFLATED if context.options.binary_create_compressed else ZIP_STORED
        self.deployjar = context.options.jvm_binary_create_deployjar

        context.products.require('jars', predicate=self.is_binary)
        if self.deployjar:
            self.require_jar_dependencies()
Exemple #8
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.outdir = (
      context.options.jvm_binary_create_outdir
      or context.config.get('binary-create', 'outdir')
    )
    self.compression = ZIP_DEFLATED if context.options.binary_create_compressed else ZIP_STORED
    self.deployjar = context.options.jvm_binary_create_deployjar

    context.products.require('jars', predicate=self.is_binary)
    if self.deployjar:
      self.require_jar_dependencies()
Exemple #9
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.outdir = (
      context.options.jvm_binary_create_outdir
      or context.config.get('bundle-create', 'outdir')
    )
    self.archiver = context.options.bundle_create_archive

    self.deployjar = context.options.jvm_binary_create_deployjar
    if not self.deployjar:
      self.context.products.require('jars', predicate=self.is_binary)
    self.require_jar_dependencies()
Exemple #10
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.project_name = context.options.ide_gen_project_name
        self.python = context.options.ide_gen_python
        self.skip_java = not context.options.ide_gen_java
        self.skip_scala = not context.options.ide_gen_scala

        self.java_language_level = context.options.ide_gen_java_language_level
        if context.options.ide_gen_java_jdk:
            self.java_jdk = context.options.ide_gen_java_jdk
        else:
            self.java_jdk = '1.%d' % self.java_language_level

        self.work_dir = os.path.abspath(
            context.options.ide_gen_project_dir
            or os.path.join(context.config.get('ide', 'workdir'),
                            self.__class__.__name__, self.project_name))
        self.cwd = (os.path.abspath(context.options.ide_gen_project_cwd)
                    if context.options.ide_gen_project_cwd else self.work_dir)

        self.intransitive = context.options.ide_gen_intransitive

        checkstyle_suppression_files = context.config.getdefault(
            'checkstyle_suppression_files', type=list, default=[])
        debug_port = context.config.getint('ide', 'debug_port')

        self.classes_conf = context.config.get('ide', 'classes_conf')
        self.sources_conf = context.config.get('ide', 'sources_conf')

        scala_compiler_profile = None
        if not self.skip_scala:
            scala_compiler_profile = context.config.getdefault(
                'scala_compile_profile')

        targets, self._project = self.configure_project(
            context.targets(), checkstyle_suppression_files, debug_port,
            scala_compiler_profile)

        self.configure_compile_context(targets)

        if self.python:
            self.context.products.require('python')
        if not self.skip_java:
            self.context.products.require('java')
        if not self.skip_scala:
            self.context.products.require('scala')

        self.context.products.require('jars')
        self.context.products.require('source_jars')
Exemple #11
0
  def setup_parser(cls, option_group, args, mkflag):
    JvmBinaryTask.setup_parser(option_group, args, mkflag)

    archive_flag = mkflag("archive")
    option_group.add_option(archive_flag, dest="bundle_create_archive",
                            type="choice", choices=list(archive.TYPE_NAMES),
                            help="[%%default] Create an archive from the bundle. "
                                 "Choose from %s" % sorted(archive.TYPE_NAMES))

    option_group.add_option(mkflag("archive-prefix"), mkflag("archive-prefix", negate=True),
                            dest="bundle_create_prefix", default=False,
                            action="callback", callback=mkflag.set_bool,
                            help="[%%default] Used in conjunction with %s this packs the archive "
                                 "with its basename as the path prefix." % archive_flag)
Exemple #12
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.outdir = os.path.abspath(
      context.options.jvm_binary_create_outdir or
      context.config.get('binary-create', 'outdir',
                         default=context.config.getdefault('pants_distdir'))
    )
    self.compression = ZIP_DEFLATED if context.options.binary_create_compressed else ZIP_STORED
    self.zip64 = (
      context.options.binary_create_zip64
      or context.config.getbool('binary-create', 'zip64', default=False)
    )
    self.deployjar = context.options.jvm_binary_create_deployjar

    context.products.require('jars', predicate=self.is_binary)
    if self.deployjar:
      self.require_jar_dependencies()
Exemple #13
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.outdir = os.path.abspath(
            context.options.jvm_binary_create_outdir or context.config.get(
                'binary-create',
                'outdir',
                default=context.config.getdefault('pants_distdir')))
        self.compression = ZIP_DEFLATED if context.options.binary_create_compressed else ZIP_STORED
        self.zip64 = (context.options.binary_create_zip64
                      or context.config.getbool(
                          'binary-create', 'zip64', default=False))
        self.deployjar = context.options.jvm_binary_create_deployjar

        context.products.require('jars', predicate=self.is_binary)
        context.products.require_data('classes_by_target')
        context.products.require_data('resources_by_target')
        if self.deployjar:
            self.require_jar_dependencies()
Exemple #14
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.outdir = (context.options.jvm_binary_create_outdir
                       or context.config.get('bundle-create', 'outdir'))

        def fill_archiver_type():
            self.archiver_type = context.options.bundle_create_archive
            # If no option specified, check if anyone is requiring it
            if not self.archiver_type:
                for archive_type in ARCHIVER_BY_TYPE.keys():
                    if context.products.isrequired(archive_type):
                        self.archiver_type = archive_type

        fill_archiver_type()
        self.deployjar = context.options.jvm_binary_create_deployjar
        if not self.deployjar:
            self.context.products.require('jars', predicate=self.is_binary)
        self.require_jar_dependencies()
Exemple #15
0
    def __init__(self, context):
        JvmBinaryTask.__init__(self, context)

        self.outdir = context.options.jvm_binary_create_outdir or context.config.get("bundle-create", "outdir")

        self.prefix = context.options.bundle_create_prefix

        def fill_archiver_type():
            self.archiver_type = context.options.bundle_create_archive
            # If no option specified, check if anyone is requiring it
            if not self.archiver_type:
                for archive_type in archive.TYPE_NAMES:
                    if context.products.isrequired(archive_type):
                        self.archiver_type = archive_type

        fill_archiver_type()
        self.deployjar = context.options.jvm_binary_create_deployjar
        if not self.deployjar:
            self.context.products.require("jars", predicate=self.is_binary)
        self.require_jar_dependencies()
Exemple #16
0
  def __init__(self, context):
    JvmBinaryTask.__init__(self, context)

    self.outdir = (
      context.options.jvm_binary_create_outdir
      or context.config.get('bundle-create', 'outdir')
    )

    def fill_archiver_type():
      self.archiver_type = context.options.bundle_create_archive
      # If no option specified, check if anyone is requiring it
      if not self.archiver_type:
        for archive_type in ARCHIVER_BY_TYPE.keys():
          if context.products.isrequired(archive_type):
            self.archiver_type = archive_type

    fill_archiver_type()
    self.deployjar = context.options.jvm_binary_create_deployjar
    if not self.deployjar:
      self.context.products.require('jars', predicate=self.is_binary)
    self.require_jar_dependencies()
Exemple #17
0
    def setup_parser(cls, option_group, args, mkflag):
        JvmBinaryTask.setup_parser(option_group, args, mkflag)

        archive_flag = mkflag("archive")
        option_group.add_option(
            archive_flag,
            dest="bundle_create_archive",
            type="choice",
            choices=list(archive.TYPE_NAMES),
            help="[%%default] Create an archive from the bundle. "
            "Choose from %s" % sorted(archive.TYPE_NAMES))

        option_group.add_option(
            mkflag("archive-prefix"),
            mkflag("archive-prefix", negate=True),
            dest="bundle_create_prefix",
            default=False,
            action="callback",
            callback=mkflag.set_bool,
            help=
            "[%%default] Used in conjunction with %s this packs the archive "
            "with its basename as the path prefix." % archive_flag)
Exemple #18
0
 def setup_parser(cls, option_group, args, mkflag):
   JvmBinaryTask.setup_parser(option_group, args, mkflag)
   option_group.add_option(mkflag("archive"), dest="bundle_create_archive",
                           type="choice", choices=list(ARCHIVER_BY_TYPE.keys()),
                           help="[%%default] Create an archive from the bundle. "
                                "Choose from %s" % ARCHIVER_BY_TYPE.keys())