<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.apicurio</groupId>
    <artifactId>apicurio-registry-operator</artifactId>
    <version>3.0.14</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>apicurio-registry-operator-controller</artifactId>
  <name>Apicurio Registry Operator :: Controller</name>

  <properties>
    <projectRoot>${project.basedir}/../..</projectRoot>
  </properties>

  <dependencies>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-operator-model</artifactId>
    </dependency>

    <dependency>
      <groupId>io.quarkiverse.operatorsdk</groupId>
      <artifactId>quarkus-operator-sdk</artifactId>
    </dependency>

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-kubernetes-client</artifactId>
    </dependency>

    <!-- NOTE: There are multiple JSON manipulation libraries available, but we're already using json.org,
               so I'll use it here as well.
    -->
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-json-org</artifactId>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>

  </dependencies>

  <build>

    <resources>

      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
        <includes>
          <include>application.properties</include>
        </includes>
      </resource>

      <resource>
        <filtering>false</filtering>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>application.properties</exclude>
        </excludes>
      </resource>

    </resources>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- Must be defined after quarkus-maven-plugin. -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-crd</id>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <outputDirectory>${projectRoot}/operator/controller/src/main/deploy/crd</outputDirectory>
              <resources>
                <resource>
                  <directory>${projectRoot}/operator/model/target/classes/META-INF/fabric8</directory>
                  <includes>
                    <include>apicurioregistries3.registry.apicur.io-v1.yml</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <goals>
              <goal>test</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assembly</id>
            <goals>
              <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <finalName>${project.artifactId}-${project.version}</finalName>
              <attach>true</attach>
              <descriptors>
                <descriptor>src/main/assembly/assembly.xml</descriptor>
              </descriptors>
              <archiverConfig>
                <defaultDirectoryMode>0755</defaultDirectoryMode>
              </archiverConfig>
              <tarLongFileMode>${tar.long.file.mode}</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

</project>
