<?xml version='1.0' encoding='UTF-8'?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>

    <groupId>co.topl</groupId>
    <artifactId>daml-bifrost-module</artifactId>
    <packaging>jar</packaging>
    <version>0.1.0</version>
    <name>DAML Bifrost Module</name>
    <description>daml-bifrost-module is a set of DAML Modules for interfacing with the Topl blockchain and the DAML ledger. It includes a reference application. The App is implemented in Java using DAML's Java bindings for interaction with the DAML ledger, and brambl for using bifrost gRPC API. The code, design and documentation of this library is heavily inspired by Hemera, a DAML Library for Ethereum integration.</description>
    <url>https://github.com/Topl/daml-bifrost-module</url>
    <licenses>
        <license>
            <name>MPL2.0</name>
            <url>https://www.mozilla.org/en-US/MPL/2.0/</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>mundacho</id>
            <name>Edmundo Lopez Bobeda</name>
            <email>e.lopez@topl.me</email>
        </developer>
        <developer>
            <id>scasplte2</id>
            <name>James Aman</name>
            <email>j.aman@topl.me</email>
        </developer>
    </developers>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>
    <scm>
        <connection>scm:git:git@github.com:Topl/daml-bifrost-module.git</connection>
        <developerConnection>scm:git:ssh://github.com:Topl/daml-bifrost-module.git</developerConnection>
        <url>https://github.com/Topl/daml-bifrost-module/tree/main</url>
    </scm>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <daml-codegen-java.output>${project.build.directory}/generated-sources/topl</daml-codegen-java.output>
        <ledgerhost>localhost</ledgerhost>
        <ledgerport>6865</ledgerport>
        <party>Alice</party>
        <keyfilename>keyfile.json</keyfilename>
        <keyfilepassword>${env.KEY_PASSWORD}</keyfilepassword>
        <topl.projectid>${env.TOPL_PROJECT_ID}</topl.projectid>
        <topl.apikey>${env.TOPL_API_KEY}</topl.apikey>
        <restport>8080</restport>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.13.6</version>
        </dependency>
        <dependency>
            <groupId>com.daml</groupId>
            <artifactId>bindings-rxjava</artifactId>
            <version>2.3.2</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-lite</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.7.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>co.topl</groupId>
            <artifactId>brambl_2.13</artifactId>
            <version>1.10.2</version>
        </dependency>
        <dependency>
            <groupId>co.topl</groupId>
            <artifactId>common_2.13</artifactId>
            <version>1.10.2</version>
        </dependency>
        <dependency>
            <groupId>org.typelevel</groupId>
            <artifactId>cats-effect_2.13</artifactId>
            <version>3.3.12</version>
        </dependency>
        <dependency>
            <groupId>org.typelevel</groupId>
            <artifactId>munit-cats-effect-3_2.13</artifactId>
            <version>1.0.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalameta</groupId>
            <artifactId>munit_2.13</artifactId>
            <version>0.7.29</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>4.7.1</version>
                    <executions>
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>add-source</goal>
                                <goal>doc-jar</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                              <goal>add-source</goal>
                              <goal>doc-jar</goal>
                            </goals>
                          </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>11</source>
                        <target>11</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.daml</groupId>
                        <artifactId>codegen-java</artifactId>
                        <version>2.3.2</version>
                        <type>jar</type>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${daml-codegen-java.output}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                        <version>5.6.2</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <includes>
                        <include>**/*.*</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>ci-cd</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- Prevent gpg from using pinentry programs. Fixes: gpg:
                                    signing 
                                                    failed:
                                    Inappropriate ioctl for device -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>run-operator</id>
            <activation>
                <property>
                    <name>operator</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <configuration>
                            <mainClass>co.topl.daml.OperatorMain</mainClass>
                            <arguments>
                                <argument>${ledgerhost}</argument>
                                <argument>${ledgerport}</argument>
                                <argument>${topl.projectid}</argument>
                                <argument>${topl.apikey}</argument>
                            </arguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>run-demo-operator</id>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-asset-operator</id>
            <activation>
                <property>
                    <name>assetoperator</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <configuration>
                            <mainClass>co.topl.daml.AssetOperatorMain</mainClass>
                            <arguments>
                                <argument>${ledgerhost}</argument>
                                <argument>${ledgerport}</argument>
                                <argument>${topl.projectid}</argument>
                                <argument>${topl.apikey}</argument>
                                <argument>${keyfilename}</argument>
                                <argument>${keyfilepassword}</argument>
                            </arguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>run-demo-asset-operator</id>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-alice</id>
            <activation>
                <property>
                    <name>alice</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <configuration>
                            <mainClass>co.topl.daml.AliceMain</mainClass>
                            <arguments>
                                <argument>${ledgerhost}</argument>
                                <argument>${ledgerport}</argument>
                                <argument>${keyfilename}</argument>
                                <argument>${keyfilepassword}</argument>
                            </arguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>run-demo-alice</id>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>