<?xml version="1.0" encoding="UTF-8"?>
<!--
  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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.hugegraph</groupId>
    <artifactId>hugegraph-computer</artifactId>
    <version>1.0.0</version>
  </parent>
  <groupId>org.apache.hugegraph</groupId>
  <artifactId>computer-k8s</artifactId>
  <version>1.0.0</version>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <properties>
    <lombok.version>1.18.0</lombok.version>
    <maven.bundle.plugin.version>5.1.2</maven.bundle.plugin.version>
    <maven.antrun.plugin.version>3.0.0</maven.antrun.plugin.version>
    <maven.apt.plugin.version>1.1.3</maven.apt.plugin.version>
    <mavem.replacer.plugin.version>1.5.3</mavem.replacer.plugin.version>
    <sundrio.version>0.40.1</sundrio.version>
    <fabric8.version>5.6.0</fabric8.version>
    <maven.jsonschema2pojo.plugin.version>1.1.0</maven.jsonschema2pojo.plugin.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.apache.hugegraph</groupId>
      <artifactId>computer-driver</artifactId>
      <version>${revision}</version>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>kubernetes-client</artifactId>
      <version>${fabric8.version}</version>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <id>auto-clean</id>
            <phase>initialize</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jsonschema2pojo</groupId>
        <artifactId>jsonschema2pojo-maven-plugin</artifactId>
        <version>${maven.jsonschema2pojo.plugin.version}</version>
        <executions>
          <execution>
            <id>generate</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>model-annotator</artifactId>
            <version>${fabric8.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <sourceDirectory>${project.basedir}/schema</sourceDirectory>
          <targetPackage>org.apache.hugegraph.computer.k8s.crd.model</targetPackage>
          <includeConstructors>true</includeConstructors>
          <includeJsr303Annotations>false</includeJsr303Annotations>
          <includeToString>false</includeToString>
          <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
          <generateBuilders>true</generateBuilders>
          <outputDirectory>${project.build.directory}/generated-sources/src/gen/java</outputDirectory>
          <includeAdditionalProperties>false</includeAdditionalProperties>
          <removeOldOutput>true</removeOldOutput>
          <customAnnotator>io.fabric8.kubernetes.ModelAnnotator</customAnnotator>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven.antrun.plugin.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <delete file="${project.build.directory}/generated-sources/src/gen/java/org/apache/hugegraph/computer/k8s/crd/model/CrdSchema.java" verbose="true" />
                <delete file="${project.build.directory}/generated-sources/src/gen/java/org/apache/hugegraph/computer/k8s/crd/model/EnumSchema.java" verbose="true" />
                <delete file="${project.build.directory}/generated-sources/src/gen/java/org/apache/hugegraph/computer/k8s/crd/model/HugeGraphComputerJob.java" verbose="true" />
                <delete file="${project.build.directory}/generated-sources/src/gen/java/org/apache/hugegraph/computer/k8s/crd/model/HugeGraphComputerJobList.java" verbose="true" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>apt-maven-plugin</artifactId>
        <version>${maven.apt.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/generated-sources/annotations</outputDirectory>
              <processor>io.sundr.builder.internal.processor.BuildableProcessor</processor>
              <showWarnings>false</showWarnings>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>builder-annotations</artifactId>
            <version>${sundrio.version}</version>
            <exclusions>
              <exclusion>
                <groupId>com.sun</groupId>
                <artifactId>tools</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
          <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>transform-annotations</artifactId>
            <version>${sundrio.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>${mavem.replacer.plugin.version}</version>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <basedir>${project.basedir}</basedir>
              <includes>
                <include>target/generated-sources/**/*.java</include>
              </includes>
              <regex>true</regex>
              <replacements>
                <replacement>
                  <token>(?s)@Buildable.*\}\)\s</token>
                  <value />
                </replacement>
                <replacement>
                  <token>import\sio\.sundr.*\s</token>
                  <value />
                </replacement>
                <replacement>
                  <token>public[\s]class</token>
                  <value>@SuppressWarnings({"unchecked", "deprecation"})
public class</value>
                </replacement>
              </replacements>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
