-
Notifications
You must be signed in to change notification settings - Fork 359
/
build.xml
120 lines (108 loc) · 4.01 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
<?xml version="1.0" encoding="utf-8"?>
<project name="lplib.build" default="build" basedir=".">
<property name="tools.dir" location="tools/"/>
<property name="build.dir" location="./"/>
<property name="base.dir" location="./"/>
<property name="des.dir" location="./build"/>
<property name="component.files" value="*"/>
<property name="charset" value="UTF-8"/>
<target name="build" depends="prepare,build-all,copy-extensions,combine.js,seed.js,compress.js,native2ascii,copy">
</target>
<target name="prepare">
<delete>
<fileset dir="${des.dir}" includes="**/*-min.js,**/*.js"/>
</delete>
<copy todir="${des.dir}">
<fileset dir="${base.dir}/src/common/" includes="adapter.js">
</fileset>
</copy>
</target>
<target name="build-all">
<!--
各个组件构建
-->
<subant target="" failonerror="false" inheritall="false">
<fileset dir="${build.dir}/src" includes="**/build.xml"/>
</subant>
<subant target="" failonerror="false" inheritall="false">
<fileset dir="${build.dir}/assets/css" includes="**/build.xml"/>
</subant>
</target>
<target name="copy-extensions">
<copy todir="${des.dir}/extensions">
<fileset dir="${base.dir}/src/extensions" includes="**/*.js">
</fileset>
</copy>
</target>
<!-- 合并js -->
<target name="combine.js" depends="prepare">
<concat destfile="${des.dir}/bui.js" encoding="${charset}" outputencoding="${charset}">
<path path="${des.dir}/loader.js"/>
<path path="${des.dir}/common.js"/>
<path path="${des.dir}/cookie.js"/>
<path path="${des.dir}/data.js"/>
<path path="${des.dir}/overlay.js"/>
<path path="${des.dir}/list.js"/>
<path path="${des.dir}/picker.js"/>
<path path="${des.dir}/form.js"/>
<path path="${des.dir}/select.js"/>
<path path="${des.dir}/mask.js"/>
<path path="${des.dir}/menu.js"/>
<path path="${des.dir}/tab.js"/>
<path path="${des.dir}/toolbar.js"/>
<path path="${des.dir}/progressbar.js"/>
<path path="${des.dir}/calendar.js"/>
<path path="${des.dir}/editor.js"/>
<path path="${des.dir}/grid.js"/>
<path path="${des.dir}/tree.js"/>
<path path="${des.dir}/tooltip.js"/>
<path path="${build.dir}/src/all.js"/>
</concat>
</target>
<!-- 合并js -->
<target name="seed.js" depends="prepare">
<concat destfile="${des.dir}/seed.js" encoding="${charset}" outputencoding="${charset}">
<path path="${des.dir}/loader.js"/>
<path path="${des.dir}/common.js"/>
<path path="${des.dir}/cookie.js"/>
<path path="${build.dir}/src/seed.js"/>
</concat>
</target>
<!-- 使用uglify 压缩js -->
<target name="compress.js">
<apply executable="node" verbose="true" dest="${des.dir}">
<fileset dir="${des.dir}" includes="**/*.js"/>
<arg path="${tools.dir}/uglify/bin/uglifyjs"/>
<arg line="-o"/>
<targetfile/>
<srcfile/>
<mapper type="regexp" from="^(.*)\.(js)$" to="\1-min.\2"/>
</apply>
</target>
<!-- 对 JS 文件 ASCII 化 -->
<target name="native2ascii" depends="compress.js">
<mkdir dir="${build.dir}/tmp"/>
<move todir="${build.dir}/tmp">
<fileset dir="${des.dir}" includes="**/*-min.js, bui.js"/>
</move>
<native2ascii encoding="${charset}"
src="${build.dir}/tmp"
dest="${des.dir}"
includes="**/*.js"/>
<delete dir="${build.dir}/tmp"/>
</target>
<target name="copy" depends="native2ascii">
<copy todir="${des.dir}/css">
<fileset dir="${base.dir}/assets/css" includes="*.css">
</fileset>
</copy>
<copy todir="${des.dir}/img">
<fileset dir="${base.dir}/assets/img" includes="**/*.*">
</fileset>
</copy>
<copy todir="${des.dir}/css/bs3">
<fileset dir="${base.dir}/assets/css/bs3" includes="*.css">
</fileset>
</copy>
</target>
</project>