<?xml version="1.0"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>
    <artifactId>drill-root</artifactId>
    <groupId>org.apache.drill</groupId>
    <version>1.17.0</version>
  </parent>

  <artifactId>drill-protocol</artifactId>
  <packaging>jar</packaging>
  <name>Drill Protocol</name>

  <dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
    </dependency>
    <dependency>
      <groupId>io.protostuff</groupId>
      <artifactId>protostuff-core</artifactId>
      <version>1.6.0</version>
    </dependency>
    <dependency>
      <groupId>io.protostuff</groupId>
      <artifactId>protostuff-json</artifactId>
      <version>1.6.0</version>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>proto-compile</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <license.skip>false</license.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <configuration>
              <filesets>
                <fileset>
                  <directory>src/main/java</directory>
                  <includes>
                    <include>**</include>
                  </includes>
                </fileset>
              </filesets>
            </configuration>
            <executions>
              <execution>
                <id>clean-before-code-generation</id>
                <phase>initialize</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>io.protostuff</groupId>
            <artifactId>protostuff-maven-plugin</artifactId>
            <version>1.6.0</version>
            <configuration>
              <protoModules>
                <protoModule>
                  <source>src/main/protobuf/</source>
                  <outputDir>src/main/java</outputDir>
                  <output>java_v2protoc_schema</output>
                  <encoding>UTF-8</encoding>
                  <options>
                    <property>
                      <name>generate_field_map</name>
                    </property>
                  </options>
                </protoModule>
              </protoModules>
            </configuration>
            <executions>
              <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.github.igor-petruk.protobuf</groupId>
            <artifactId>protobuf-maven-plugin</artifactId>
            <version>0.6.5</version>
            <executions>
              <execution>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <cleanOutputFolder>false</cleanOutputFolder>
                  <outputDirectory>${basedir}/src/main/java</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>proto-format</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>format</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>

  </build>
</project>
