Repository navigation
Expand file tree
/
Copy pathbuild-master-tasks.xml
More file actions
159 lines (122 loc) · 6.4 KB
/
Copy pathbuild-master-tasks.xml
File metadata and controls
159 lines (122 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
Dec 1, 2008 10:12:19 PM
Build Master Tasks
TCSDEVELOPER
====================================================================== -->
<project name="tools.master.tasks">
<description>
Defines tasks that execute ant scripts or build targets on all the subprojects.
</description>
<!-- = = = = = = = = = = = = = = = = =
macrodef: run-targets-all
Builds a target on each of the subprojects.
= = = = = = = = = = = = = = = = = -->
<macrodef name="run-target-all" description="Builds a target on each of the components.">
<!-- the target to build on every subproject -->
<attribute name="target" />
<attribute name="config" />
<!-- properties that will be passed to the target to build -->
<element name="properties" optional="true"/>
<sequential>
<execute-all prefix="project.current" config="@{config}">
<sequential>
<echo message=""/>
<echo message="--- Executing for: ${project.current.name}"/>
<ant antfile="${project.current.buildType}/${project.current.basedir}/${project.current.buildfile}" target="@{target}" inheritall="false">
<propertyset>
<propertyref builtin="commandline"/>
</propertyset>
<property name="needTokenize" value="${project.current.tokenize}"/>
</ant>
</sequential>
</execute-all>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
scriptdef: execute-all
Runs any ant-script sequence on all subprojects.
= = = = = = = = = = = = = = = = = -->
<scriptdef name="execute-all" language="groovy" description="Runs a sequence of ant script on all the subprojects." classpathref="script.path">
<!-- the prefix of the exported properties -->
<attribute name="prefix" />
<!-- the prefix of the config name -->
<attribute name="config"/>
<!-- the ant-script to run on each of the projects -->
<element name="sequential" type="sequential" />
<![CDATA[
import groovy.util.XmlParser
def prefix = attributes.prefix
def config = attributes.config;
def projects = new XmlParser().parse(new File(project.getProperty("${config}")))
projects.project.each { subproject ->
[
[name : 'name', required : true ],
[name : 'basedir', required : false, defaultValue : subproject.'@name'],
[name : 'buildfile', required : false, defaultValue : 'build.xml'],
[name : 'buildType', required : false, defaultValue : 'components'],
[name : 'tokenize', required : false, defaultValue : 'false']
].each {
def value = subproject."@${it.name}"
if (value == null || value.trim().length() == 0) {
if (it.required) {
self.fail("The ${it.name} attribute of a subproject is required.")
}
value = it.defaultValue
}
value = project.replaceProperties(value)
if(value != null) project.setProperty("${prefix}.${it.name}", value)
}
subproject.versions.version.each {
project.setProperty("${prefix}.version.${it.'@name'}", it.'@path')
}
elements.sequential.each { it.execute() }
}
]]>
</scriptdef>
<!-- = = = = = = = = = = = = = = = = =
scriptdef: execute-single
Runs any ant-script sequence on the specified subproject.
= = = = = = = = = = = = = = = = = -->
<scriptdef name="execute-single" language="groovy" description="Runs a sequence of ant script on the specified subproject." classpathref="script.path">
<!-- the prefix of the exported properties -->
<attribute name="prefix" />
<!-- defines for which subproject project to execute -->
<attribute name="subproject" />
<!-- the ant-script to run on each of the projects -->
<element name="sequential" type="sequential" />
<![CDATA[
import groovy.util.XmlParser
def prefix = attributes.prefix
def projectName = attributes.subproject
def projects = new XmlParser().parse(new File(project.getProperty("subprojects.conf")))
def matchedProjects = projects.project.findAll {it.'@name' == projectName}
if (matchedProjects.size() == 0) {
println "The subproject ${projectName} is not defined in ${project.getProperty("subprojects.conf")}."
} else if (matchedProjects.size() != 1) {
println "The subproject ${projectName} is mutiplely defined in ${project.getProperty("subprojects.conf")}."
} else {
matchedProjects.each { subproject ->
[[name : 'name', required : true ],
[name : 'svnbase', required : true ],
[name : 'basedir', required : false, defaultValue : subproject.'@name'],
[name : 'buildfile', required : false, defaultValue : 'build.xml']].each {
def value = subproject."@${it.name}"
if (value == null || value.trim().length() == 0) {
if (it.required) {
self.fail("The ${it.name} attribute of a subproject is required.")
}
value = it.defaultValue
}
value = project.replaceProperties(value)
project.setProperty("${prefix}.${it.name}", value)
}
subproject.versions.version.each {
project.setProperty("${prefix}.version.${it.'@name'}", it.'@path')
}
elements.sequential.each { it.execute() }
}
}
]]>
</scriptdef>
</project>