blob: c7b0cbac749c024ef9234e148b94c8c4eeaa75ef [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">
Stephan Herrmann5e8e56c2022-12-30 22:33:08 +0100109 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"/>
110 <echo message="Extract .class file and properties for the ant adapter from ${target.folder} to ${ecj-temp-folder}" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000111 <mkdir dir="${ecj-temp-folder}"/>
112 <copy todir="${ecj-temp-folder}">
Stephan Herrmann5e8e56c2022-12-30 22:33:08 +0100113 <fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}">
Stephan Herrmannb33126e2022-12-26 18:19:40 +0100114 <include name="org/eclipse/jdt/internal/antadapter/*.*"/>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100115 <include name="org/eclipse/jdt/core/JDTCompilerAdapter*.*"/>
Stephan Herrmannb33126e2022-12-26 18:19:40 +0100116 </fileset>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000117 </copy>
118 </target>
119
120 <target name="export" depends="init">
121 <property name="buildLabel" value="head" />
122 <property name="dest" value="../../ecj-export" />
123 <mkdir dir="${dest}" />
124<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
125 <echo message="UPDATE ecotj-${buildLabel}.jar" />
126 <delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
127 <copy todir="${ecj-temp-folder}">
128 <fileset dir="scripts/binary" />
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200129 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000130 </copy>
131 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
132 <zip zipfile="${dest}/ecotj-${buildLabel}.jar">
133 <fileset dir="${ecj-temp-folder}">
134 <include name="**/*"/>
135 </fileset>
136 <fileset dir="scripts">
137 <include name="about.html" />
138 </fileset>
139 </zip>
140
Stephan Herrmann016c4262010-10-20 22:02:18 +0000141 <echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
142 <delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200143<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000144 <copy todir="${ecj-temp-src-folder}">
145 <fileset dir="scripts/source" />
146 </copy>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200147 <copy todir="${ecj-temp-src-folder}/scripts/binary">
148 <fileset dir="scripts/binary" />
149 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200150 <replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200151 <replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200152 <zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000153 <zipfileset dir="ecj-temp-src-folder" />
Stephan Herrmannb046a492012-08-10 16:50:55 +0200154 <fileset dir="${ecj-temp-folder}">
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200155 <include name="**/messages.properties"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200156 <include name="ecj.1"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200157 </fileset>
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100158 <zipfileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}">
159 <exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000160 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200161 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000162 </zipfileset>
163 <zipfileset dir="scripts">
164 <include name="about.html" />
165 <include name="build.xml" />
166 </zipfileset>
167 </zip>
168 <antcall target="cleanup"/>
169 </target>
170
171 <target name="export_src_bin">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000172 <property name="dest" value="../../ecj-export" />
173 <mkdir dir="${dest}" />
174 <echo message="UPDATE ecj_all.jar" />
175 <delete file="${dest}/ecj_all.jar" failonerror="false"/>
176 <mkdir dir="${ecj-temp-src-folder}/src" />
177 <copy todir="${ecj-temp-folder}">
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200178 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000179 <fileset dir="scripts/binary" />
180 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200181 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000182
183 <copy todir="${ecj-temp-src-folder}/src">
Stephan Herrmann8e48e232022-12-30 12:15:35 +0100184 <fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/src">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000185 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200186 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000187 </fileset>
188 </copy>
189
Stephan Herrmannb046a492012-08-10 16:50:55 +0200190 <zip zipfile="${dest}/ecj-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000191 <fileset dir="${ecj-temp-folder}">
192 <include name="**/*"/>
193 <include name="about.html"/>
194 </fileset>
195 <fileset dir="${ecj-temp-src-folder}">
196 <exclude name="META-INF/**"/>
197 </fileset>
198 <fileset dir="scripts">
199 <include name="about.html" />
200 </fileset>
201 </zip>
202
203 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
204 </target>
205
206 <target name="cleanup">
207 <delete dir="${ecj-temp-folder}" failonerror="false"/>
208 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
209 </target>
210
211 <target name="export-all" depends="init">
212 <antcall target="extract-batch-compiler"/>
213 <antcall target="extract-ant-adapter-compiler"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000214 <antcall target="export_src_bin"/>
215 <antcall target="export"/>
216 <antcall target="cleanup"/>
217 </target>
218</project>