forked from JetBrains/ideavim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
217 lines (192 loc) · 7.77 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<project name="IdeaVim">
<!--
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
* Copyright (C) 2003-2009 Rick Maddy, Oleg Shpynov
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-->
<property file="build.properties"/>
<property name="idea" value="${basedir}/idea"/>
<property name="src" value="${basedir}/src"/>
<property name="resources" value="${basedir}/resources"/>
<property name="keymap" value="${basedir}/keymap"/>
<property name="idea.home" value="${idea}/unzip"/>
<property name="version" value="${version-id}.${build.number}"/>
<property name="filename" value="ideavim-${version}"/>
<!--Output-->
<property name="out" value="${basedir}"/>
<property name="classes" value="${out}/classes"/>
<property name="build" value="${out}/build"/>
<property name="dist" value="${out}/dist"/>
<!-- Define task -->
<path id="ant-contrib">
<pathelement path="lib/ant-contrib-1.0b3.jar"/>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="ant-contrib"/>
<path id="build.classpath">
<fileset dir="${idea.home}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes}"/>
</path>
<!-- Clean all the generated stuff -->
<target name="clean" description="Removes all generated files">
<delete dir="${build}"/>
<delete dir="${classes}"/>
<delete dir="${dist}"/>
</target>
<!-- Compile all the sources to the ${classes} folder -->
<target name="compile">
<mkdir dir="${classes}"/>
<!-- The task requires the following libraries from IntelliJ IDEA distribution: -->
<!-- javac2.jar; jdom.jar; asm.jar; asm-commons.jar -->
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath refid="build.classpath"/>
</taskdef>
<javac2 destdir="${classes}"
debug="on"
fork="true">
<classpath refid="build.classpath"/>
<src path="${src}"/>
<include name="com/maddyhome/idea/**"/>
</javac2>
</target>
<!-- Create ideavim.jar for packing inside zip plugin package -->
<target name="jar">
<mkdir dir="${classes}"/>
<mkdir dir="${classes}/META-INF"/>
<copy file="resources/META-INF/plugin.xml" todir="${classes}/META-INF">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="SINCE-VERSION" value="${platform-version}"/>
</filterset>
</copy>
<copy todir="${classes}">
<fileset dir="${src}" excludes="**/*.java"/>
</copy>
<copy todir="${classes}">
<fileset dir="${resources}"/>
</copy>
<mkdir dir="${build}"/>
<jar basedir="${classes}" jarfile="${build}/IdeaVim.jar" compress="yes"/>
</target>
<!-- Create help files -->
<target name="help" depends="clean, compile">
<mkdir dir="${build}/help/txt"/>
<mkdir dir="${build}/help/vim"/>
<copy todir="${build}/help/txt">
<fileset dir="help/txt">
<include name="*.txt"/>
</fileset>
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<!-- Generate tags by shortcuts or actions -->
<fileset dir="${build}/help/txt" id="txt.files">
<include name="*.txt"/>
</fileset>
<pathconvert property="helpfiles" refid="txt.files" pathsep=" "/>
<java failonerror="true" classname="com.maddyhome.idea.vim.help.MakeTags" classpath="${classes}"
output="${build}/help/vim/tags" error="error">
<arg line="${helpfiles}"/>
</java>
<exec executable="sort" output="${build}/help/vim/tags.sort">
<arg value="-u"/>
<arg file="${build}/help/vim/tags"/>
</exec>
<move file="${build}/help/vim/tags.sort" tofile="${build}/help/vim/tags"/>
<exec executable="perl">
<arg file="help/vim2jh.pl"/>
<arg path="${build}/help"/>
<arg path="${build}/help/vim/tags"/>
<arg line="${helpfiles}"/>
</exec>
<copy todir="${build}/help">
<fileset dir="help">
<include name="images/"/>
</fileset>
</copy>
<copy todir="${build}/help">
<fileset dir="help/jh">
<include name="*"/>
</fileset>
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<delete dir="${build}/help/txt"/>
<fileset dir="${build}/help/vim" id="html.files">
<include name="*.html"/>
</fileset>
<pathconvert property="htmlfiles" refid="html.files" pathsep=" "/>
<propertyregex property="srchfiles" input="${htmlfiles}" regexp="${build}/help/" replace="" global="true"/>
<java classname="com.sun.java.help.search.Indexer" classpath="lib/jhall.jar" fork="true" dir="${build}/help">
<arg value="-db"/>
<arg value="MasterSearchIndex"/>
<arg line="${srchfiles}"/>
</java>
<jar basedir="${build}/help" jarfile="${build}/help.jar"/>
</target>
<target name="build" depends="unzip, clean, compile, jar, help" description="Compiles all source code and created plugin jar file"/>
<!-- Donwload IntelliJ IDEA distribution -->
<target name="download" description="Downloads IntellIJ IDEA artifacts">
<delete dir="${idea}"/>
<mkdir dir="${idea}"/>
<get src="${idea.download.url}" dest="${idea}"/>
</target>
<!-- Unpack idea-*.zip file for ideavim compilation -->
<target name="unzip" depends="download" description="Unzip downloaded artifacts and set up idea.home">
<delete dir="${idea}/unzip"/>
<mkdir dir="${idea}/unzip"/>
<unzip dest="${idea}/unzip">
<fileset dir="${idea}" includes="idea*.zip"/>
</unzip>
</target>
<target name="dist" depends="dist-src, dist-bin" description="Creates the src and bin distribution files"/>
<!-- Prepare layout for plugin distribution and creates zip file which can be published -->
<target name="dist-bin" depends="clean, build" description="Creates a zip file containing the plugin sources">
<delete dir="${build}/IdeaVim"/>
<mkdir dir="${build}/IdeaVim"/>
<copy todir="${build}/IdeaVim">
<fileset dir="${basedir}" includes="license/**"/>
<fileset dir="${keymap}" includes="**"/>
</copy>
<copy todir="${build}/IdeaVim/lib">
<fileset dir="${build}" includes="*.jar" excludes="help.jar"/>
</copy>
<copy todir="${build}/IdeaVim/help">
<fileset dir="${build}" includes="help.jar"/>
</copy>
<copy file="${basedir}/README.txt" tofile="${build}/IdeaVim/README">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="PLATFORM_VERSION" value="${platform-version}"/>
</filterset>
</copy>
<copy file="${basedir}/CHANGES.txt" tofile="${build}/IdeaVim/CHANGES">
<filterset>
<filter token="VERSION" value="${version}"/>
<filter token="PLATFORM_VERSION" value="${platform-version}"/>
</filterset>
</copy>
<zip basedir="${build}" zipfile="${dist}/${filename}.zip" compress="true" includes="IdeaVim/**"/>
</target>
<!-- Packs all the sources -->
<target name="dist-src" depends="clean" description="Creates the source tar file">
<mkdir dir="${dist}"/>
<tar basedir="." destfile="${dist}/${filename}-src.tar.gz" excludes=".git/**,.idea/**,idea/**,*.iws,*.iml" compression="gzip"/>
</target>
</project>