<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2021 Goldman Sachs

 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 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.finos.legend.engine</groupId>
    <artifactId>legend-engine-xts-authentication</artifactId>
    <version>4.150.0</version>
  </parent>
  <artifactId>legend-engine-xt-authentication-pure</artifactId>
  <version>4.150.0</version>
  <name>Legend Engine - XT - Authentication - Pure</name>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <dependencies>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-m4</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-m3-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-runtime-java-engine-compiled</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.engine</groupId>
      <artifactId>legend-engine-pure-code-compiled-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.engine</groupId>
      <artifactId>legend-engine-pure-platform-java</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-m2-dsl-diagram-grammar</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-m2-dsl-graph-grammar</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.finos.legend.pure</groupId>
      <artifactId>legend-pure-m3-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>dependency-analyze</id>
            <configuration>
              <ignoredUnusedDeclaredDependencies>
                <dependency>org.finos.legend.pure:legend-pure-m2-dsl-diagram-grammar</dependency>
                <dependency>org.finos.legend.pure:legend-pure-m2-dsl-graph-grammar</dependency>
              </ignoredUnusedDeclaredDependencies>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.finos.legend.pure</groupId>
        <artifactId>legend-pure-maven-compiler</artifactId>
      </plugin>
      <plugin>
        <groupId>org.finos.legend.pure</groupId>
        <artifactId>legend-pure-maven-generation-par</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>build-pure-jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <sourceDirectory>src/main/resources</sourceDirectory>
          <purePlatformVersion>${legend.pure.version}</purePlatformVersion>
          <repositories>
            <repository>platform</repository>
            <repository>core</repository>
            <repository>core_authentication</repository>
          </repositories>
          <extraRepositories>
            <extraRepository>${project.basedir}/src/main/resources/core_authentication.definition.json</extraRepository>
          </extraRepositories>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.finos.legend.pure</groupId>
        <artifactId>legend-pure-maven-generation-java</artifactId>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>build-pure-compiled-jar</goal>
            </goals>
            <configuration>
              <generateSources>true</generateSources>
              <preventJavaCompilation>true</preventJavaCompilation>
              <generationType>modular</generationType>
              <useSingleDir>true</useSingleDir>
              <repositories>
                <repository>core_authentication</repository>
              </repositories>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>generate-protocol-version</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>create-protocol-file</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target name="protocol">
                    <copy todir="${basedir}/src/main/resources/${folderPath}/${protocol.TargetVersion}">
                      <fileset dir="${basedir}/src/main/resources/${folderPath}/${protocol.SourceVersion}" />
                    </copy>
                    <replace dir="${basedir}/src/main/resources/${folderPath}/${protocol.TargetVersion}" value="${protocol.TargetVersion}" token="${protocol.SourceVersion}" />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <folderPath>core_authentication/pure</folderPath>
      </properties>
    </profile>
  </profiles>
</project>
