Update Gradle plugin to use convert_mapping_to_xml function
Change-Id: Ice59a5c42c47690c3b0fcf5a37c63bd9e99bae1f Signed-off-by: Umesh Singla <umeshksingla@gmail.com>
This commit is contained in:
parent
ce758e2dd0
commit
d7a205be81
@ -1044,7 +1044,7 @@ def gradle(registry, xml_parent, data):
|
||||
<Gradle+Plugin>`.
|
||||
|
||||
:arg str tasks: List of tasks to execute
|
||||
:arg str gradle-name: Use a custom gradle name (optional)
|
||||
:arg str gradle-name: Use a custom gradle name (default '')
|
||||
:arg bool wrapper: use gradle wrapper (default false)
|
||||
:arg bool executable: make gradlew executable (default false)
|
||||
:arg list switches: Switches for gradle, can have multiples
|
||||
@ -1055,6 +1055,7 @@ def gradle(registry, xml_parent, data):
|
||||
root directory, specify the path (relative to the module
|
||||
root) here, such as ${workspace}/parent/ instead of just
|
||||
${workspace}.
|
||||
:arg str build-file: name of gradle build script (default 'build.gradle')
|
||||
|
||||
Example:
|
||||
|
||||
@ -1062,21 +1063,22 @@ def gradle(registry, xml_parent, data):
|
||||
:language: yaml
|
||||
"""
|
||||
gradle = XML.SubElement(xml_parent, 'hudson.plugins.gradle.Gradle')
|
||||
|
||||
XML.SubElement(gradle, 'description').text = ''
|
||||
XML.SubElement(gradle, 'tasks').text = data['tasks']
|
||||
XML.SubElement(gradle, 'buildFile').text = ''
|
||||
XML.SubElement(gradle, 'rootBuildScriptDir').text = data.get(
|
||||
'root-build-script-dir', '')
|
||||
XML.SubElement(gradle, 'gradleName').text = data.get(
|
||||
'gradle-name', '')
|
||||
XML.SubElement(gradle, 'useWrapper').text = str(data.get(
|
||||
'wrapper', False)).lower()
|
||||
XML.SubElement(gradle, 'makeExecutable').text = str(data.get(
|
||||
'executable', False)).lower()
|
||||
switch_string = '\n'.join(data.get('switches', []))
|
||||
XML.SubElement(gradle, 'switches').text = switch_string
|
||||
XML.SubElement(gradle, 'fromRootBuildScriptDir').text = str(data.get(
|
||||
'use-root-dir', False)).lower()
|
||||
|
||||
mappings = [
|
||||
('build-file', 'buildFile', 'build.gradle'),
|
||||
('tasks', 'tasks', None),
|
||||
('root-build-script-dir', 'rootBuildScriptDir', ''),
|
||||
('gradle-name', 'gradleName', ''),
|
||||
('wrapper', 'useWrapper', False),
|
||||
('executable', 'makeExecutable', False),
|
||||
('use-root-dir', 'fromRootBuildScriptDir', False),
|
||||
]
|
||||
convert_mapping_to_xml(gradle, data, mappings, fail_required=True)
|
||||
|
||||
XML.SubElement(gradle, 'switches').text = '\n'.join(
|
||||
data.get('switches', []))
|
||||
|
||||
|
||||
def _groovy_common_scriptSource(data):
|
||||
|
@ -3,18 +3,18 @@
|
||||
<builders>
|
||||
<hudson.plugins.gradle.Gradle>
|
||||
<description/>
|
||||
<buildFile>build.gradle</buildFile>
|
||||
<tasks>init
|
||||
build
|
||||
tests
|
||||
</tasks>
|
||||
<buildFile/>
|
||||
<rootBuildScriptDir>${workspace}/tests</rootBuildScriptDir>
|
||||
<gradleName>gradle-1.2</gradleName>
|
||||
<useWrapper>true</useWrapper>
|
||||
<makeExecutable>true</makeExecutable>
|
||||
<fromRootBuildScriptDir>true</fromRootBuildScriptDir>
|
||||
<switches>-g /foo/bar/.gradle
|
||||
-PmavenUserName=foobar</switches>
|
||||
<fromRootBuildScriptDir>true</fromRootBuildScriptDir>
|
||||
</hudson.plugins.gradle.Gradle>
|
||||
</builders>
|
||||
</project>
|
||||
|
@ -1,5 +1,6 @@
|
||||
builders:
|
||||
- gradle:
|
||||
build-file: "build.gradle"
|
||||
gradle-name: "gradle-1.2"
|
||||
wrapper: true
|
||||
executable: true
|
||||
|
Loading…
Reference in New Issue
Block a user