<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015 Red Hat, Inc.

    Licensed 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>io.fabric8</groupId>
    <artifactId>kubernetes-client-project</artifactId>
    <version>5.11.2</version>
  </parent>

  <artifactId>kubernetes-model-generator</artifactId>
  <packaging>pom</packaging>
  <name>Fabric8 :: Kubernetes Model Parent</name>

  <modules>
    <module>kubernetes-model</module>
    <module>kubernetes-model-common</module>
    <module>kubernetes-model-jsonschema2pojo</module>
    <module>kubernetes-model-core</module>
    <module>kubernetes-model-rbac</module>
    <module>kubernetes-model-admissionregistration</module>
    <module>kubernetes-model-apiextensions</module>
    <module>kubernetes-model-apps</module>
    <module>kubernetes-model-autoscaling</module>
    <module>kubernetes-model-batch</module>
    <module>kubernetes-model-certificates</module>
    <module>kubernetes-model-coordination</module>
    <module>kubernetes-model-discovery</module>
    <module>kubernetes-model-events</module>
    <module>kubernetes-model-extensions</module>
    <module>kubernetes-model-flowcontrol</module>
    <module>kubernetes-model-networking</module>
    <module>kubernetes-model-node</module>
    <module>kubernetes-model-metrics</module>
    <module>kubernetes-model-policy</module>
    <module>kubernetes-model-scheduling</module>
    <module>kubernetes-model-storageclass</module>
    <module>openshift-model</module>
    <module>openshift-model-clusterautoscaling</module>
    <module>openshift-model-operator</module>
    <module>openshift-model-operatorhub</module>
    <module>openshift-model-machine</module>
    <module>openshift-model-monitoring</module>
    <module>openshift-model-console</module>
    <module>openshift-model-machineconfig</module>
    <module>openshift-model-tuned</module>
    <module>openshift-model-whereabouts</module>
    <module>openshift-model-storageversionmigrator</module>
    <module>openshift-model-miscellaneous</module>
  </modules>

  <properties>
    <!-- should we include the integration test in this build? -->
    <itest>true</itest>

    <skipTests>false</skipTests>
    <testExclusionPattern>**/*KubernetesTest.java</testExclusionPattern>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>

    <!-- CompileOnly (provided) dependencies -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
      <groupId>io.sundr</groupId>
      <artifactId>builder-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>io.sundr</groupId>
      <artifactId>transform-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>io.sundr</groupId>
      <artifactId>sundr-codegen-velocity-nodeps</artifactId>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-migrationsupport</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.javacrumbs.json-unit</groupId>
      <artifactId>json-unit-fluent</artifactId>
      <version>2.7.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.10</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.jsonschema2pojo</groupId>
          <artifactId>jsonschema2pojo-maven-plugin</artifactId>
          <version>${jsonschema2pojo.version}</version>
          <configuration>
            <customAnnotator>io.fabric8.kubernetes.jsonschema2pojo.KubernetesTypeAnnotator</customAnnotator>
            <customRuleFactory>io.fabric8.kubernetes.jsonschema2pojo.Fabric8RuleFactory</customRuleFactory>
            <sourcePaths>
              <sourcePath>${project.basedir}/src/main/resources/schema/kube-schema.json</sourcePath>
            </sourcePaths>
            <targetPackage>io.fabric8.kubernetes.api.model</targetPackage>
            <includeConstructors>true</includeConstructors>
            <includeJsr303Annotations>false</includeJsr303Annotations>
            <includeToString>false</includeToString>
            <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
            <removeOldOutput>true</removeOldOutput>
            <outputDirectory>${generate.targetDirectory}</outputDirectory>
            <annotationStyle>none</annotationStyle>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>generate</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>io.fabric8</groupId>
              <artifactId>kubernetes-model-jsonschema2pojo</artifactId>
              <version>${project.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${maven.buildhelper.plugin.version}</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>${generate.targetDirectory}</source>
                </sources>
              </configuration>
            </execution>
            <execution>
              <id>attach-artifacts</id>
              <phase>package</phase>
              <goals>
                <goal>attach-artifact</goal>
              </goals>
              <configuration>
                <skipAttach>true</skipAttach>
                <artifacts>
                  <artifact>
                    <file>${project.build.outputDirectory}/schema/kube-schema.json</file>
                    <type>json</type>
                    <classifier>schema</classifier>
                  </artifact>
                </artifacts>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <index>true</index>
            <manifest>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-URL>${project.url}</Implementation-URL>
              <Java-Version>${java.version}</Java-Version>
              <Scm-Url>${project.scm.url}</Scm-Url>
              <Scm-Connection>${project.scm.connection}</Scm-Connection>
              <Scm-Revision>${buildNumber}</Scm-Revision>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <!-- Set properties containing the scm revision and build timestamp -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>${buildnumber.plugin.version}</version>
        <executions>
          <execution>
            <id>get-scm-revision</id>
            <phase>initialize</phase>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <doCheck>false</doCheck>
              <doUpdate>false</doUpdate>
              <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
              <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <nonFilteredFileExtensions>
            <nonFilteredFileExtension>zip</nonFilteredFileExtension>
            <nonFilteredFileExtension>gz</nonFilteredFileExtension>
            <nonFilteredFileExtension>jar</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <skipTests>${skipTests}</skipTests>
          <excludes>
            <exclude>${testExclusionPattern}</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>java9-plus</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.jsonschema2pojo</groupId>
              <artifactId>jsonschema2pojo-maven-plugin</artifactId>
              <dependencies>
                <dependency>
                  <groupId>javax.annotation</groupId>
                  <artifactId>javax.annotation-api</artifactId>
                  <version>1.3.2</version>
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>site</id>
      <modules>
        <module>website</module>
      </modules>
    </profile>
    <profile>
      <id>distro</id>
      <modules>
      </modules>
    </profile>
    <profile>
      <id>itest</id>
      <activation>
        <property>
          <name>itest</name>
          <value>true</value>
        </property>
      </activation>
      <modules>
        <module>model-generator-app</module>
      </modules>
    </profile>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
  </profiles>
</project>
