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


    <parent>
        <groupId>org.mule.tools.devkit</groupId>
        <artifactId>mule-devkit-parent</artifactId>
        <version>3.3.2</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
	<groupId>org.mule.modules</groupId>
    <artifactId>mule-module-protobuf</artifactId>
    <packaging>mule-module</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Google Protocol Buffers Module</name>

    <properties>
        <google.proto.output.directory>src/main/java/</google.proto.output.directory>
        <google.proto.files.directory>src/main/resources</google.proto.files.directory>
    </properties>


    <dependencies>
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-spring-config</artifactId>
            <version>${mule.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule.tools.devkit</groupId>
            <artifactId>mule-devkit-annotations</artifactId>
            <version>${mule.devkit.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>2.4.1</version>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>install</defaultGoal>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.mycila.maven-license-plugin</groupId>
                    <artifactId>maven-license-plugin</artifactId>
                    <version>1.8.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <header>LICENSE_HEADER.txt</header>
                                <excludes>
                                    <exclude>target/**</exclude>
                                    <exclude>.gitignore</exclude>
                                    <exclude>**/*.txt</exclude>
                                    <exclude>**/*.xsd</exclude>
                                    <exclude>**/*.properties</exclude>
                                    <exclude>**/*.xml</exclude>
                                    <exclude>**/*.proto</exclude>
                                </excludes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>proto</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>compile-protoc</id>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <tasks>
                                        <mkdir dir="${google.proto.output.directory}"/>
                                        <path id="proto.path">
                                            <fileset dir="src/main/resources">
                                                <include name="**/*.proto"/>
                                            </fileset>
                                        </path>
                                        <pathconvert pathsep=" " property="proto.files" refid="proto.path"/>
                                        <exec executable="protoc" failonerror="true">
                                            <arg value="--java_out=${google.proto.output.directory}"/>
                                            <arg value="-I${project.basedir}/${google.proto.files.directory}"/>
                                        </exec>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:git://github.com:mulesoft/protobuf-module.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/protobuf-module.git</developerConnection>
        <url>http://github.com/mulesoft/protobuf-module</url>
    </scm>


    <repositories>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshots</name>
            <url>http://repository.mulesoft.org/snapshots/</url>
        </repository>
        <repository>
            <id>codehaus-snaphosts</id>
            <name>Codehaus Snapshots</name>
            <url>http://snapshots.repository.codehaus.org/</url>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases</name>
            <url>http://repository.mulesoft.org/releases/</url>
        </repository>
        <repository>
            <id>codehaus-releases</id>
            <name>Codehaus Releases</name>
            <url>http://repository.codehaus.org/</url>
        </repository>
    </repositories>

</project>
