allow specifying one or more profiles for the Maven build
This commit is contained in:
parent
511a992e23
commit
998fca9b4e
2 changed files with 11 additions and 3 deletions
|
|
@ -642,10 +642,12 @@ class BuildRoot(object):
|
|||
|
||||
return packages
|
||||
|
||||
def mavenBuild(self, sourcedir, outputdir, repodir, settingsfile, props=None):
|
||||
def mavenBuild(self, sourcedir, outputdir, repodir, settingsfile, props=None, profiles=None):
|
||||
session.host.setBuildRootState(self.id, 'BUILDING')
|
||||
cmd = ['--no-clean', '--chroot', '--unpriv', '--cwd', sourcedir[len(self.rootdir()):], '--',
|
||||
'/usr/bin/mvn', '-s', settingsfile]
|
||||
if profiles:
|
||||
cmd.append('-P%s' % ','.join(profiles))
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
cmd.append('-D%s=%s' % (name, value))
|
||||
|
|
@ -2229,6 +2231,8 @@ class MavenTask(BaseTaskHandler):
|
|||
raise koji.BuildError, 'no repo for tag %s' % build_tag['name']
|
||||
|
||||
build_opts = {'repo_id': repo_id}
|
||||
if opts.get('profiles'):
|
||||
build_opts['profiles'] = opts['profiles']
|
||||
if opts.get('properties'):
|
||||
build_opts['properties'] = opts['properties']
|
||||
if opts.get('patches'):
|
||||
|
|
@ -2411,7 +2415,8 @@ class BuildMavenTask(BaseTaskHandler):
|
|||
settingsfile = '/maven/settings.xml'
|
||||
buildroot.writeMavenSettings(repodir, settingsfile)
|
||||
|
||||
buildroot.mavenBuild(sourcedir, outputdir, repodir, settingsfile, props=self.opts.get('properties'))
|
||||
buildroot.mavenBuild(sourcedir, outputdir, repodir, settingsfile,
|
||||
props=self.opts.get('properties'), profiles=self.opts.get('profiles'))
|
||||
|
||||
pom_extensions = ['.' + ext for ext in session.getArchiveType(type_name='pom')['extensions'].split()]
|
||||
jar_extensions = ['.' + ext for ext in session.getArchiveType(type_name='jar')['extensions'].split()]
|
||||
|
|
|
|||
5
cli/koji
5
cli/koji
|
|
@ -819,6 +819,9 @@ def handle_maven_build(options, session, args):
|
|||
help=_("Do not display progress of the upload"))
|
||||
parser.add_option("--background", action="store_true",
|
||||
help=_("Run the build at a lower priority"))
|
||||
parser.add_option("--profile", action="append",
|
||||
dest="profiles", metavar="PROFILE", default=[],
|
||||
help=_("Enable a profile for the Maven build"))
|
||||
parser.add_option("--property", action="append",
|
||||
dest="properties", metavar="NAME=VALUE", default=[],
|
||||
help=_("Pass a system property to the Maven build"))
|
||||
|
|
@ -841,7 +844,7 @@ def handle_maven_build(options, session, args):
|
|||
parser.error(_("Invalid SCM URL: %s" % source))
|
||||
assert False
|
||||
opts = {}
|
||||
for key in ('skip_tag', 'scratch', 'specfile', 'patches'):
|
||||
for key in ('skip_tag', 'scratch', 'specfile', 'patches', 'profiles'):
|
||||
val = getattr(build_opts, key)
|
||||
if val:
|
||||
opts[key] = val
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue