build.xml 5.89 KB
Newer Older
1 2
<project name="BytecodeOutline" default="plugin">

3
  <!-- defines the location of the asm project via asm.project.dir -->
ekuleshov's avatar
ekuleshov committed
4
  <property file="${user.home}/asm-build.properties"/>
5 6

  <!-- TODO right now we define bco.version/plugin.id here, but we shall read it from MANIFEST.MF -->
ekuleshov's avatar
ekuleshov committed
7
  <property file="build.properties"/>
8

andrei's avatar
andrei committed
9
  <!-- defines product.version from asm etc  -->
10 11 12
  <property file="${asm.project.dir}/build.properties" />


13 14 15
  <property name="src"                value="${basedir}/src"/>
  <property name="externals"          value="${basedir}/externals"/>
  <property name="out"                value="${basedir}/output"/>
16
  <property name="lib"                value="${basedir}/lib"/>
17
  <property name="out.build"          value="${out}/build"/>
ekuleshov's avatar
ekuleshov committed
18

19 20
  <property name="asm-debug-all.jar" value="${asm.project.dir}/output/dist/lib/all/asm-debug-all-${product.version}.jar"/>
  <property name="asm.jar" value="${lib}/asm-debug-all.jar"/>
21

22 23 24
   <path id="saxon.classpath">
        <fileset dir="${saxon.home}" includes="*.jar"/>
    </path>
25 26

  <target name="init">
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    <!-- read plugin base version from META-INF/MANIFEST.MF to ${pluginVersion} -->
    <loadfile srcFile="${basedir}/META-INF/MANIFEST.MF" property="bco.version">
      <filterchain>
          <tokenfilter><containsregex pattern="Bundle-Version: (.*)" replace="\1"/></tokenfilter>
          <deletecharacters chars=" \n\r"/>
      </filterchain>
    </loadfile>

    <!-- read plugin id from META-INF/MANIFEST.MF to ${pluginId} -->
    <loadfile srcFile="${basedir}/META-INF/MANIFEST.MF" property="plugin.id">
      <filterchain>
          <tokenfilter><containsregex pattern="Bundle-SymbolicName:\s*([^;]+)(;.*)?" replace="\1"/></tokenfilter>
          <deletecharacters chars=" \n\r"/>
      </filterchain>
    </loadfile>

    <property name="plugin.jar"   value="${plugin.id}_${bco.version}.jar"/>
    <property name="feature.jar"  value="${plugin.id}.feature_${bco.version}.jar"/>
45 46 47 48 49
    <condition property="asm.recompile" >
        <not><available file="${asm.jar}" /></not>
    </condition>
  </target>

andrei's avatar
andrei committed
50
    <!-- Trigger (re-)compilation of asm-debug-all.jar, if it is is not available -->
51 52 53 54 55 56 57 58
    <target name="asmcompile" if="asm.recompile" >
        <echo message="Building ASM core libraries"/>
        <ant dir="${asm.project.dir}" inheritall="false" target="jar" >
        	<property name="product.noshrink" value="true"/>
    	</ant>
        <copy tofile="${asm.jar}" preservelastmodified="true" file="${asm-debug-all.jar}" />
    </target>

andrei's avatar
andrei committed
59 60 61 62 63 64
    <!-- use it to force recompilation of asm core libraries -->
    <target name="force_recompile">
        <property name="asm.recompile" value="true" />
        <antcall target="compile" />
    </target>

65
  <target name="compile" depends="init, asmcompile">
66
    <path id="classpath">
67
      <fileset dir="lib" includes="*.jar"/>
68
      <fileset dir="${eclipse.home}" includes="plugins/**/*.jar"/>
69 70
    </path>
    <mkdir dir="${out.build}"/>
71
    <javac destdir="${out.build}" debug="on" source="1.5" target="1.5" includeantruntime="false">
72 73 74
      <classpath refid="classpath"/>
      <src path="${src}"/>
      <include name="**/*.java"/>
75
    </javac>
76 77 78
  </target>

  <target name="jars" depends="compile">
79
    <copy todir="${out.build}">
80
      <fileset dir="${src}">
81 82
        <include name="**/*.properties"/>
      </fileset>
83
    </copy>
84 85 86 87 88 89 90 91 92 93 94
    <filterset id="version.filter">
        <filter token="PLUGIN_VERSION" value="${bco.version}" />
        <filter token="FEATURE_VERSION" value="${bco.version}" />
    </filterset>
  	<mkdir dir="${out}/site"/>
    <copy todir="${out}/site">
      <fileset dir="${basedir}/site">
        <include name="**/*.xml"/>
      </fileset>
      <filterset refid="version.filter"/>
    </copy>
95

ekuleshov's avatar
ekuleshov committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109
    <zip zipfile="${out}/BytecodeOutlinesrc.zip">
      <zipfileset dir="${src}" includes="**/*" prefix="src"/>
      <fileset dir=".">
        <include name="icons/*"/>
        <include name="plugin.xml"/>
        <include name="build.properties"/>
        <include name="META-INF/*"/>
        <include name="build.xml"/>
        <include name="build.config"/>
        <include name=".project"/>
        <include name=".classpath"/>
        <include name="README.txt"/>
        <include name="LICENSE.txt"/>
      </fileset>
110
      <fileset dir="${out}/site">
111 112
        <include name="feature.xml"/>
        <include name="site.xml"/>
113
      </fileset>
114

115 116 117
    </zip>
  </target>

118
  <target name="plugin" depends="jars,xslt">
119
    <zip zipfile="${out}/${plugin.jar}">
120
      <zipfileset dir="${out}" includes="BytecodeOutlinesrc.zip"/>
121
      <fileset dir=".">
122
        <include name="META-INF/MANIFEST.MF"/>
123 124
        <include name="icons/**/*"/>
        <include name="plugin.xml"/>
125
        <include name="about.html"/>
126
        <include name="*.txt"/>
127
        <include name="lib/*.jar"/>
128
      </fileset>
129
    <fileset dir="${out.build}">
130 131
      <include name="**/*"/>
    </fileset>
132
      <zipfileset dir="${out}/doc" includes="toc.xml,ref-*.html" prefix="doc"/>
133
    </zip>
ekuleshov's avatar
ekuleshov committed
134
  </target>
135

ekuleshov's avatar
ekuleshov committed
136 137
  <target name="feature" depends="plugin">
    <jar zipfile="${out}/${feature.jar}">
138
      <fileset dir="${out}/site" includes="feature.xml"/>
ekuleshov's avatar
ekuleshov committed
139 140
    </jar>
  </target>
141

ekuleshov's avatar
ekuleshov committed
142
  <target name="site" depends="feature">
143
    <zip zipfile="${out}/${plugin.id}.update_${bco.version}.zip">
144
      <zipfileset dir="${out}/site" includes="site.xml"/>
ekuleshov's avatar
ekuleshov committed
145 146
      <zipfileset dir="${out}" includes="${feature.jar}" prefix="features"/>
      <zipfileset dir="${out}" includes="${plugin.jar}"  prefix="plugins"/>
147 148
    </zip>
  </target>
149

150
  <target name="clean">
ekuleshov's avatar
ekuleshov committed
151 152
    <delete failonerror="false" includeEmptyDirs="true">
      <fileset dir="${out}" includes="**/*"/>
153
      <fileset dir="${lib}" includes="**/*"/>
ekuleshov's avatar
ekuleshov committed
154
    </delete>
155 156
  </target>

157 158
  <target name="xslt" depends="init">
    <mkdir dir="${out}/doc"/>
159
    <xslt basedir="." destdir="${out}/doc" includes="opcodes.xml" classpathref="saxon.classpath"
160
          style="opcodes-doc.xsl" force="true">
161
       <factory name="net.sf.saxon.TransformerFactoryImpl" />
162 163 164
    </xslt>
  </target>

165
</project>