All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uy.quiescence.quiescence.0.2.1.source-code.build.xml Maven / Gradle / Ivy

The newest version!
<project name="quiescence" default="jar">

	<property file="build.properties" />
	
    <property name="src.dir" value="${basedir}/src/main/java" />
	<property name="resources.dir" value="${basedir}/src/main/resources" />
	<property name="target.dir" value="${basedir}/target" />
    <property name="classes.dir" value="${target.dir}/classes" />
    <property name="lib.dir" value="${basedir}/lib" />
    <property name="javadoc.dir" value="${target.dir}/javadoc" />
	
	<property name="javac.source" value="1.6" />
	<property name="javac.target" value="1.6" />
	<property name="javac.deprecation" value="on" />
	<property name="javac.debug" value="on" />
	
	<property name="quiescence.version" value="0.2.1" />
	
	<property name="sonatype.dir" value="${user.home}/.quiescence-${quiescence.version}-sonatype" />
	
    <property name="ant_.version" value="1.10.5" />
	
    <property name="ant-url" value="http://repo1.maven.org/maven2/org/apache/ant/ant/${ant_.version}/ant-${ant_.version}.jar" />

    <target name="check">
        <available file="${dest}/${name}-${version}.jar" property="jar-exists" />
    </target>

    <target name="_pull" depends="check" unless="jar-exists">
        <get src="${url}" dest="${dest}/${name}-${version}.jar" verbose="true" ignoreerrors="true" />
    </target>

    <macrodef name="pull">
        <attribute name="url" />
        <attribute name="dest" />
        <attribute name="name" />
        <attribute name="version" />

        <sequential>
            <antcall target="_pull">
                <param name="url" value="@{url}" />
                <param name="dest" value="@{dest}" />
                <param name="name" value="@{name}" />
                <param name="version" value="@{version}" />
            </antcall>
        </sequential>
    </macrodef>

    <target name="pullall">
        <pull url="${ant-url}" dest="${lib.dir}" name="ant" version="${ant_.version}" />
    </target>
	
    <target name="clean" description="removes all generated collateral">
        <delete dir="${target.dir}" />
    </target>

	<target name="-init" description="prepares repository for a build">
        <mkdir dir="${lib.dir}" />
        <mkdir dir="${target.dir}" />
	</target>
	
    <path id="quiescence.classpath">
        <pathelement location="${lib.dir}/ant-${ant_.version}.jar" />
    </path>
	
	<target name="resources" description="copies files to classes">
		<copy todir="${classes.dir}">
		    <fileset dir="${resources.dir}">
			    <include name="**/*.xml"/>
		    </fileset>
		</copy>
	</target>

    <target name="compile" depends="-init, pullall, resources" description="compiles java files">
        <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
            <classpath refid="quiescence.classpath" />
        </javac>
    </target>
	
    <target name="jar" depends="compile" description="produces the quiescence jar file">
        <jar destfile="${target.dir}/quiescence-${quiescence.version}.jar">
            <fileset dir="${classes.dir}">
                <include name="**/*.class" />
                <include name="**/*.xml" />
            </fileset>
            <manifest>
                <attribute name="quiescence-version" value="${quiescence.version}" />
                <attribute name="Bundle-ManifestVersion" value="2" />
                <attribute name="Bundle-Name" value="quiescence task" />
                <attribute name="Bundle-SymbolicName" value="quiescence; singleton:=true" />
                <attribute name="Bundle-Version" value="${quiescence.version}" />
                <attribute name="Bundle-ClassPath" value="." />
                <attribute name="Bundle-Vendor" value="quiescence Project" />
                <attribute name="Bundle-ActivationPolicy" value="lazy" />
            </manifest>
        </jar>
    </target>
	
	<macrodef name="test-quiescence-macro">
		<attribute name="message" />
		<sequential>
			<quiescence>
				<record name="${target.dir}/__test.txt" action="start" />
				<echo message="answer=@{message}" />
				<record name="${target.dir}/__test.txt" action="stop" />
			</quiescence>
		</sequential>
	</macrodef>
	
	<target name="failtest" unless="property.matches">
		<fail message="quiescence failed to work"/>
	</target>
			
	<target name="test" depends="compile" description="run a test on the ant task">
		<taskdef resource="com/mebigfatguy/quiescence/antlib.xml" classpath="${classes.dir}"/>
		<test-quiescence-macro message="It works"/>
		<replaceregexp file="${target.dir}/__test.txt" match="\[echo\]\s*" replace="" />
		<property file="${target.dir}/__test.txt" />
		<!--<delete file="${target.dir}/__test.txt" />-->
		<condition property="property.matches">
			<equals arg1="It works" arg2="${answer}"/>
		</condition>
		<antcall target="failtest"/>
	</target>
	
    <target name="srczip" description="builds the source distribution zip file">
        <zip destfile="${target.dir}/quiescence-${quiescence.version}-sources.jar">
            <fileset dir="${src.dir}">
                <include name="**/*.java" />
            </fileset>
        	<fileset dir="${resources.dir}">
            	<include name="**/*.xml" />
        	</fileset>
            <fileset dir="${basedir}">
                <include name="build.xml" />
                <include name=".classpath" />
                <include name=".project" />
            </fileset>
        </zip>
    </target>
	
    <target name="javadoc" depends="-init" description="build the javadoc for the project">
        <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="quiescence.classpath" destdir="${javadoc.dir}" windowtitle="quiescence api">
            <doctitle><![CDATA[<h1>quiescence javadoc</h1>]]></doctitle>
            <bottom><![CDATA[<i>Copyright &#169; 2017-2018 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
        </javadoc>
    </target>

    <target name="release" depends="jar, srczip, javadoc" description="prepares everything for a release" />

    <target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype">
        <mkdir dir="${sonatype.dir}"/>
        <copy todir="${sonatype.dir}" file="${target.dir}/quiescence-${quiescence.version}.jar"/>
        <copy tofile="${sonatype.dir}/quiescence-${quiescence.version}-sources.jar" file="${target.dir}/quiescence-${quiescence.version}-sources.jar"/>
        <jar destfile="${sonatype.dir}/quiescence-${quiescence.version}-javadoc.jar" basedir="${target.dir}" includes="javadoc/**"/>
        <copy tofile="${sonatype.dir}/quiescence-${quiescence.version}.pom" file="${basedir}/pom.xml"/>
        
        <exec executable="gpg">
            <arg value="-abi" />
            <arg value="${sonatype.dir}/quiescence-${quiescence.version}.jar" />
        </exec>
        <exec executable="gpg">
            <arg value="-abi" />
            <arg value="${sonatype.dir}/quiescence-${quiescence.version}.pom" />
        </exec>
        <exec executable="gpg">
            <arg value="-abi" />
            <arg value="${sonatype.dir}/quiescence-${quiescence.version}-sources.jar" />
        </exec>        
        <exec executable="gpg">
            <arg value="-abi" />
            <arg value="${sonatype.dir}/quiescence-${quiescence.version}-javadoc.jar" />
        </exec>
        <jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="quiescence*">
        </jar>
        <echo message="" />
        <echo message="" />
        <echo message="====================================================================================================================================" />
        <echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" />
        <echo message="upload this jar at https://oss.sonatype.org" />
        <echo message="" />
        <echo message="see link for details-> https://central.sonatype.org/pages/ossrh-guide.html" />
        <echo message="====================================================================================================================================" />
    </target>
</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy