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

di.0.4.source-code.build.xml Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 
Copyright (c) 2012, Jan Bernitt
  
  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
-->
<project basedir="." default="compile" name="silk-di" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

	<property environment="env" />
	<property name="target" value="1.6" />
	<property name="source" value="1.6" />

	<property name="app.name" value="Silk DI" />
	<property name="app.version" value="0.4" />
	<property name="beta.version" value="${app.version}.2" />
	<property name="snapshot.version" value="${app.version}.2" />
	<property name="release.version" value="${app.version}.3" />

	<property name="target.dir" value="target" />
	<property name="src.dir" value="src" />
	<property name="lib.dir" value="lib" />
	<property name="dist.dir" value="dist" />
	
	<property name="core.src.dir" value="${src.dir}/core" />
	<property name="test.src.dir" value="${src.dir}/test" />
	<property name="draft.src.dir" value="${src.dir}/draft" />

	<property name="core.target.dir" value="${target.dir}/core" />
	<property name="draft.target.dir" value="${target.dir}/draft" />
	<property name="test.target.dir" value="${target.dir}/test" />
	<property name="javadoc.target.dir" value="${target.dir}/javadoc" />
	<property name="junit.output.dir" value="${target.dir}/junit" />

	<property name="dist-artifact.id" value="silk-di" />
	<property name="dist.jar" value="${dist.dir}/${dist-artifact.id}-${release.version}.jar" />
	<property name="dist.sources.jar" value="${dist.dir}/${dist-artifact.id}-${release.version}-sources.jar" />
	<property name="dist.javadoc.jar" value="${dist.dir}/${dist-artifact.id}-${release.version}-javadoc.jar" />
	
	<path id="classpath.core">
		<pathelement location="${core.target.dir}" />
	</path>
	<path id="classpath.test">
		<path refid="classpath.core"/>
		<pathelement location="${draft.target.dir}" />
		<fileset dir="${lib.dir}">
		    <include name="*.jar"/>
		</fileset>
	</path>
	<path id="classpath.junit">
		<path refid="classpath.test"/>
		<pathelement location="${test.target.dir}" />
	</path>	

	<target name="init">
		<mkdir dir="${target.dir}" />
		<mkdir dir="${core.target.dir}" />
		<mkdir dir="${test.target.dir}" />
		<mkdir dir="${draft.target.dir}" />
		<copy includeemptydirs="false" todir="${core.target.dir}">
			<fileset dir="${core.src.dir}">
				<exclude name="**/*.launch" />
				<exclude name="**/*.java" />
			</fileset>
		</copy>
		<copy includeemptydirs="false" todir="${test.target.dir}">
			<fileset dir="${test.src.dir}">
				<exclude name="**/*.launch" />
				<exclude name="**/*.java" />
			</fileset>
		</copy>
		<copy includeemptydirs="false" todir="${draft.target.dir}">
			<fileset dir="${draft.src.dir}">
				<exclude name="**/*.launch" />
				<exclude name="**/*.java" />
			</fileset>
		</copy>
	</target>

	<target name="cleanall" depends="clean">
		<delete dir="${lib.dir}"/>
		<delete dir="${dist.dir}" />
	</target>
	
	<target name="clean">
		<delete dir="${target.dir}" />
	</target>

	<target name="compile" depends="init">
		<javac debug="true"  destdir="${core.target.dir}" source="${source}" target="${target}" includeantruntime="false">
			<src path="${core.src.dir}" />
			<classpath refid="classpath.core" />
			<compilerarg value="-Xlint:unchecked" />
		</javac>
		<javac debug="true"  destdir="${draft.target.dir}" source="${source}" target="${target}" includeantruntime="false">
			<src path="${draft.src.dir}" />
			<classpath refid="classpath.core" />
			<compilerarg value="-Xlint:unchecked" />
		</javac>
	</target>

	<target name="jar">
		<tstamp><format property="current.time" pattern="yyMMddHHmmss" /></tstamp>
		<delete dir="${dist.dir}" includes="*-${snapshot.version}*.jar,*-${snapshot.version}*.zip" />
		<antcall target="-jar"><param name="archive-version" value="${snapshot.version}.${current.time}" /></antcall>
	</target>

	<target name="beta">
		<delete dir="${dist.dir}" includes="*-${beta.version}*.jar,*-${beta.version}*.zip,,*-${beta.version}*.asc" />
		<antcall target="-jar">	<param name="archive-version" value="${beta.version}" /></antcall>
	</target>
	
	<target name="release">
		<delete dir="${dist.dir}" includes="*-${release.version}*.jar,*-${release.version}*.zip,,*-${release.version}*.asc" />
		<antcall target="-jar">	<param name="archive-version" value="${release.version}" /></antcall>
	</target>

	<target name="-jar" depends="compile, javadoc, license">
		<jar destfile="${dist.dir}/${dist-artifact.id}-${archive-version}.jar"  >
			<fileset dir="." file="LICENSE" />
			<fileset dir="." file="README" />
			<fileset dir="${core.target.dir}" includes="**/*.class" />
			<manifest>
				<attribute name='Specification-Version' value='${app.version}'/>
				<attribute name='Specification-Title' value='${app.name}' />
				<attribute name='Implementation-Version' value='${app.version}'/>
				<attribute name='Implementation-Title' value='${app.name}' />
				<attribute name='Bundle-License' value='Apache 2.0' />
				<attribute name='Package' value='se.jbee.inject' />
			</manifest>
		</jar>
		<jar destfile="${dist.dir}/${dist-artifact.id}-${archive-version}-sources.jar">
			<fileset dir="." file="LICENSE" />
			<fileset dir="." file="README" />
			<fileset dir="." file="build.xml" />
			<fileset dir="${core.src.dir}" includes="**/*.java" />
			<manifest>
				<attribute name='Specification-Version' value='${app.version}'/>
				<attribute name='Specification-Title' value='${app.name}' />
				<attribute name='Implementation-Version' value='${app.version}'/>
				<attribute name='Implementation-Title' value='${app.name}' />
				<attribute name='Bundle-License' value='Apache 2.0' />
				<attribute name='Package' value='se.jbee.inject' />
			</manifest>
		</jar>
		<jar destfile="${dist.dir}/${dist-artifact.id}-${archive-version}-javadoc.jar">
			<fileset dir="." file="LICENSE" />
			<fileset dir="." file="README" />
			<fileset dir="${javadoc.target.dir}" includes="**/*" />
			<manifest>
				<attribute name='Specification-Version' value='${app.version}'/>
				<attribute name='Specification-Title' value='${app.name}' />
				<attribute name='Implementation-Version' value='${app.version}'/>
				<attribute name='Implementation-Title' value='${app.name}' />
				<attribute name='Bundle-License' value='Apache 2.0' />
				<attribute name='Package' value='se.jbee.inject' />
			</manifest>
		</jar>
		<zip destfile="${dist.dir}/${dist-artifact.id}-${archive-version}.zip">
			<fileset dir="." file="LICENSE" />
			<fileset dir="${dist.dir}" includes="${dist-artifact.id}-${archive-version}*.jar" />
		</zip>
	</target>

	<target name='javadoc' depends="compile" description='Generate javadoc.'>
		<javadoc use='true' author='true' version='true' 
			access='package' destdir='${javadoc.target.dir}' 
			windowtitle='${app.name} ${app.version}' 
			noqualifier='java.*:javax.*:com.sun.*' linksource='false'>

			<packageset dir="${core.src.dir}" defaultexcludes="yes" />

			<classpath refid="classpath.core" />
			<link href='http://jbee.github.com/silk/assets/javadoc/' />
			<header><![CDATA[<h1><em>${app.name} ${app.version}</em></h1>]]></header>
		</javadoc>
	</target>

	<target name="test-init">
		<mkdir dir="${lib.dir}"/>
		<get src="http://search.maven.org/remotecontent?filepath=junit/junit/4.8.1/junit-4.8.1.jar" dest="${lib.dir}/junit-4.8.1.jar" usetimestamp="true" skipexisting="true" />
	</target>
	
	<target name="test-compile" depends="compile, test-init">
		<javac debug="true" destdir="${test.target.dir}" source="${source}" target="${target}" includeantruntime="false">
			<src path="${test.src.dir}" />
			<classpath refid="classpath.test" />
			<compilerarg value="-Xlint:unchecked" />
		</javac>
	</target>
	
	<target name="test" depends="test-compile">
		<mkdir dir="${junit.output.dir}" />
		<junit fork="yes" printsummary="withOutAndErr">
			<formatter type="xml" />
			<test name="se.jbee.inject.SuiteSilk" todir="${junit.output.dir}" />
			<classpath refid="classpath.junit" />
		</junit>
	</target>
	
	<target name="report">
		<junitreport todir="${junit.output.dir}">
			<fileset dir="${junit.output.dir}">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="frames" todir="${junit.output.dir}" />
		</junitreport>
	</target>

	<target name="license" depends="javadoc" description="Write the license headers">
	<echo file="${dist.dir}/javaheader.txt">/*
 *  Copyright (c) 2012, Jan Bernitt 
 *			
 *  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
 */</echo>

		<loadfile property="javaheader" srcFile="${dist.dir}/javaheader.txt" />
		<replaceregexp match="\A(/\*.*?\*/.*?)??^package " flags="sm" replace="${javaheader}${line.separator}package ">
			<fileset dir="${core.src.dir}">
				<include name="**/*.java" />
			</fileset>
		</replaceregexp>

	<echo file="${dist.dir}/htmlheader.txt">&lt;!-- 
  Copyright (c) 2012, Jan Bernitt
  
  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
--&gt;</echo>
		<loadfile property="htmlheader" srcFile="${dist.dir}/htmlheader.txt" />
		<replaceregexp match="^.!--NewPage--." flags="sm" replace="&lt;!--NewPage--&gt;${line.separator}${htmlheader}">
			<fileset dir="${javadoc.target.dir}">
				<include name="**/*.html" />
			</fileset>
		</replaceregexp>
	</target>
	
	<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
	<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />

	<target name="publish" depends="pom" > 
		
		<artifact:mvn>
			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
			<arg value="-Durl=${maven-staging-repository-url}" />
			<arg value="-DrepositoryId=${maven-staging-repository-id}" />
			<arg value="-DpomFile=pom.xml" />
			<arg value="-Dfile=${dist.jar}" />
                  <arg value="-Pgpg" />
		</artifact:mvn>

		<artifact:mvn>
			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
			<arg value="-Durl=${maven-staging-repository-url}" />
			<arg value="-DrepositoryId=${maven-staging-repository-id}" />
			<arg value="-DpomFile=pom.xml" />
			<arg value="-Dfile=${dist.sources.jar}" />
			<arg value="-Dclassifier=sources" />
                  <arg value="-Pgpg" />
		</artifact:mvn>

		<artifact:mvn>
			<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
			<arg value="-Durl=${maven-staging-repository-url}" />
			<arg value="-DrepositoryId=${maven-staging-repository-id}" />
			<arg value="-DpomFile=pom.xml" />
			<arg value="-Dfile=${dist.javadoc.jar}" />
			<arg value="-Dclassifier=javadoc" />
                  <arg value="-Pgpg" />
		</artifact:mvn>		
	</target>

	<target name="pom">
	<echoxml file="pom.xml">
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>se.jbee</groupId>
  <artifactId>silk-di</artifactId>
  <version>${app.version}</version>
  <packaging>jar</packaging>
  <name>Silk DI</name>
  <description>Silk Java dependency injection framework</description>
  <url>http://www.silkdi.com</url>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>https://github.com/jbee/silk</url>
    <connection>https://github.com/jbee/silk.git</connection>
  </scm>
  <developers>
    <developer>
      <id>jan</id>
      <name>Jan Bernitt</name>
      <email>[email protected]</email>
    </developer>
  </developers>
</project>	
	</echoxml>
	</target>
</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy