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

    Copyright (c) 2021-2022 - Yupiik SAS - https://www.yupiik.com
    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">
  <parent>
    <artifactId>bundlebee</artifactId>
    <groupId>io.yupiik</groupId>
    <version>1.0.15</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>bundlebee-core</artifactId>
  <name>BundleBee :: Core</name>

  <dependencies>
    <dependency> <!-- todo: replace it by something lighter without the mapping feature? -->
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.29</version>
    </dependency>

    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jcdi_2.0_spec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-annotation_1.3_spec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-atinject_1.0_spec</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-interceptor_1.2_spec</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.microprofile.config</groupId>
      <artifactId>microprofile-config-api</artifactId>
      <version>1.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-json_1.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jsonb_1.0_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-se</artifactId>
      <version>${owb.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.config</groupId>
      <artifactId>geronimo-config-impl</artifactId>
      <version>1.2.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.johnzon</groupId>
      <artifactId>johnzon-jsonb</artifactId>
    </dependency>
    <dependency>
      <groupId>io.yupiik.logging</groupId>
      <artifactId>yupiik-logging-jul</artifactId>
      <version>1.0.4</version>
    </dependency>

    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-junit5</artifactId>
      <version>${owb.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-http-junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency> <!-- for talend mock http server -->
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>templating-maven-plugin</artifactId>
        <version>1.0.0</version>
        <executions>
          <execution>
            <id>filter-src</id>
            <goals>
              <goal>filter-sources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>fat</shadedClassifierName>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <dependencyReducedPomLocation>${project.build.directory}/reduced-pom.xml</dependencyReducedPomLocation>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>io.yupiik.bundlebee.core.BundleBee</mainClass>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                  <resource>META-INF/beans.xml</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.properties.OpenWebBeansPropertiesTransformer" />
              </transformers>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/LICENSE.txt</exclude>
                    <exclude>META-INF/LICENSE</exclude>
                    <exclude>META-INF/NOTICE.txt</exclude>
                    <exclude>META-INF/NOTICE</exclude>
                    <exclude>META-INF/MANIFEST.MF</exclude>
                    <exclude>META-INF/DEPENDENCIES</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>native</id>
      <build>
        <plugins>
          <plugin> <!-- mvn package -Pnative -DskipTests  -->
            <groupId>org.apache.geronimo.arthur</groupId>
            <artifactId>arthur-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>native</id>
                <phase>package</phase>
                <goals>
                  <goal>native-image</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <main>io.yupiik.bundlebee.core.BundleBee</main>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
