blob: 513eee337b80610138ad405fbfdf7fb232818138 [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 Herrmannbc9c6682014-05-15 22:48:38 +02004 Copyright (c) 2007, 2014 IBM Corporation and others.
Stephan Herrmann7b7062f2010-04-01 19:56:59 +00005 All rights reserved. This program and the accompanying materials
6 are made available under the terms of the Eclipse Public License v1.0
7 which accompanies this distribution, and is available at
8 http://www.eclipse.org/legal/epl-v10.html
9
10 Contributors:
11 IBM Corporation - initial API and implementation
12 Technical University Berlin - extended API and implementation
13 -->
14
15<!-- build script to create a batch compiler from org.eclipse.jdt.core -->
16<project name="Eclipse Batch Compiler" default="export-all" basedir="..">
17 <target name="init">
18 <tstamp/>
Stephan Herrmann2c5bf482013-06-25 16:20:32 +020019 <property name="bundleVersion" value="3.10.0.qualifier"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +020020 <fail unless="bundleVersion" message="Property 'bundleVersion' must be provided by caller"/>
21 <condition property="bundleVersionOK">
Stephan Herrmann2c5bf482013-06-25 16:20:32 +020022 <matches pattern="\d+\.\d+\.\d+.*" string="${bundleVersion}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +020023 </condition>
Stephan Herrmann6a72b272013-07-14 17:29:27 +020024 <fail message="bundleVersion variable had unexpected format. Should be digits.digits.digits,ANY but was ${bundleVersion}" unless="bundleVersionOK"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +020025 <script language="javascript">
26 var bundleVersion = project.getProperty("bundleVersion");
27 var pattern = new RegExp(/^(\d+)\.(\d+)\.(\d+)\.(.*)$/);
28 var sArray = pattern.exec(bundleVersion); // sArray 0 is "whole match"
29 project.setProperty("bundleVersionMajor", sArray[1]);
30 project.setProperty("bundleVersionMinor", sArray[2]);
31 project.setProperty("bundleVersionService", sArray[3]);
32 project.setProperty("bundleVersionQualifer", sArray[4])
33 </script>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +020034<!--{ObjectTeams: debug: -->
Stephan Herrmann5775ef02012-09-23 19:23:31 +020035 <echo message="bundleVersion: ${bundleVersion}"/>
36 <echo message="bundleVersionMajor: ${bundleVersionMajor}"/>
37 <echo message="bundleVersionMinor: ${bundleVersionMinor}"/>
38 <echo message="bundleVersionService: ${bundleVersionService}"/>
39 <echo message="bundleVersionQualifier: ${bundleVersionQualifer}"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +020040<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000041 <property name="ecj-temp-folder" value="${basedir}/ecj-temp-folder" />
42 <property name="ecj-temp-src-folder" value="${basedir}/ecj-temp-src-folder" />
43 <mkdir dir="${ecj-temp-src-folder}" />
44 <mkdir dir="${ecj-temp-folder}"/>
45 </target>
46
47 <target name="extract-batch-compiler" depends="init">
48 <property name="target.folder" value="${basedir}/bin"/>
Stephan Herrmann918c05c2012-12-16 20:09:49 +010049 <replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannf4d5e212014-06-10 19:54:03 +020050<!-- {ObjectTeams: more replacement (strategy no longer maintained in JDT?) -->
Stephan Herrmann5ba5c292014-08-10 19:34:32 +020051 <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 +020052<!-- SH}-->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000053 <echo message="Extract .class file and properties for the batch compiler" />
54 <copy todir="${ecj-temp-folder}">
55 <fileset dir="${target.folder}">
56 <include name="org/eclipse/jdt/internal/compiler/**"/>
57 <include name="org/eclipse/jdt/core/compiler/**"/>
58<!--{ObjectTeams:-->
Stephan Herrmannd196f5b2010-04-02 02:52:04 +000059 <include name="org/eclipse/objectteams/otdt/core/compiler/**"/>
60 <include name="org/eclipse/objectteams/otdt/internal/core/compiler/**"/>
61 <include name="org/eclipse/objectteams/otdt/core/exceptions/**"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000062 <include name="org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.class"/>
63<!-- SH} -->
64 <exclude name="**/package.htm*"/>
65 <exclude name="org/eclipse/jdt/core/compiler/CompilationParticipant*.class"/>
66 <exclude name="org/eclipse/jdt/core/compiler/BuildContext.class"/>
67 <exclude name="org/eclipse/jdt/core/compiler/IScanner.class"/>
68 <exclude name="org/eclipse/jdt/core/compiler/ITerminalSymbols*.class"/>
69 <exclude name="org/eclipse/jdt/core/compiler/ReconcileContext*.class"/>
70 <exclude name="org/eclipse/jdt/internal/compiler/DocumentElementParser*.class"/>
71 <exclude name="org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.class"/>
72 <exclude name="org/eclipse/jdt/internal/compiler/ISourceElementRequestor*.class"/>
73 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementParser*.class"/>
74 <exclude name="org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter*.class"/>
75 <exclude name="org/eclipse/jdt/internal/compiler/SourceJavadocParser*.class"/>
76 <exclude name="org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter*.class"/>
77 </fileset>
78 </copy>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +010079<!-- {ObjectTeams: add apt and tool: -->
Stephan Herrmannae161992016-11-10 21:43:21 +010080 <property name="version.compiler.apt" value="1.3.0.${eclipse.sdk.qualifier}"/>
81 <property name="compiler.apt" value="${build.root.dir}/eclipse/plugins/org.eclipse.jdt.compiler.apt_${version.compiler.apt}.jar"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +010082 <echo message="compiler.apt=${compiler.apt}"/>
83 <unzip src="${compiler.apt}" dest="${ecj-temp-folder}">
84 <patternset>
85 <include name="**/*.class"/>
86 <include name="**/*.properties"/>
87 </patternset>
88 </unzip>
Stephan Herrmannae161992016-11-10 21:43:21 +010089 <property name="version.compiler.tool" value="1.2.0.${eclipse.sdk.qualifier}"/>
90 <property name="compiler.tool" value="${build.root.dir}/eclipse/plugins/org.eclipse.jdt.compiler.tool_${version.compiler.tool}.jar"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +010091 <echo message="compiler.tool=${compiler.tool}"/>
92 <unzip src="${compiler.tool}" dest="${ecj-temp-folder}">
93 <patternset>
94 <include name="**/*.class"/>
95 <include name="**/*.properties"/>
96 </patternset>
97 </unzip>
98<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000099 </target>
100
101 <target name="extract-_jsr199" depends="init">
102 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.tool/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100103 <echo message="Extract .class file and properties for the jsr199" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000104 <copy todir="${ecj-temp-folder}" failonerror="false">
105 <fileset dir="${target.folder}"/>
106 </copy>
107 </target>
108
109 <target name="extract-_jsr269" depends="init">
110 <property name="jsr_project" value="org.eclipse.jdt.compiler.apt"/>
111 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.apt/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100112 <echo message="Extract .class file and properties for the jsr269" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000113 <copy todir="${ecj-temp-folder}" failonerror="false">
114 <fileset dir="${target.folder}"/>
115 </copy>
116 </target>
117
118 <target name="extract-ant-adapter-compiler" depends="init">
119 <property name="target.folder" value="${basedir}/antbin"/>
120 <echo message="Extract .class file and properties for the ant adapter" />
121 <mkdir dir="${ecj-temp-folder}"/>
122 <copy todir="${ecj-temp-folder}">
123 <fileset dir="${target.folder}">
124 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes*.*"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200125 <exclude name="org/eclipse/jdt/core/BuildJarIndex*.*"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000126 </fileset>
127 </copy>
128 </target>
129
130 <target name="export" depends="init">
131 <property name="buildLabel" value="head" />
132 <property name="dest" value="../../ecj-export" />
133 <mkdir dir="${dest}" />
134<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
135 <echo message="UPDATE ecotj-${buildLabel}.jar" />
136 <delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
137 <copy todir="${ecj-temp-folder}">
138 <fileset dir="scripts/binary" />
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200139 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000140 </copy>
141 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
142 <zip zipfile="${dest}/ecotj-${buildLabel}.jar">
143 <fileset dir="${ecj-temp-folder}">
144 <include name="**/*"/>
145 </fileset>
146 <fileset dir="scripts">
147 <include name="about.html" />
148 </fileset>
149 </zip>
150
Stephan Herrmann016c4262010-10-20 22:02:18 +0000151 <echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
152 <delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200153<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000154 <copy todir="${ecj-temp-src-folder}">
155 <fileset dir="scripts/source" />
156 </copy>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200157 <copy todir="${ecj-temp-src-folder}/scripts/binary">
158 <fileset dir="scripts/binary" />
159 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200160 <replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200161 <replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200162 <zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000163 <zipfileset dir="ecj-temp-src-folder" />
Stephan Herrmannb046a492012-08-10 16:50:55 +0200164 <zipfileset dir="batch">
165 <exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
166 </zipfileset>
167 <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 Herrmann7b7062f2010-04-01 19:56:59 +0000171 <zipfileset dir="compiler" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000172 <zipfileset dir="antadapter">
173 <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">
197 <fileset dir="batch" />
198 <fileset dir="compiler" />
199 <fileset dir="antadapter">
200 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200201 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000202 </fileset>
203 </copy>
204
Stephan Herrmannb046a492012-08-10 16:50:55 +0200205 <zip zipfile="${dest}/ecj-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000206 <fileset dir="${ecj-temp-folder}">
207 <include name="**/*"/>
208 <include name="about.html"/>
209 </fileset>
210 <fileset dir="${ecj-temp-src-folder}">
211 <exclude name="META-INF/**"/>
212 </fileset>
213 <fileset dir="scripts">
214 <include name="about.html" />
215 </fileset>
216 </zip>
217
218 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
219 </target>
220
221 <target name="cleanup">
222 <delete dir="${ecj-temp-folder}" failonerror="false"/>
223 <delete dir="${ecj-temp-src-folder}" failonerror="false"/>
224 </target>
225
226 <target name="export-all" depends="init">
227 <antcall target="extract-batch-compiler"/>
228 <antcall target="extract-ant-adapter-compiler"/>
229 <antcall target="extract-_jsr199"/>
230 <antcall target="extract-_jsr269"/>
231 <antcall target="export_src_bin"/>
232 <antcall target="export"/>
233 <antcall target="cleanup"/>
234 </target>
235</project>