blob: c7b0cbac749c024ef9234e148b94c8c4eeaa75ef [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2007, 2020 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
IBM Corporation - initial API and implementation
Technical University Berlin - extended API and implementation
-->
<!-- build script to create a batch compiler from org.eclipse.jdt.core -->
<project name="Eclipse Batch Compiler" default="export-all" basedir="..">
<target name="init">
<tstamp/>
<property name="bundleVersion" value="3.10.0.qualifier"/>
<fail unless="bundleVersion" message="Property 'bundleVersion' must be provided by caller"/>
<condition property="bundleVersionOK">
<matches pattern="\d+\.\d+\.\d+.*" string="${bundleVersion}"/>
</condition>
<fail message="bundleVersion variable had unexpected format. Should be digits.digits.digits,ANY but was ${bundleVersion}" unless="bundleVersionOK"/>
<loadresource property="bundleVersionMajor">
<string value="${bundleVersion}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\1"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="bundleVersionMinor">
<string value="${bundleVersion}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\2"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="bundleVersionService">
<string value="${bundleVersion}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\3"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="bundleVersionQualifer">
<string value="${bundleVersion}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="^(\d+)\.(\d+)\.(\d+)\.(.*)$" replace="\4"/>
</tokenfilter>
</filterchain>
</loadresource>
<!--{ObjectTeams: debug: -->
<echo message="bundleVersion: ${bundleVersion}"/>
<echo message="bundleVersionMajor: ${bundleVersionMajor}"/>
<echo message="bundleVersionMinor: ${bundleVersionMinor}"/>
<echo message="bundleVersionService: ${bundleVersionService}"/>
<echo message="bundleVersionQualifier: ${bundleVersionQualifer}"/>
<!-- SH} -->
<property name="ecj-temp-folder" value="${basedir}/ecj-temp-folder" />
<property name="ecj-temp-src-folder" value="${basedir}/ecj-temp-src-folder" />
<mkdir dir="${ecj-temp-src-folder}" />
<mkdir dir="${ecj-temp-folder}"/>
<property name="bin" value="@dot"/>
</target>
<target name="extract-batch-compiler" depends="init">
<property name="target.folder" value="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"/>
<replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_qualifier" value="${bundleVersionQualifer}"/>
<!-- {ObjectTeams: more replacement (strategy no longer maintained in JDT?) -->
<replace file="${target.folder}/org/eclipse/jdt/internal/compiler/batch/messages.properties" token="bundle_version" value="${bundleVersionMajor}.${bundleVersionMinor}.${bundleVersionService}"/>
<!-- SH}-->
<echo message="Extract .class file and properties for the batch compiler to ${ecj-temp-folder}" />
<copy todir="${ecj-temp-folder}">
<fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"> <!--{ObjectTeams : changed from target/classes SH} -->
<include name="org/eclipse/jdt/internal/compiler/**"/>
<include name="org/eclipse/jdt/core/compiler/**"/>
<!--{ObjectTeams:-->
<include name="org/eclipse/objectteams/otdt/core/compiler/**"/>
<include name="org/eclipse/objectteams/otdt/internal/core/compiler/**"/>
<include name="org/eclipse/objectteams/otdt/core/exceptions/**"/>
<include name="org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.class"/>
<!-- SH} -->
<exclude name="**/package.htm*"/>
<exclude name="org/eclipse/jdt/core/compiler/CompilationParticipant*.class"/>
<exclude name="org/eclipse/jdt/core/compiler/BuildContext.class"/>
<exclude name="org/eclipse/jdt/core/compiler/IScanner.class"/>
<exclude name="org/eclipse/jdt/core/compiler/ITerminalSymbols*.class"/>
<exclude name="org/eclipse/jdt/core/compiler/ReconcileContext*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/DocumentElementParser*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/ISourceElementRequestor*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/SourceElementParser*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/SourceJavadocParser*.class"/>
<exclude name="org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter*.class"/>
</fileset>
</copy>
</target>
<target name="extract-ant-adapter-compiler" depends="init">
<property name="target.folder" value="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}"/>
<echo message="Extract .class file and properties for the ant adapter from ${target.folder} to ${ecj-temp-folder}" />
<mkdir dir="${ecj-temp-folder}"/>
<copy todir="${ecj-temp-folder}">
<fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}">
<include name="org/eclipse/jdt/internal/antadapter/*.*"/>
<include name="org/eclipse/jdt/core/JDTCompilerAdapter*.*"/>
</fileset>
</copy>
</target>
<target name="export" depends="init">
<property name="buildLabel" value="head" />
<property name="dest" value="../../ecj-export" />
<mkdir dir="${dest}" />
<!-- {ObjectTeams: changed name from ecj to ecotj. SH} -->
<echo message="UPDATE ecotj-${buildLabel}.jar" />
<delete file="${dest}/ecotj-${buildLabel}.jar" failonerror="false"/>
<copy todir="${ecj-temp-folder}">
<fileset dir="scripts/binary" />
<fileset dir="scripts" includes="ecj.1"/>
</copy>
<replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${buildLabel}"/>
<zip zipfile="${dest}/ecotj-${buildLabel}.jar">
<fileset dir="${ecj-temp-folder}">
<include name="**/*"/>
</fileset>
<fileset dir="scripts">
<include name="about.html" />
</fileset>
</zip>
<echo message="UPDATE ecotjsrc-${buildLabel}.jar" />
<delete file="${dest}/ecotjsrc-${buildLabel}.jar" failonerror="false"/>
<!-- SH} -->
<copy todir="${ecj-temp-src-folder}">
<fileset dir="scripts/source" />
</copy>
<copy todir="${ecj-temp-src-folder}/scripts/binary">
<fileset dir="scripts/binary" />
</copy>
<replace file="${ecj-temp-src-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
<replace file="${ecj-temp-src-folder}/scripts/binary/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
<zip zipfile="${dest}/ecjsrc-${buildLabel}.jar">
<zipfileset dir="ecj-temp-src-folder" />
<fileset dir="${ecj-temp-folder}">
<include name="**/messages.properties"/>
<include name="ecj.1"/>
</fileset>
<zipfileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/${bin}">
<exclude name="org/eclipse/jdt/internal/compiler/batch/messages.properties"/>
<exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
<exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
</zipfileset>
<zipfileset dir="scripts">
<include name="about.html" />
<include name="build.xml" />
</zipfileset>
</zip>
<antcall target="cleanup"/>
</target>
<target name="export_src_bin">
<property name="dest" value="../../ecj-export" />
<mkdir dir="${dest}" />
<echo message="UPDATE ecj_all.jar" />
<delete file="${dest}/ecj_all.jar" failonerror="false"/>
<mkdir dir="${ecj-temp-src-folder}/src" />
<copy todir="${ecj-temp-folder}">
<fileset dir="scripts" includes="ecj.1"/>
<fileset dir="scripts/binary" />
</copy>
<replace file="${ecj-temp-folder}/META-INF/MANIFEST.MF" token="qualifier" value="${bundleVersionQualifer}"/>
<copy todir="${ecj-temp-src-folder}/src">
<fileset dir="${basedir}/../org.eclipse.jdt.core.compiler.batch/src">
<exclude name="org/eclipse/jdt/core/CheckDebugAttributes.java"/>
<exclude name="org/eclipse/jdt/core/BuildJarIndex.java"/>
</fileset>
</copy>
<zip zipfile="${dest}/ecj-${buildLabel}.jar">
<fileset dir="${ecj-temp-folder}">
<include name="**/*"/>
<include name="about.html"/>
</fileset>
<fileset dir="${ecj-temp-src-folder}">
<exclude name="META-INF/**"/>
</fileset>
<fileset dir="scripts">
<include name="about.html" />
</fileset>
</zip>
<delete dir="${ecj-temp-src-folder}" failonerror="false"/>
</target>
<target name="cleanup">
<delete dir="${ecj-temp-folder}" failonerror="false"/>
<delete dir="${ecj-temp-src-folder}" failonerror="false"/>
</target>
<target name="export-all" depends="init">
<antcall target="extract-batch-compiler"/>
<antcall target="extract-ant-adapter-compiler"/>
<antcall target="export_src_bin"/>
<antcall target="export"/>
<antcall target="cleanup"/>
</target>
</project>