-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.xml
152 lines (130 loc) · 6.04 KB
/
build.xml
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
<!-- This is just an additional tools after we use a IDE env. -->
<project name="org.siphon.d2js" basedir="." default="default">
<property file="build.properties" />
<path id="classpath">
<fileset dir="${CATALINA_HOME}/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${dir.weblib}">
<include name="**.jar" />
<exclude name="${ant.project.name}.jar" />
</fileset>
</path>
<target name="compile">
<delete dir="${dir.bin}" />
<mkdir dir="${dir.bin}" />
<javac srcdir="${dir.src}" debug="on" destdir="${dir.bin}" classpathref="classpath" includeantruntime="true" includejavaruntime="true" encoding="utf-8" />
<jar destfile="${dir.weblib}/${ant.project.name}.jar">
<fileset dir="${dir.bin}" includes="**">
<exclude name="log4j.properties" />
</fileset>
<metainf dir="${dir.web}/META-INF" />
</jar>
</target>
<target name="default">
<antcall target="compile" />
<delete file="${project.war}" />
<mkdir dir="${dir.temp}" />
<copy todir="${dir.temp}" includeemptydirs="false">
<fileset dir="${dir.web}">
<exclude name="**/*-test/" />
<exclude name="**/guide/" />
<exclude name="**/bookstore/" />
<exclude name="**/test/" />
<exclude name="**/*.html" />
<exclude name="**/molecule-dev/" />
<exclude name="**/molecules/*block*.html" />
</fileset>
</copy>
<war destfile="${project.war}">
<fileset dir="${dir.temp}">
<exclude name="**/*.class" />
</fileset>
</war>
<delete dir="${dir.temp}" />
</target>
<patternset id="not-web-content">
<exclude name="**/WEB-INF/web.xml" />
<exclude name="**/WEB-INF/config/**" />
<exclude name="**/META-INF/**" />
<exclude name="**/*-test/" />
<exclude name="**/guide/" />
<exclude name="**/bookstore/" />
<exclude name="**/test/" />
<exclude name="**/*.html" />
<exclude name="**/*.jssp" />
<exclude name="**/molecule-dev/" />
<exclude name="**/molecules/*block*.html" />
</patternset>
<target name="update-d2js">
<property name="file.d2js.zip" value="${dir.temp}/org.siphon.d2js.zip" />
<mkdir dir="${dir.temp}" />
<get src="https://github.com/inshua/d2js/archive/master.zip" dest="${file.d2js.zip}" />
<unzip dest="${dir.temp}" src="${file.d2js.zip}">
<patternset refid="not-web-content" />
</unzip>
<delete file="${file.d2js.zip}" />
<copydir src="${dir.temp}/d2js-master/WebContent" dest="${dir.web}" />
<delete dir="${dir.temp}" />
</target>
<target name="create-d2js-project">
<input addproperty="gen.project.name" message="enter project name" />
<echo message="Project Name: ${gen.project.name}" />
<input addproperty="gen.project.parentdir" message="put to:" description="workspace directory" defaultvalue="${basedir}/.." />
<echo message="Put To: ${gen.project.parentdir}" />
<input addproperty="gen.database.url" message="database url(pg):" defaultvalue="jdbc:postgresql://localhost:5432/bookstore" description="you can manually edit WebContent/WEB-INF/config/database.js" />
<input addproperty="gen.database.username" message="database username:" defaultvalue="postgres" description="you can manually edit WebContent/WEB-INF/config/database.js" />
<input addproperty="gen.database.password" message="database password:" defaultvalue="password" description="you can manually edit WebContent/WEB-INF/config/database.js" />
<!--<antcall target="compile" />-->
<delete dir="${dir.temp}" />
<mkdir dir="${dir.temp}" />
<mkdir dir="${dir.temp}/src" />
<mkdir dir="${dir.temp}/build" />
<mkdir dir="${dir.temp}/test" />
<mkdir dir="${dir.temp}/WebContent" />
<copy todir="${dir.temp}/WebContent">
<fileset dir="${dir.web}">
<patternset refid="not-web-content" />
</fileset>
<fileset dir="${dir.web}">
<!-- ignored by prior pattern -->
<patternset>
<include name="**/WEB-INF/web.xml" />
<include name="**/WEB-INF/config/**" />
<include name="**/welcome.jssp" />
</patternset>
</fileset>
</copy>
<copy todir="${dir.temp}" overwrite="true">
<fileset dir="${basedir}">
<include name=".classpath" />
<include name=".project" />
<include name="build.properties" />
<include name="build.xml" />
<include name="**/.settings/*" />
</fileset>
</copy>
<copy todir="${dir.temp}/src" overwrite="true" file="${basedir}/src/log4j.properties" />
<copy tofile="${dir.temp}/WebContent/index.jssp" overwrite="true" file="${dir.web}/welcome.jssp" />
<replace file="${dir.temp}/.project" token="<name>d2js</name>" value="<name>${gen.project.name}</name>" />
<replace file="${dir.temp}/build.xml" token="name="org.siphon.d2js"" value="name="${gen.project.name}"" />
<replace file="${dir.temp}/src/log4j.properties" token="d2js" value="${gen.project.name}" />
<replace file="${dir.temp}/WebContent/WEB-INF/config/website.js" token="d2js" value="${gen.project.name}" />
<replace file="${dir.temp}/WebContent/WEB-INF/web.xml" token="<display-name>d2js</display-name>" value="<display-name>${gen.project.name}</display-name>" />
<replace file="${dir.temp}/WebContent/WEB-INF/config/database.js" token="jdbc:postgresql://localhost:5432/bookstore" value="/${gen.database.url}/" />
<replace file="${dir.temp}/WebContent/WEB-INF/config/database.js" token=""postgres"" value=""${gen.database.username}"" />
<replace file="${dir.temp}/WebContent/WEB-INF/config/database.js" token=""pass4postgres"" value=""${gen.database.password}"" />
<replace file="${dir.temp}/.settings/org.eclipse.wst.common.component" token="d2js" value="${gen.project.name}" />
<replace file="${dir.temp}/WebContent/jslib/molecule.js" token="d2js" value="${gen.project.name}" />
<property name="gen.project.dir" value="${gen.project.parentdir}/${gen.project.name}" />
<mkdir dir="${gen.project.dir}" />
<copy todir="${gen.project.dir}">
<fileset dir="${dir.temp}" includes="**/*">
</fileset>
</copy>
<delete dir="${dir.temp}" />
</target>
<target name="update-molecule">
<copy file="${basedir}/molecule/molecule.js" tofile="${dir.web}/jslib/molecule.js" />
</target>
</project>