<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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.aliyun.odps</groupId>
        <artifactId>odps-sdk</artifactId>
        <version>0.45.2-public</version>
    </parent>

    <groupId>com.aliyun.odps</groupId>
    <artifactId>odps-lot-proto</artifactId>
    <version>0.45.2-public</version>
    <packaging>jar</packaging>

    <name>odps-lot-proto</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>compile-protoc</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <mkdir dir="target/generated-sources"/>
                                <path id="proto.path">
                                    <fileset dir="./common/">
                                        <include name="**/*.proto"/>
                                    </fileset>
                                    <fileset dir="./lot/">
                                        <include name="**/*.proto"/>
                                    </fileset>
                                </path>
                                <pathconvert pathsep=" " property="proto.files"
                                             refid="proto.path"/>
                                <exec executable="../protoc/protoc-2.4.1.sh" failonerror="true"
                                      osfamily="unix">
                                    <arg value="--java_out=${basedir}/target/generated-sources"/>
                                    <arg value="-I${basedir}"/>
                                    <arg line="${proto.files}"/>
                                </exec>
                                <exec executable="../protoc/protoc-2.4.1.sh" failonerror="true"
                                      osfamily="mac">
                                    <arg value="--java_out=${basedir}/target/generated-sources"/>
                                    <arg value="-I${basedir}"/>
                                    <arg line="${proto.files}"/>
                                </exec>
                                <exec executable="${basedir}/../protoc/protoc.exe"
                                      failonerror="true" osfamily="windows">
                                    <arg value="--java_out=${basedir}/target/generated-sources"/>
                                    <arg value="-I${basedir}"/>
                                    <arg line="${proto.files}"/>
                                </exec>

                            </tasks>
                            <sourceRoot>target/generated-sources</sourceRoot>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
        </dependency>
    </dependencies>
</project>
