blob: 82b5ca82e29346e95196a558b8c8631223ad4292 [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}"/>
Stephan Herrmann8e48e232022-12-30 12:15:35 +010071 <property name="bin" value="@dot"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000072 </target>
73
74 <target name="extract-batch-compiler" depends="init">
Stephan Herrmann8e48e232022-12-30 12:15:35 +010075 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"/>
Stephan Herrmann918c05c2012-12-16 20:09:49 +010076 <replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannf4d5e212014-06-10 19:54:03 +020077<!-- {ObjectTeams: more replacement (strategy no longer maintained in JDT?) -->
Stephan Herrmann5ba5c292014-08-10 19:34:32 +020078 <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 +020079<!-- SH}-->
Stephan Herrmann8e48e232022-12-30 12:15:35 +010080 <echo message="Extract .class file and properties for the batch compiler to ${ecj-temp-folder}" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000081 <copy todir="${ecj-temp-folder}">
Stephan Herrmann8e48e232022-12-30 12:15:35 +010082 <fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"> <!--{ObjectTeams : changed from target/classes SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000083 <include name="org/eclipse/jdt/internal/compiler/**"/>
84 <include name="org/eclipse/jdt/core/compiler/**"/>
85<!--{ObjectTeams:-->
Stephan Herrmannd196f5b2010-04-02 02:52:04 +000086 <include name="org/eclipse/objectteams/otdt/core/compiler/**"/>
87 <include name="org/eclipse/objectteams/otdt/internal/core/compiler/**"/>
88 <include name="org/eclipse/objectteams/otdt/core/exceptions/**"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000089 <include name="org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.class"/>
90<!-- SH} -->
91 <exclude name="**/package.htm*"/>
92 <exclude name="org/eclipse/jdt/core/compiler/CompilationParticipant*.class"/>
93 <exclude name="org/eclipse/jdt/core/compiler/BuildContext.class"/>
94 <exclude name="org/eclipse/jdt/core/compiler/IScanner.class"/>
95 <exclude name="org/eclipse/jdt/core/compiler/ITerminalSymbols*.class"/>
96 <exclude name="org/eclipse/jdt/core/compiler/ReconcileContext*.class"/>
97 <exclude name="org/eclipse/jdt/internal/compiler/DocumentElementParser*.class"/>
98 <exclude name="org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.class"/>
99 <exclude name="org/eclipse/jdt/internal/compiler/ISourceElementRequestor*.class"/>
100 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementParser*.class"/>
101 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter*.class"/>
102 <exclude name="org/eclipse/jdt/internal/compiler/SourceJavadocParser*.class"/>
103 <exclude name="org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter*.class"/>
104 </fileset>
105 </copy>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000106 </target>
107
108 <target name="extract-ant-adapter-compiler" depends="init">
109 <property name="target.folder" value="${basedir}/antbin"/>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100110 <echo message="Extract .class file and properties for the ant adapter to ${ecj-temp-folder}" />
Stephan Herrmannb5a55a42022-12-30 14:12:29 +0100111 <echo message="compiler.batch=${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"/>
Stephan Herrmann57dca472022-12-30 14:03:03 +0100112 <dirset id="dir.contents" dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/" includes="*"/>
113 <property name="prop.dir.contents" refid="dir.contents"/>
114 <echo>${prop.dir.contents}</echo>
115 <echo message="bin-->"/>
116 <dirset id="dir2.contents" dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}" includes="*"/>
117 <property name="prop.dir2.contents" refid="dir2.contents"/>
118 <echo>${prop.dir2.contents}</echo>
119
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000120 <mkdir dir="${ecj-temp-folder}"/>
121 <copy todir="${ecj-temp-folder}">
122 <fileset dir="${target.folder}">
123 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes*.*"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200124 <exclude name="org/eclipse/jdt/core/BuildJarIndex*.*"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000125 </fileset>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100126 <fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"> <!--{ObjectTeams : changed from target/classes SH} -->
Stephan Herrmannb33126e2022-12-26 18:19:40 +0100127 <include name="org/eclipse/jdt/internal/antadapter/*.*"/>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100128 <include name="org/eclipse/jdt/core/JDTCompilerAdapter*.*"/>
Stephan Herrmannb33126e2022-12-26 18:19:40 +0100129 </fileset>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000130 </copy>
131 </target>
132
133 <target name="export" depends="init">
134 <property name="buildLabel" value="head" />
135 <property name="dest" value="../../ecj-export" />
136 <mkdir dir="${dest}" />
137<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
138 <echo message="UPDATE ecotj-${buildLabel}.jar" />
139 <delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
140 <copy todir="${ecj-temp-folder}">
141 <fileset dir="scripts/binary" />
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200142 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000143 </copy>
144 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
145 <zip zipfile="${dest}/ecotj-${buildLabel}.jar">
146 <fileset dir="${ecj-temp-folder}">
147 <include name="**/*"/>
148 </fileset>
149 <fileset dir="scripts">
150 <include name="about.html" />
151 </fileset>
152 </zip>
153
Stephan Herrmann016c4262010-10-20 22:02:18 +0000154 <echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
155 <delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200156<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000157 <copy todir="${ecj-temp-src-folder}">
158 <fileset dir="scripts/source" />
159 </copy>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200160 <copy todir="${ecj-temp-src-folder}/scripts/binary">
161 <fileset dir="scripts/binary" />
162 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200163 <replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200164 <replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200165 <zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000166 <zipfileset dir="ecj-temp-src-folder" />
Stephan Herrmannb046a492012-08-10 16:50:55 +0200167 <fileset dir="${ecj-temp-folder}">
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200168 <include name="**/messages.properties"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200169 <include name="ecj.1"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200170 </fileset>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100171 <zipfileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}">
172 <exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000173 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200174 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000175 </zipfileset>
176 <zipfileset dir="scripts">
177 <include name="about.html" />
178 <include name="build.xml" />
179 </zipfileset>
180 </zip>
181 <antcall target="cleanup"/>
182 </target>
183
184 <target name="export_src_bin">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000185 <property name="dest" value="../../ecj-export" />
186 <mkdir dir="${dest}" />
187 <echo message="UPDATE ecj_all.jar" />
188 <delete file="${dest}/ecj_all.jar" failonerror="false"/>
189 <mkdir dir="${ecj-temp-src-folder}/src" />
190 <copy todir="${ecj-temp-folder}">
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200191 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000192 <fileset dir="scripts/binary" />
193 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200194 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000195
196 <copy todir="${ecj-temp-src-folder}/src">
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100197 <fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/src">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000198 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200199 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000200 </fileset>
201 </copy>
202
Stephan Herrmannb046a492012-08-10 16:50:55 +0200203 <zip zipfile="${dest}/ecj-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000204 <fileset dir="${ecj-temp-folder}">
205 <include name="**/*"/>
206 <include name="about.html"/>
207 </fileset>
208 <fileset dir="${ecj-temp-src-folder}">
209 <exclude name="META-INF/**"/>
210 </fileset>
211 <fileset dir="scripts">
212 <include name="about.html" />
213 </fileset>
214 </zip>
215
216 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
217 </target>
218
219 <target name="cleanup">
220 <delete dir="${ecj-temp-folder}" failonerror="false"/>
221 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
222 </target>
223
224 <target name="export-all" depends="init">
225 <antcall target="extract-batch-compiler"/>
226 <antcall target="extract-ant-adapter-compiler"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000227 <antcall target="export_src_bin"/>
228 <antcall target="export"/>
229 <antcall target="cleanup"/>
230 </target>
231</project>