forked from l2fprod/l2fprod-common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-components.xsl
More file actions
180 lines (164 loc) · 6.73 KB
/
Copy pathmake-components.xsl
File metadata and controls
180 lines (164 loc) · 6.73 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<project name="build-components" default="jar">
<target name="init">
<filter token="VERSION">
<xsl:attribute name="value">${version}</xsl:attribute>
</filter>
<filter token="PROJECT.FULLNAME">
<xsl:attribute name="value">${project.fullname}</xsl:attribute>
</filter>
<filter token="PROJECT.SHORTNAME">
<xsl:attribute name="value">${project}</xsl:attribute>
</filter>
<filter token="YEAR">
<xsl:attribute name="value">${year}</xsl:attribute>
</filter>
<mkdir>
<xsl:attribute name="dir">${build.dir}/jars/<xsl:value-of select="@name"/>
</xsl:attribute>
</mkdir>
</target>
<!--
Copy src
-->
<target name="src" depends="init">
<xsl:for-each select="//component">
<echo>
Copying source code for <xsl:value-of select="@name"/>
</echo>
<!-- copy the src -->
<mkdir>
<xsl:attribute name="dir">${build.dir}/src/<xsl:value-of select="@name"/>
</xsl:attribute>
</mkdir>
<!-- filtering for java files only -->
<copy filtering="on">
<xsl:attribute name="todir">${build.dir}/src/<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="fileset"/>
</copy>
<copy overwrite="true">
<xsl:attribute name="todir">${build.dir}/src/<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="resources/fileset"/>
</copy>
<!-- images just get copied -->
</xsl:for-each>
</target>
<target name="jar" depends="src">
<xsl:for-each select="//component">
<echo>
Now building component <xsl:value-of select="@name"/>
</echo>
<!-- compile what has been copied -->
<mkdir>
<xsl:attribute name="dir">${build.dir}/classes/<xsl:value-of select="@name"/>
</xsl:attribute>
</mkdir>
<javac debug="on" optimize="off">
<xsl:attribute name="srcdir">${build.dir}/src/<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="destdir">${build.dir}/classes/<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="classpath"/>
<xsl:choose>
<xsl:when test="@isAll='true'">
<xsl:apply-templates select="//component/classpath"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="classpath"/>
</xsl:otherwise>
</xsl:choose>
</javac>
<!-- build the jar for this component -->
<jar destfile="${jar}">
<xsl:attribute name="destfile">${build.dir}/jars/l2fprod-common-<xsl:value-of select="@name"/>.jar</xsl:attribute>
<fileset>
<xsl:attribute name="dir">${build.dir}/classes/<xsl:value-of select="@name"/>
</xsl:attribute>
<include name="**/*.class"/>
</fileset>
<xsl:apply-templates select="resources/fileset"/>
<manifest>
<attribute name="Built-by">
<xsl:attribute name="value">${user.name}</xsl:attribute>
</attribute>
<attribute name="Built-on">
<xsl:attribute name="value">${build.time}</xsl:attribute>
</attribute>
<section name="com/l2fprod/common">
<attribute name="Specification-Title">
<xsl:attribute name="value">${project.fullname}</xsl:attribute>
</attribute>
<attribute name="Specification-Version">
<xsl:attribute name="value">${version}</xsl:attribute>
</attribute>
<attribute name="Specification-Vendor" value="L2FProd.com"/>
<attribute name="Implementation-Title">
<xsl:attribute name="value">${project.fullname}</xsl:attribute>
</attribute>
<attribute name="Implementation-Version">
<xsl:attribute name="value">${version}</xsl:attribute>
</attribute>
<attribute name="Implementation-Vendor" value="L2FProd.com"/>
</section>
<attribute name="Main-Class" value="{@mainclass}"/>
<xsl:choose>
<xsl:when test="@isAll='true'">
<xsl:for-each select="//bean">
<section name="{@name}">
<attribute name="Java-Bean" value="True"/>
</section>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select=".//bean">
<section name="{@name}">
<attribute name="Java-Bean" value="True"/>
</section>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</manifest>
</jar>
</xsl:for-each>
</target>
<target name="javadoc" depends="init">
<property name="dist.javadoc.dir">
<xsl:attribute name="value">${dist.dir}/docs/api</xsl:attribute>
</property>
<mkdir>
<xsl:attribute name="dir">${dist.javadoc.dir}</xsl:attribute>
</mkdir>
<javadoc
private="false"
protected="true"
version="false" author="false" use="false"
stylesheetfile="xdocs/javadoc.css"
splitindex="true">
<xsl:attribute name="windowtitle">${project.fullname} ${version} API</xsl:attribute>
<xsl:attribute name="doctitle">${project.fullname} ${version}</xsl:attribute>
<xsl:attribute name="bottom">Copyright (c) ${year} L2FProd.com. All Rights Reserved.</xsl:attribute>
<xsl:attribute name="sourcepath">${build.dir}/src/all</xsl:attribute>
<xsl:attribute name="destdir">${dist.javadoc.dir}</xsl:attribute>
<fileset>
<xsl:attribute name="dir">${build.dir}/src/all</xsl:attribute>
<xsl:for-each select="//javadoc">
<xsl:apply-templates select="include"/>
</xsl:for-each>
</fileset>
</javadoc>
</target>
</project>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="attribute::*[. != '']"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>