1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

added jobs parameter to make module (#1550)

* added jobs parameter to make module to allow use of the -j or --jobs argument for make/gmake

* updated documentation

* added changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: David Ruggles <david@safedatausa.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
TheDavidFactor 2021-01-16 16:12:45 -05:00 committed by GitHub
parent aa33ac349c
commit b31583b441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- make - add ``jobs`` parameter to allow specification of number of simultaneous jobs for make to run (https://github.com/ansible-collections/community.general/pull/1550).

View file

@ -40,6 +40,13 @@ options:
- Use a specific make binary.
type: path
version_added: '0.2.0'
jobs:
description:
- Set the number of make jobs to run concurrently.
- Typically if set, this would be the number of processors and/or threads available to the machine.
- This is not supported by all make implementations.
type: int
version_added: 2.0.0
'''
EXAMPLES = r'''
@ -111,6 +118,7 @@ def main():
chdir=dict(type='path', required=True),
file=dict(type='path'),
make=dict(type='path'),
jobs=dict(type='int'),
),
supports_check_mode=True,
)
@ -129,10 +137,19 @@ def main():
else:
make_parameters = []
# build command:
# handle any make specific arguments included in params
base_command = [make_path]
if module.params['jobs'] is not None:
jobs = str(module.params['jobs'])
base_command.extend(["-j", jobs])
if module.params['file'] is not None:
base_command = [make_path, "-f", module.params['file'], make_target]
else:
base_command = [make_path, make_target]
base_command.extend(["-f", module.params['file']])
# add make target
base_command.append(make_target)
# add makefile parameters
base_command.extend(make_parameters)
# Check if the target is already up to date
@ -165,7 +182,8 @@ def main():
target=module.params['target'],
params=module.params['params'],
chdir=module.params['chdir'],
file=module.params['file']
file=module.params['file'],
jobs=module.params['jobs'],
)