MOEAFramework-3.7.build.xml Maven / Gradle / Ivy
<?xml version="1.0"?> <!-- Copyright 2009-2023 David Hadka This file is part of the MOEA Framework. The MOEA Framework is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The MOEA Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the MOEA Framework. If not, see <http://www.gnu.org/licenses/>. Use of these build scripts requires Apache Ant to be installed. See <http://ant.apache.org/> for instructions on installing Apache Ant. --> <project name="MOEA Framework" basedir="."> <!-- Loads properties from properties file and environment --> <property file="META-INF/build.properties" /> <property environment="env" /> <!-- The working folder for these Ant build targets --> <property name="build" value="build" /> <!-- The folder where compiled files ready for distribution are saved --> <property name="dist" value="dist" /> <!-- The folder where generated javadoc files are saved --> <property name="javadoc" value="javadoc" /> <!-- The folder where maven artifacts are saved --> <property name="maven" value="maven" /> <!-- The base/root folder for organizing distributions --> <property name="base" value="${build}/${shortname}-${version}" /> <!-- Classpath of third-party libraries used by the MOEA Framework --> <path id="classpath"> <fileset dir="lib" includes="*.jar" /> </path> <!-- List of files required in every distribution --> <path id="requiredfiles"> <fileset file="README.md" /> <fileset file="COPYING" /> </path> <!-- Generates the Javadoc webpages --> <target name="build-javadoc"> <delete dir="${javadoc}" /> <mkdir dir="${javadoc}" /> <javadoc sourcepath="src" source="${java.major}" destdir="${javadoc}" packagenames="org.moeaframework.*" maxmemory="256m" noindex="true" nohelp="true" notree="true" overview="src/overview.html" windowtitle="${name} ${version} API"> <header><![CDATA[${javadoc.title}]]></header> <doctitle><![CDATA[${javadoc.title}]]></doctitle> <bottom><![CDATA[${javadoc.bottom}]]></bottom> <classpath> <path refid="classpath" /> </classpath> <arg value="-notimestamp" /> <tag name="preview" description="This feature is in preview and subject to change!" /> </javadoc> </target> <!-- Builds the MOEA Framework JAR file --> <target name="build-binary"> <tstamp /> <delete dir="${build}" /> <mkdir dir="${build}" /> <javac destdir="${build}" srcdir="src" debug="${java.debug}" release="${java.major}" excludes="**/package-info.java" includeantruntime="false" encoding="UTF-8"> <classpath refid="classpath" /> </javac> <copy todir="${build}/META-INF"> <fileset dir="META-INF" excludes="ZHANG-LICENSE" /> <path refid="requiredfiles" /> </copy> <exec executable="git" outputproperty="impl.version" errorproperty="impl.error" failifexecutionfails="false"> <arg value="rev-parse" /> <arg value="--short" /> <arg value="HEAD" /> </exec> <property name="impl.version" value="Undefined" /> <manifest file="${build}/META-INF/MANIFEST.MF"> <section name="org/moeaframework/"> <attribute name="Specification-Title" value="MOEA Framework" /> <attribute name="Specification-Version" value="${version}" /> <attribute name="Specification-Vendor" value="http://www.moeaframework.org" /> <attribute name="Implementation-Title" value="org.moeaframework" /> <attribute name="Implementation-Version" value="${impl.version}" /> <attribute name="Implementation-Vendor" value="http://www.moeaframework.org" /> </section> </manifest> <copy todir="${build}"> <fileset excludes="**/*.java,overview.html" dir="src" /> </copy> <jar basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF" jarfile="${dist}/${shortname}-${version}.jar" /> </target> <!-- Packages the MOEA Framework JAR file along with javadocs and required files --> <target name="package-binary" depends="build-binary, build-javadoc" description="Creates the binary distribution file"> <delete dir="${build}" /> <mkdir dir="${base}" /> <mkdir dir="${base}/docs" /> <mkdir dir="${base}/lib" /> <mkdir dir="${base}/pf" /> <mkdir dir="${base}/licenses" /> <mkdir dir="${base}/examples" /> <copy todir="${base}"> <path refid="requiredfiles" /> <fileset file="moeaframework.properties" /> <fileset file="auxiliary/windows/launch-diagnostic-tool.bat" /> </copy> <copy todir="${base}/licenses"> <fileset dir="META-INF" includes="*-LICENSE" excludes="ZHANG-LICENSE" /> </copy> <copy todir="${base}/docs"> <fileset dir="docs" /> </copy> <copy todir="${base}/lib"> <fileset file="${dist}/${shortname}-${version}.jar" /> <fileset dir="lib" excludes="junit-*.jar,hamcrest-core-*.jar,checkstyle-*.jar" /> </copy> <copy todir="${base}/pf"> <fileset dir="pf" excludes="referenceHypervolume" /> </copy> <copy todir="${base}/javadoc"> <fileset dir="${javadoc}" /> </copy> <copy todir="${base}/examples"> <fileset dir="examples" excludes="*.exe,*.o,*.a" /> </copy> <tar destfile="${dist}/${shortname}-${version}.tar.gz" basedir="${build}" compression="gzip" longfile="gnu" /> </target> <!-- Packages the MOEA Framework source code, libraries and required files --> <target name="package-source" description="Creates the source code distribution file"> <delete dir="${build}" /> <mkdir dir="${base}" /> <copy todir="${base}"> <fileset dir="."> <include name=".project" /> <include name=".classpath" /> <include name="auxiliary/**" /> <include name="docs/**" /> <include name="examples/**" /> <exclude name="examples/*.exe" /> <exclude name="examples/*.o" /> <exclude name="examples/*.a" /> <include name="lib/**" /> <exclude name="lib/junit-*.jar" /> <exclude name="lib/hamcrest-core-*.jar" /> <include name="META-INF/**" /> <include name="pf/**" /> <include name="src/**" /> <include name="test/**" /> <exclude name="test/org/moeaframework/problem/*.exe" /> <exclude name="test/org/moeaframework/problem/*.o" /> <exclude name="test/org/moeaframework/problem/*.a" /> <include name="website/**" /> <include name="moeaframework.properties" /> <include name="build.xml" /> <include name="test.xml" /> </fileset> <path refid="requiredfiles" /> </copy> <replace file="${base}/.project"> <replacefilter token="MOEAFramework" value="MOEAFramework-${version}" /> </replace> <tar destfile="${dist}/${shortname}-${version}-Source.tar.gz" basedir="${build}" compression="gzip" longfile="gnu" /> </target> <!-- Builds the http://www.moeaframework.org website --> <target name="package-website" depends="build-javadoc" description="Creates the website"> <delete dir="${build}" /> <mkdir dir="${build}" /> <tstamp> <format pattern="MMM dd, yyyy" property="today" /> <format pattern="yyyy-MM-dd" property="lastmod" /> </tstamp> <copy todir="${build}"> <fileset dir="website" excludes="*.partial,xslt/**" /> </copy> <copy todir="${build}/javadoc"> <fileset dir="${javadoc}" /> </copy> <loadfile property="website.tracker" srcFile="website/tracker.partial" /> <xslt basedir="website/xslt" destdir="${build}" style="website/xslt/stylesheet.xsl" includes="*.xml" filenameparameter="filename"> <param name="version" expression="${version}" /> <param name="today" expression="${today}" /> <param name="tracker" expression="${website.tracker}" /> </xslt> <replace dir="${build}" includes="**/*.html"> <replacefilter token="%VERSION%" value="${version}" /> <replacefilter value="${website.tracker}"> <replacetoken><![CDATA[<!-- %TRACKER% -->]]></replacetoken> </replacefilter> </replace> <replace file="${build}/sitemap.xml"> <replacefilter token="%LASTMOD%" value="${lastmod}" /> </replace> <copy todir="${build}"> <fileset dir="examples" includes="*.java" excludes="Examples.java" /> </copy> <copy todir="${build}"> <fileset file="examples/dtlz2.c" /> </copy> </target> <!-- Packages the demo distribution --> <target name="package-demo" depends="build-binary" description="Creates the executable JAR file"> <delete dir="${build}" /> <mkdir dir="${build}" /> <unjar dest="${build}" src="lib/commons-cli-1.5.0.jar" /> <move file="${build}/META-INF/NOTICE.txt" tofile="${build}/META-INF/COMMONS-CLI-NOTICE.txt" /> <unjar dest="${build}" src="lib/commons-io-2.11.0.jar" /> <move file="${build}/META-INF/NOTICE.txt" tofile="${build}/META-INF/COMMONS-IO-NOTICE.txt" /> <unjar dest="${build}" src="lib/commons-text-1.10.0.jar" /> <move file="${build}/META-INF/NOTICE.txt" tofile="${build}/META-INF/COMMONS-TEXT-NOTICE.txt" /> <unjar dest="${build}" src="lib/commons-lang3-3.12.0.jar" /> <move file="${build}/META-INF/NOTICE.txt" tofile="${build}/META-INF/COMMONS-LANG3-NOTICE.txt" /> <unjar dest="${build}" src="lib/commons-math3-3.6.1.jar" /> <move file="${build}/META-INF/NOTICE.txt" tofile="${build}/META-INF/COMMONS-MATH3-NOTICE.txt" /> <unjar dest="${build}" src="lib/rsyntaxtextarea-3.3.0.jar" /> <unjar dest="${build}" src="lib/jcommon-1.0.24.jar" /> <unjar dest="${build}" src="lib/jfreechart-1.5.3.jar" /> <delete dir="${build}/META-INF/maven" /> <delete file="${build}/META-INF/LICENSE.txt" /> <delete file="${build}/META-INF/MANIFEST.mf" /> <delete dir="${build}/templates" /> <unjar dest="${build}" src="${dist}/${shortname}-${version}.jar" /> <javac destdir="${build}" srcdir="examples" debug="${java.debug}" release="${java.major}" excludes="**/package-info.java" includeantruntime="false" encoding="UTF-8"> <classpath refid="classpath" /> </javac> <copy todir="${build}"> <fileset excludes="**/*.java,overview.html,*.exe,*.o,*.a" dir="examples" /> </copy> <!-- copy the examples source code so it can be seen in the demo GUI --> <copy todir="${build}/examples"> <fileset dir="examples" excludes="*.exe,*.o,*.a" /> </copy> <copy todir="${build}/pf"> <fileset dir="pf" /> </copy> <manifest mode="update" file="${build}/META-INF/MANIFEST.mf"> <attribute name="Main-Class" value="Examples" /> <attribute name="Class-Path" value="." /> </manifest> <jar destfile="${dist}/${shortname}-${version}-Demo.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.mf" /> </target> <!-- Used by staging.yml to produce the Maven artifacts when releasing a new version --> <target name="package-maven" description="Creates an artifact bundle for upload to Sonatype OSS"> <delete dir="${maven}" /> <mkdir dir="${maven}" /> <property name="artifact" value="moeaframework" /> <copy file="auxiliary/maven/pom.xml" tofile="${maven}/${artifact}-${version}.pom" /> <replace file="${maven}/${artifact}-${version}.pom"> <replacefilter token="%VERSION%" value="${version}" /> </replace> <antcall target="build-binary" /> <copy todir="${build}/pf"> <fileset dir="pf" /> </copy> <jar destfile="${maven}/${artifact}-${version}.jar" basedir="${build}" /> <antcall target="package-source" /> <jar destfile="${maven}/${artifact}-${version}-sources.jar" basedir="${build}" /> <antcall target="build-javadoc" /> <jar destfile="${maven}/${artifact}-${version}-javadoc.jar" basedir="${javadoc}" /> </target> </project>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy