blob: fb88fa67aa7655edbe0c1d7a3f56ec7dee715b7c [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 Herrmann02c16462016-11-10 21:49:16 +010080 <property name="compiler.apt" value="${build.root.dir}/eclipse/plugins/org.eclipse.jdt.compiler.apt_${jdt.compiler.apt}.jar"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +010081 <echo message="compiler.apt=${compiler.apt}"/>
82 <unzip src="${compiler.apt}" dest="${ecj-temp-folder}">
83 <patternset>
84 <include name="**/*.class"/>
85 <include name="**/*.properties"/>
86 </patternset>
87 </unzip>
Stephan Herrmann02c16462016-11-10 21:49:16 +010088 <property name="compiler.tool" value="${build.root.dir}/eclipse/plugins/org.eclipse.jdt.compiler.tool_${jdt.compiler.tool}.jar"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +010089 <echo message="compiler.tool=${compiler.tool}"/>
90 <unzip src="${compiler.tool}" dest="${ecj-temp-folder}">
91 <patternset>
92 <include name="**/*.class"/>
93 <include name="**/*.properties"/>
94 </patternset>
95 </unzip>
96<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +000097 </target>
98
99 <target name="extract-_jsr199" depends="init">
100 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.tool/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100101 <echo message="Extract .class file and properties for the jsr199" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000102 <copy todir="${ecj-temp-folder}" failonerror="false">
103 <fileset dir="${target.folder}"/>
104 </copy>
105 </target>
106
107 <target name="extract-_jsr269" depends="init">
108 <property name="jsr_project" value="org.eclipse.jdt.compiler.apt"/>
109 <property name="target.folder" value="${basedir}/../org.eclipse.jdt.compiler.apt/bin"/>
Stephan Herrmann2ba6e972016-11-10 21:31:01 +0100110 <echo message="Extract .class file and properties for the jsr269" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000111 <copy todir="${ecj-temp-folder}" failonerror="false">
112 <fileset dir="${target.folder}"/>
113 </copy>
114 </target>
115
116 <target name="extract-ant-adapter-compiler" depends="init">
117 <property name="target.folder" value="${basedir}/antbin"/>
118 <echo message="Extract .class file and properties for the ant adapter" />
119 <mkdir dir="${ecj-temp-folder}"/>
120 <copy todir="${ecj-temp-folder}">
121 <fileset dir="${target.folder}">
122 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes*.*"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200123 <exclude name="org/eclipse/jdt/core/BuildJarIndex*.*"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000124 </fileset>
125 </copy>
126 </target>
127
128 <target name="export" depends="init">
129 <property name="buildLabel" value="head" />
130 <property name="dest" value="../../ecj-export" />
131 <mkdir dir="${dest}" />
132<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
133 <echo message="UPDATE ecotj-${buildLabel}.jar" />
134 <delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
135 <copy todir="${ecj-temp-folder}">
136 <fileset dir="scripts/binary" />
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200137 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000138 </copy>
139 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
140 <zip zipfile="${dest}/ecotj-${buildLabel}.jar">
141 <fileset dir="${ecj-temp-folder}">
142 <include name="**/*"/>
143 </fileset>
144 <fileset dir="scripts">
145 <include name="about.html" />
146 </fileset>
147 </zip>
148
Stephan Herrmann016c4262010-10-20 22:02:18 +0000149 <echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
150 <delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200151<!-- SH} -->
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000152 <copy todir="${ecj-temp-src-folder}">
153 <fileset dir="scripts/source" />
154 </copy>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200155 <copy todir="${ecj-temp-src-folder}/scripts/binary">
156 <fileset dir="scripts/binary" />
157 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200158 <replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200159 <replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200160 <zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000161 <zipfileset dir="ecj-temp-src-folder" />
Stephan Herrmannb046a492012-08-10 16:50:55 +0200162 <zipfileset dir="batch">
163 <exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
164 </zipfileset>
165 <fileset dir="${ecj-temp-folder}">
Stephan Herrmann1a8ea8f2012-09-18 15:10:52 +0200166 <include name="**/messages.properties"/>
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200167 <include name="ecj.1"/>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200168 </fileset>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000169 <zipfileset dir="compiler" />
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000170 <zipfileset dir="antadapter">
171 <exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
Stephan Herrmann4a05b5f2012-05-17 21:11:23 +0200172 <exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000173 </zipfileset>
174 <zipfileset dir="scripts">
175 <include name="about.html" />
176 <include name="build.xml" />
177 </zipfileset>
178 </zip>
179 <antcall target="cleanup"/>
180 </target>
181
182 <target name="export_src_bin">
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000183 <property name="dest" value="../../ecj-export" />
184 <mkdir dir="${dest}" />
185 <echo message="UPDATE ecj_all.jar" />
186 <delete file="${dest}/ecj_all.jar" failonerror="false"/>
187 <mkdir dir="${ecj-temp-src-folder}/src" />
188 <copy todir="${ecj-temp-folder}">
Stephan Herrmannbc9c6682014-05-15 22:48:38 +0200189 <fileset dir="scripts" includes="ecj.1"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000190 <fileset dir="scripts/binary" />
191 </copy>
Stephan Herrmannb046a492012-08-10 16:50:55 +0200192 <replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
Stephan Herrmann7b7062f2010-04-01 19:56:59 +0000193
194 <copy todir="${ecj-temp-src-folder}/src">
195 <fileset dir="batch" />
196 <fileset dir="compiler" />
197 <fileset dir="antadapter">
198 <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"/>
227 <antcall target="extract-_jsr199"/>
228 <antcall target="extract-_jsr269"/>
229 <antcall target="export_src_bin"/>
230 <antcall target="export"/>
231 <antcall target="cleanup"/>
232 </target>
233</project>