<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">

	<modelVersion>4.0.0</modelVersion>
	
	<parent>
		<groupId>org.mobicents.javax.sip</groupId>
		<artifactId>restcomm-jain-sip-ext</artifactId>
		<version>1.3.33</version>
		<relativePath>../pom.xml</relativePath>
	</parent>
	
	<groupId>org.mobicents.javax.sip</groupId>
	<artifactId>android-jain-sip-ext</artifactId>
	<version>1.3.33</version>
	
	<name>Restcomm Android JAIN SIP Ext</name>
	<description>Restcomm JAIN SIP Extensions</description>
	<url>https://github.com/RestComm/jain-sip.ext</url>
	
	<properties>
		<generatedsrc.path>${project.build.directory}/generated-sources/src/main/java/android</generatedsrc.path>
	</properties>
	
	<dependencies>
		<dependency>
			<groupId>javax.sip</groupId>
			<artifactId>jain-sip-api</artifactId>
			<version>1.2.1.4</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>dnsjava</groupId>
			<artifactId>dnsjava</artifactId>
			<version>2.1.7</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javolution</groupId>
			<artifactId>javolution</artifactId>
			<version>5.5.1</version>	
		</dependency>

		<!-- logging dependency -->

		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.14</version>
			<scope>provided</scope>
		</dependency>

		<!-- testing dependency -->

		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.8.5</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.1</version>
			<scope>test</scope>
		</dependency>

		<!-- for hashed wheel timers and Netty IO layer -->

		<dependency>
			<groupId>io.netty</groupId>
			<artifactId>netty-all</artifactId>
			<version>4.0.33.Final</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javax.sip</groupId>
			<artifactId>android-jain-sip-ri</artifactId>
			<version>1.2.324</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.restcomm.commons</groupId>
			<artifactId>commons-congestion</artifactId>
			<version>2.0.147</version>
		</dependency>
	</dependencies>

	<build>
		<outputDirectory>${project.build.directory}/classes</outputDirectory>
		<plugins>
			<!-- Import jain-sip-ext from maven artifect  and extract to outputdir-->
			<plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-dependency-plugin</artifactId>
		        <version>3.0.0</version>
		        <executions>
		          <execution>
		            <id>unpack</id>
		            <phase>generate-sources</phase>
		            <goals>
		              <goal>unpack</goal>
		            </goals>
		            <configuration>
		              <downloadSources>true</downloadSources>
		              <artifactItems>
		                <artifactItem>
		                  <groupId>org.mobicents.javax.sip</groupId>
						  <artifactId>jain-sip-ext</artifactId>
						  <version>${project.version}</version>
		                  <classifier>sources</classifier>
		                  <overWrite>true</overWrite>
		                  <outputDirectory>${generatedsrc.path}</outputDirectory>
		                  <excludes>**/META-INF/**</excludes>
		                </artifactItem>
		              </artifactItems>
		            </configuration>
		          </execution>
		        </executions>
		      </plugin>
			<!-- Refactor code for android build -->
			<plugin>
				<groupId>com.google.code.maven-replacer-plugin</groupId>
				<artifactId>replacer</artifactId>
				<version>1.5.3</version>
				<inherited>false</inherited>
				<executions>
					<execution>
						<id>refactor-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>replace</goal>
						</goals>
						<inherited>false</inherited>
						<configuration>
							<basedir>${generatedsrc.path}</basedir>
							<includes>
								<include>**/*.java</include>
							</includes>
							<replacements>
								<replacement>
									<token> gov.nist.</token>
									<value> android.gov.nist.</value>
								</replacement>
								<replacement>
									<token> org.mobicents.ext.javax.sip</token>
									<value> android.org.mobicents.ext.javax.sip</value>
								</replacement>
								<replacement>
									<token>import javax.sip.</token>
									<value>import android.javax.sip.</value>
								</replacement>
								<!-- refactor in DNSAwareRouter.java line 67 -->
								<replacement>
									<token>javax.sip.address.URI requestURI</token>
									<value>URI requestURI</value>
								</replacement>
								
							</replacements>
							<regex>false</regex>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Add source -->
			 <plugin>
				<groupId>org.codehaus.mojo</groupId>
			    <artifactId>build-helper-maven-plugin</artifactId>
			    <executions>
			        <execution>
			            <id>add-source</id>
			            <phase>generate-sources</phase>
			            <goals>
			                <goal>add-source</goal>
			            </goals>
			            <configuration>
			                <sources>
			                    <source>${generatedsrc.path}</source>
			                </sources>
			            </configuration>
			        </execution>
			    </executions>
			</plugin>
			<!-- Attach sources -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.1.2</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<configuration>
					<autoVersionSubmodules>true</autoVersionSubmodules>
					<arguments>-Dmaven.test.skip</arguments>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>