Ejemplo n.º 1
0
def usage():
  print "usage: {0} [args] ".format(sys.argv[0])
  print "Prints all the properties defined in a pom.xml in bash variable syntax."
  print ""
  print "-?,-h         Show this message"
  PomUtils.common_usage()
  sys.exit(1)
Ejemplo n.º 2
0
def usage():
    print "usage: {0} [args] ".format(sys.argv[0])
    print "Prints all the properties defined in a pom.xml in bash variable syntax."
    print ""
    print "-?,-h         Show this message"
    PomUtils.common_usage()
    sys.exit(1)
Ejemplo n.º 3
0
def usage():
    print "usage: %s [args] " % sys.argv[0]
    print "Checks to see if the BUILD.* files should be recomputed for the repo"
    print ""
    print "-?,-h         Show this message"
    print "--rebuild     unconditionally rebuild the BUILD files from pom.xml"
    print "-f, --force   force the use of a seemingly incompatible index version"
    PomUtils.common_usage()
Ejemplo n.º 4
0
def usage():
  print "usage: %s [args] " % sys.argv[0]
  print "Checks to see if the BUILD.* files should be recomputed for the repo"
  print ""
  print "-?,-h         Show this message"
  print "--rebuild     unconditionally rebuild the BUILD files from pom.xml"
  print "-f, --force   force the use of a seemingly incompatible index version"
  PomUtils.common_usage()
Ejemplo n.º 5
0
def main(args):
    """Searches all known modules for an artifactId
     of the module defined in sourceFile and prints them out as <groupId>.<artifactId>
  """

    usage = """usage: %prog [options]
  Searches all known modules for an artifactId or <groupId>.<artifactId>
  and prints out the name of pom.xml files that provide them

  e.g. %prog --target=com.squareup.service.exemplar
       %prog --artifactId=annotations
  """
    parser = OptionParser(usage=usage)
    parser.add_option("-a",
                      "--artifactId",
                      dest="artifactId",
                      help="<artifactId> from maven pom file")
    parser.add_option("-t",
                      "--target",
                      dest="target",
                      help="<groupId>.<artifactId> from maven pom file ")
    (options, args) = parser.parse_args(args)

    if not options.artifactId and not options.target:
        parser.print_help()
        PomUtils.common_usage()
        sys.exit(1)

    if options.artifactId:
        poms = PomUtils.pom_provides_target().find_artifact(options.artifactId)
    elif options.target:
        poms = PomUtils.pom_provides_target().find_target(options.target)

    if len(poms) == 0:
        logger.critical("*** No pom.xml file found")
        sys.exit(1)

    for pom in poms:
        print pom
Ejemplo n.º 6
0
def main(args):
  """Searches all known modules for an artifactId
     of the module defined in sourceFile and prints them out as <groupId>.<artifactId>
  """

  usage = """usage: %prog [options]
  Searches all known modules for an artifactId or <groupId>.<artifactId>
  and prints out the name of pom.xml files that provide them

  e.g. %prog --target=com.squareup.service.exemplar
       %prog --artifactId=annotations
  """
  parser = OptionParser(usage=usage)
  parser.add_option("-a", "--artifactId", dest="artifactId",
                    help="<artifactId> from maven pom file")
  parser.add_option("-t", "--target", dest="target",
                    help="<groupId>.<artifactId> from maven pom file ")
  (options, args) = parser.parse_args(args)

  if not options.artifactId and not options.target:
    parser.print_help()
    PomUtils.common_usage()
    sys.exit(1)


  if options.artifactId:
    poms = PomUtils.pom_provides_target().find_artifact(options.artifactId)
  elif options.target:
    poms = PomUtils.pom_provides_target().find_target(options.target)

  if len(poms) == 0:
    logger.critical("*** No pom.xml file found")
    sys.exit(1)

  for pom in poms:
    print pom
Ejemplo n.º 7
0
logger = logging.getLogger(__name__)


# Test driver
def main(sourceFileName):
    start_ms = int(round(time.time() * 1000))
    pants_refs = DepsFromPom(
        PomUtils.pom_provides_target()).get(sourceFileName)
    elapsed_ms = int(round(time.time() * 1000)) - start_ms
    for pants_ref in pants_refs:
        print("      {ref}".format(ref=pants_ref))
    print
    print("Parsed %d pom.xml files in %dms." %
          (PomContentHandler.num_invocations(), elapsed_ms))


if __name__ == "__main__":
    pom = ""
    args = PomUtils.parse_common_args(sys.argv[1:])
    if len(args) == 1:
        pom = args[0]
    else:
        pom = "common/pom.xml"
        print "usage: {progname} path/to/pom.xml".format(
            progname=os.path.basename(sys.argv[0]))
        print
        PomUtils.common_usage()
        print
        print "Example with {pom}:".format(pom=pom)
    main(pom)
Ejemplo n.º 8
0
def _usage():
  usage()
  print("-x        Exit immediately on failure")
  PomUtils.common_usage()
Ejemplo n.º 9
0
def usage():
  print "usage: {0} [args] ".format(sys.argv[0])
  print "Regenerates the BUILD.* files for the repo"
  print ""
  print "-?,-h         Show this message"
  PomUtils.common_usage()
Ejemplo n.º 10
0
def usage():
  print "usage: %s [args] " % sys.argv[0]
  print "Checks the pants.pex file to see if it has changed.  If so, runs a clean-all."
  print ""
  print "-?,-h         Show this message"
  PomUtils.common_usage()
Ejemplo n.º 11
0
def usage():
    print "usage: %s [args] " % sys.argv[0]
    print "Checks the pants.pex file to see if it has changed.  If so, runs a clean-all."
    print ""
    print "-?,-h         Show this message"
    PomUtils.common_usage()
Ejemplo n.º 12
0
      bc = component(pom_file, generation_context=generation_context)
      if bc.exists:
        try:
          gen_code = bc.generate()
        except Exception as e:
          raise PomConversionError('Failed to generate component {} for pom file {}.\n{}'
                                   .format(component.__name__, pom_file_name, e))
        if gen_code:
          contents += gen_code

    try:
      generation_context.write_build_file(pom_file.directory, contents)
    except Exception as e:
      raise PomConversionError('Failed to write generated build data for {}:\n{}'
                               .format(pom_file_name, e))


def main(poms):
  for pom_file_name in poms:
    PomToBuild().convert_pom(pom_file_name)

if __name__ == "__main__":
  args = PomUtils.parse_common_args(sys.argv[1:])
  poms = []
  if (len(args) > 0):
    main(args)
  else:
    print "usage: {0} path/to/pom.xml".format(os.path.basename(sys.argv[0]))
    PomUtils.common_usage()
    sys.exit(1)
Ejemplo n.º 13
0
def usage():
    print "usage: {0} [args] ".format(sys.argv[0])
    print "Regenerates the BUILD.* files for the repo"
    print ""
    print "-?,-h         Show this message"
    PomUtils.common_usage()