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

    Copyright 2022-2023 benelog GmbH & Co. KG

        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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.openepcis</groupId>
        <artifactId>openepcis-event-hash-generator-build</artifactId>
        <version>0.9.2</version>
    </parent>

    <artifactId>openepcis-event-hash-generator-cli</artifactId>
    <name>openepcis-event-hash-generator-cli</name>
    <description>Command line interface to generate Hash-Ids based on XML/JSON EPCIS document provided.</description>
    <url>https://github.com/openepcis/openepcis-event-hash-generator-utility</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Sven Boeckelmann</name>
            <email>sven.boeckelmann@benelog.com</email>
            <organization>benelog GmbH &amp; Co. KG</organization>
            <organizationUrl>https://www.benelog.com</organizationUrl>
        </developer>
        <developer>
            <name>Aravinda Baliga B</name>
            <email>aravinda.baliga@benelog.com</email>
            <organization>benelog GmbH &amp; Co. KG</organization>
            <organizationUrl>https://www.benelog.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/openepcis/openepcis-event-hash-generator-cli.git</connection>
        <developerConnection>scm:git:ssh://github.com:openepcis/openepcis-event-hash-generator-cli.git
        </developerConnection>
        <url>https://github.com/openepcis/openepcis-event-hash-generator-cli/tree/main</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <native.maven.plugin.version>0.9.13</native.maven.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <manifestEntries>
                                <Main-Class>io.openepcis.epc.eventhash.main.HashGenerator</Main-Class>
                                <Specification-Title>${project.artifactId}</Specification-Title>
                                <Specification-Version>${project.version}</Specification-Version>
                                <Implementation-Title>${project.artifactId}</Implementation-Title>
                                <Implementation-Version>${project.version}</Implementation-Version>
                                <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
                            </manifestEntries>
                        </transformer>
                    </transformers>
                    <finalName>${project.artifactId}-${project.version}-jar-with-dependencies</finalName>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>native</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <version>${native.maven.plugin.version}</version>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>build-native</id>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                            <execution>
                                <id>test-native</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <phase>test</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <imageName>epcis-event-hash</imageName>
                            <mainClass>io.openepcis.epc.eventhash.main.HashGenerator</mainClass>
                            <buildArgs>
                                <arg>--enable-all-security-services</arg>
                                <arg>--enable-http</arg>
                                <arg>--enable-https</arg>
                                <arg>--report-unsupported-elements-at-runtime</arg>
                                <arg>--no-server</arg>
                                <arg>-H:+JNI</arg>
                                <arg>-H:+UseServiceLoaderFeature</arg>
                                <arg>-H:ReflectionConfigurationFiles=${project.basedir}/src/native/resources/reflect.json</arg>
                            </buildArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <!-- OpenEPCIS dependency for Hash-Id generator -->
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-event-hash-generator</artifactId>
        </dependency>

        <!-- To read the File Extension type -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <!-- For making request to remote URL/HashID generator URL with to read file contents or generate hash id -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.graalvm.nativeimage</groupId>
            <artifactId>svm</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <repositories>
        <repository>
            <id>sonatype-staging</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>

</project>