summaryrefslogtreecommitdiff
path: root/qpid/java/genpom
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/genpom')
-rwxr-xr-xqpid/java/genpom51
1 files changed, 39 insertions, 12 deletions
diff --git a/qpid/java/genpom b/qpid/java/genpom
index 92822a08ae..39eccd4c3e 100755
--- a/qpid/java/genpom
+++ b/qpid/java/genpom
@@ -32,9 +32,11 @@ parser.add_option("-a", "--artifact")
parser.add_option("-v", "--version")
parser.add_option("-d", "--description", default="")
parser.add_option("-u", "--url", default="")
-parser.add_option("-i", "--ignore", action="store_true", help="ignore missing poms")
+parser.add_option("-m", "--modules", help="modules dependencies")
+parser.add_option("-p", "--prefix", help="prefix of the project's artifacts names")
+parser.add_option("-i", "--ignore", action="store_true", help="ignore missing deps")
parser.add_option("-s", "--search-path", action="append",
- help="the path to search for poms")
+ help="the path to search for deps")
parser.add_option("-S", "--scope", metavar="ARTIFACT=SCOPE", action="append",
default=[],
help="specify scope for an artifact")
@@ -62,16 +64,18 @@ if opts.version is None:
if opts.name is None and opts.artifact is None:
die("one of name or artifact must be supplied")
+if opts.prefix is not None:
+ opts.artifact = opts.prefix + "-" + opts.artifact
+
if opts.name is None:
opts.name = opts.artifact
if opts.artifact is None:
opts.artifact = opts.name
-def lookup(pom, attr):
- nd = pom["project"][attr]
+def lookup(dep, attr):
+ nd = dep["dep"][attr]
if nd is None:
- nd = pom["project/parent"][attr]
if nd is None:
return None
return nd.text()
@@ -90,17 +94,35 @@ for s in opts.scope:
scopes[m.group(1)] = m.group(2)
deps = []
+module_depends = []
+if opts.modules is not None:
+ module_depends = opts.modules.replace("/", "-").split();
+
+for module in module_depends:
+ if opts.prefix is None:
+ artifactId = module
+ else:
+ artifactId = opts.prefix + "-" + module
+
+ deps.append("""
+ <dependency>
+ <groupId>%s</groupId>
+ <artifactId>%s</artifactId>
+ <version>%s</version>
+ </dependency>
+""" % (opts.group, artifactId, opts.version))
+
for jar in jars:
base, ext = os.path.splitext(os.path.basename(jar))
- pom = search(expanded_path, "%s.pom" % base)
- if pom is None:
+ dep = search(expanded_path, "%s.xml" % base)
+ if dep is None:
if opts.ignore:
continue
else:
- die("unable to locate pom for %s" % jar)
- group = lookup(pom, "groupId")
- artifactId = lookup(pom, "artifactId")
- version = lookup(pom, "version")
+ die("unable to locate xml for %s" % jar)
+ group = lookup(dep, "groupId")
+ artifactId = lookup(dep, "artifactId")
+ version = lookup(dep, "version")
deps.append("""
<dependency>
<groupId>%s</groupId>
@@ -119,22 +141,27 @@ TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
<groupId>%(group)s</groupId>
<artifactId>%(artifact)s</artifactId>
<version>%(version)s</version>
+
<name>%(name)s</name>
<url>%(url)s</url>
<description>%(description)s</description>
+
<organization>
<name>The Apache Software Foundation</name>
<url>http://www.apache.org</url>
</organization>
+
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
- <url>/LICENSE.txt</url>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
+
<dependencies>
%(dependencies)s
</dependencies>
+
</project>
"""