1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2024-11-13 22:42:45 +01:00
IntelliJ-IdeaVim/build.xml
Oleg Shpynov 4895f4d0a5 Cleanup
2011-12-03 19:27:57 +04:00

218 lines
7.8 KiB
XML

<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>