blob: be4de24f83cfc860343813aa78cad9cc1aa870e7 [file] [log] [blame]
Stephan Herrmann7b7062f2010-04-01 19:56:59 +00001<?xml version="1.0" encoding="UTF-8"?>
Stephan Herrmann8f4b3212010-05-22 16:38:56 +00002
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +02003<!--
Stephan Herrmann6ed41b12021-02-17 23:59:42 +01004 Copyright (c) 2007, 2020 IBM Corporation and others.
Stephan Herrmannaa0c80c2018-09-08 22:11:53 +02005
6 This program and the accompanying materials
7 are made available under the terms of the Eclipse Public License 2.0
Stephan Herrmann7b7062f2010-04-01 19:56:59 +00008 which accompanies this distribution, and is available at
Stephan Herrmannaa0c80c2018-09-08 22:11:53 +02009 https://www.eclipse.org/legal/epl-2.0/
10
11 SPDX-License-Identifier: EPL-2.0
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000012
13 Contributors:
14 IBM Corporation - initial API and implementation
15 Technical University Berlin - extended API and implementation
16 -->
17
18<!-- build script to create a batch compiler from org.eclipse.jdt.core -->
19<project name="Eclipse Batch Compiler" default="export-all" basedir="..">
20 <target name="init">
21 <tstamp/>
Stephan Herrmann2c5bf482013-06-25 16:20:32 +020022 <property name="bundleVersion" value="3.10.0.qualifier"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +020023 <fail unless="bundleVersion" message="Property 'bundleVersion' must be provided by caller"/>
24 <condition property="bundleVersionOK">
Stephan Herrmann2c5bf482013-06-25 16:20:32 +020025 <matches pattern="\d+\.\d+\.\d+.*" string="${bundleVersion}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +020026 </condition>
Stephan Herrmann6a72b272013-07-14 17:29:27 +020027 <fail message="bundleVersion variable had unexpected format. Should be digits.digits.digits,ANY but was ${bundleVersion}" unless="bundleVersionOK"/>
Stephan Herrmann6ed41b12021-02-17 23:59:42 +010028 <loadresource property="bundleVersionMajor">
29 <string value="${bundleVersion}"/>
30 <filterchain>
31 <tokenfilter>
32 <replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\1"/>
33 </tokenfilter>
34 </filterchain>
35 </loadresource>
36 <loadresource property="bundleVersionMinor">
37 <string value="${bundleVersion}"/>
38 <filterchain>
39 <tokenfilter>
40 <replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\2"/>
41 </tokenfilter>
42 </filterchain>
43 </loadresource>
44 <loadresource property="bundleVersionService">
45 <string value="${bundleVersion}"/>
46 <filterchain>
47 <tokenfilter>
48 <replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\3"/>
49 </tokenfilter>
50 </filterchain>
51 </loadresource>
52 <loadresource property="bundleVersionQualifer">
53 <string value="${bundleVersion}"/>
54 <filterchain>
55 <tokenfilter>
56 <replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\4"/>
57 </tokenfilter>
58 </filterchain>
59 </loadresource>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +020060<!--{ObjectTeams: debug: -->
Stephan Herrmann5775ef02012-09-23 19:23:31 +020061 <echo message="bundleVersion: ${bundleVersion}"/>
62 <echo message="bundleVersionMajor: ${bundleVersionMajor}"/>
63 <echo message="bundleVersionMinor: ${bundleVersionMinor}"/>
64 <echo message="bundleVersionService: ${bundleVersionService}"/>
65 <echo message="bundleVersionQualifier: ${bundleVersionQualifer}"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +020066<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000067 <property name="ecj-temp-folder" value="${basedir}/ecj-temp-folder" />
68 <property name="ecj-temp-src-folder" value="${basedir}/ecj-temp-src-folder" />
69 <mkdir dir="${ecj-temp-src-folder}" />
70 <mkdir dir="${ecj-temp-folder}"/>
71 </target>
72
73 <target name="extract-batch-compiler" depends="init">
74 <property name="target.folder" value="${basedir}/bin"/>
Stephan Herrmann918c05c2012-12-16 20:09:49 +010075 <replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannf4d5e212014-06-10 19:54:03 +020076<!-- {ObjectTeams: more replacement (strategy no longer maintained in JDT?) -->
Stephan Herrmann5ba5c292014-08-10 19:34:32 +020077 <replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_version" value="${bundleVersionMajor}.${bundleVersionMinor}.${bundleVersionService}"/>
Stephan Herrmannf4d5e212014-06-10 19:54:03 +020078<!-- SH}-->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000079 <echo message="Extract .class file and properties for the batch compiler" />
80 <copy todir="${ecj-temp-folder}">
81 <fileset dir="${target.folder}">
82 <include name="org/eclipse/jdt/internal/compiler/**"/>
83 <include name="org/eclipse/jdt/core/compiler/**"/>
84<!--{ObjectTeams:-->
Stephan Herrmannd196f5b2010-04-02 02:52:04 +000085 <include name="org/eclipse/objectteams/otdt/core/compiler/**"/>
86 <include name="org/eclipse/objectteams/otdt/internal/core/compiler/**"/>
87 <include name="org/eclipse/objectteams/otdt/core/exceptions/**"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000088 <include name="org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.class"/>
89<!-- SH} -->
90 <exclude name="**/package.htm*"/>
91 <exclude name="org/eclipse/jdt/core/compiler/CompilationParticipant*.class"/>
92 <exclude name="org/eclipse/jdt/core/compiler/BuildContext.class"/>
93 <exclude name="org/eclipse/jdt/core/compiler/IScanner.class"/>
94 <exclude name="org/eclipse/jdt/core/compiler/ITerminalSymbols*.class"/>
95 <exclude name="org/eclipse/jdt/core/compiler/ReconcileContext*.class"/>
96 <exclude name="org/eclipse/jdt/internal/compiler/DocumentElementParser*.class"/>
97 <exclude name="org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.class"/>
98 <exclude name="org/eclipse/jdt/internal/compiler/ISourceElementRequestor*.class"/>
99 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementParser*.class"/>
100 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter*.class"/>
101 <exclude name="org/eclipse/jdt/internal/compiler/SourceJavadocParser*.class"/>
102 <exclude name="org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter*.class"/>
103 </fileset>
104 </copy>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100105<!-- {ObjectTeams: add apt and tool: -->
Stephan Herrmann1b380592017-12-05 23:13:43 +0100106 <property name="compiler.apt" value="${build.root.dir}/eclipse/plugins/${jdt.compiler.apt}"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100107 <echo message="compiler.apt=${compiler.apt}"/>
108 <unzip src="${compiler.apt}" dest="${ecj-temp-folder}">
109 <patternset>
110 <include name="**/*.class"/>
111 <include name="**/*.properties"/>
112 </patternset>
113 </unzip>
Stephan Herrmann25ac9532016-11-10 22:04:40 +0100114 <property name="compiler.tool" value="${build.root.dir}/eclipse/plugins/${jdt.compiler.tool}"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100115 <echo message="compiler.tool=${compiler.tool}"/>
116 <unzip src="${compiler.tool}" dest="${ecj-temp-folder}">
117 <patternset>
118 <include name="**/*.class"/>
119 <include name="**/*.properties"/>
120 </patternset>
121 </unzip>
122<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000123 </target>
124
125 <target name="extract-_jsr199" depends="init">
126 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.tool/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100127 <echo message="Extract .class file and properties for the jsr199" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000128 <copy todir="${ecj-temp-folder}" failonerror="false">
129 <fileset dir="${target.folder}"/>
130 </copy>
131 </target>
132
133 <target name="extract-_jsr269" depends="init">
134 <property name="jsr_project" value="org.eclipse.jdt.compiler.apt"/>
135 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.apt/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100136 <echo message="Extract .class file and properties for the jsr269" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000137 <copy todir="${ecj-temp-folder}" failonerror="false">
138 <fileset dir="${target.folder}"/>
139 </copy>
140 </target>
141
142 <target name="extract-ant-adapter-compiler" depends="init">
143 <property name="target.folder" value="${basedir}/antbin"/>
144 <echo message="Extract .class file and properties for the ant adapter" />
145 <mkdir dir="${ecj-temp-folder}"/>
146 <copy todir="${ecj-temp-folder}">
147 <fileset dir="${target.folder}">
148 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes*.*"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200149 <exclude name="org/eclipse/jdt/core/BuildJarIndex*.*"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000150 </fileset>
151 </copy>
152 </target>
153
154 <target name="export" depends="init">
155 <property name="buildLabel" value="head" />
156 <property name="dest" value="../../ecj-export" />
157 <mkdir dir="${dest}" />
158<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
159 <echo message="UPDATE ecotj-${buildLabel}.jar" />
160 <delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
161 <copy todir="${ecj-temp-folder}">
162 <fileset dir="scripts/binary" />
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200163 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000164 </copy>
165 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
166 <zip zipfile="${dest}/ecotj-${buildLabel}.jar">
167 <fileset dir="${ecj-temp-folder}">
168 <include name="**/*"/>
169 </fileset>
170 <fileset dir="scripts">
171 <include name="about.html" />
172 </fileset>
173 </zip>
174
Stephan Herrmann016c4262010-10-20 22:02:18 +0000175 <echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
176 <delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200177<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000178 <copy todir="${ecj-temp-src-folder}">
179 <fileset dir="scripts/source" />
180 </copy>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200181 <copy todir="${ecj-temp-src-folder}/scripts/binary">
182 <fileset dir="scripts/binary" />
183 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200184 <replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200185 <replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200186 <zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000187 <zipfileset dir="ecj-temp-src-folder" />
Stephan Herrmannb046a492012-08-10 16:50:55 +0200188 <zipfileset dir="batch">
189 <exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
190 </zipfileset>
191 <fileset dir="${ecj-temp-folder}">
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200192 <include name="**/messages.properties"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200193 <include name="ecj.1"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200194 </fileset>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000195 <zipfileset dir="compiler" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000196 <zipfileset dir="antadapter">
197 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200198 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000199 </zipfileset>
200 <zipfileset dir="scripts">
201 <include name="about.html" />
202 <include name="build.xml" />
203 </zipfileset>
204 </zip>
205 <antcall target="cleanup"/>
206 </target>
207
208 <target name="export_src_bin">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000209 <property name="dest" value="../../ecj-export" />
210 <mkdir dir="${dest}" />
211 <echo message="UPDATE ecj_all.jar" />
212 <delete file="${dest}/ecj_all.jar" failonerror="false"/>
213 <mkdir dir="${ecj-temp-src-folder}/src" />
214 <copy todir="${ecj-temp-folder}">
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200215 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000216 <fileset dir="scripts/binary" />
217 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200218 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000219
220 <copy todir="${ecj-temp-src-folder}/src">
221 <fileset dir="batch" />
222 <fileset dir="compiler" />
223 <fileset dir="antadapter">
224 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200225 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000226 </fileset>
227 </copy>
228
Stephan Herrmannb046a492012-08-10 16:50:55 +0200229 <zip zipfile="${dest}/ecj-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000230 <fileset dir="${ecj-temp-folder}">
231 <include name="**/*"/>
232 <include name="about.html"/>
233 </fileset>
234 <fileset dir="${ecj-temp-src-folder}">
235 <exclude name="META-INF/**"/>
236 </fileset>
237 <fileset dir="scripts">
238 <include name="about.html" />
239 </fileset>
240 </zip>
241
242 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
243 </target>
244
245 <target name="cleanup">
246 <delete dir="${ecj-temp-folder}" failonerror="false"/>
247 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
248 </target>
249
250 <target name="export-all" depends="init">
251 <antcall target="extract-batch-compiler"/>
252 <antcall target="extract-ant-adapter-compiler"/>
253 <antcall target="extract-_jsr199"/>
254 <antcall target="extract-_jsr269"/>
255 <antcall target="export_src_bin"/>
256 <antcall target="export"/>
257 <antcall target="cleanup"/>
258 </target>
259</project>