<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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>johnzon</artifactId>
    <groupId>org.apache.johnzon</groupId>
    <version>2.0.2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>johnzon-jsonb</artifactId>
  <name>Johnzon :: JSON-B Implementation</name>
  <packaging>bundle</packaging>

  <properties>
    <staging.directory>${project.parent.reporting.outputDirectory}</staging.directory>
  </properties>

  <dependencies>
    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
      <version>2.1.1</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jakarta.enterprise</groupId>
      <artifactId>jakarta.enterprise.cdi-api</artifactId>
      <version>4.0.1</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jakarta.json.bind</groupId>
      <artifactId>jakarta.json.bind-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.johnzon</groupId>
      <artifactId>johnzon-mapper</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-client</artifactId>
      <version>${cxf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>${cxf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-local</artifactId>
      <version>${cxf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.interceptor</groupId>
      <artifactId>jakarta.interceptor-api</artifactId>
      <version>2.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.inject</groupId>
      <artifactId>jakarta.inject-api</artifactId>
      <version>2.0.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-impl</artifactId>
      <version>${owb.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-spi</artifactId>
      <version>${owb.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-se</artifactId>
      <version>${owb.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>jakarta.json.bind</groupId>
      <artifactId>jakarta.json.bind-tck</artifactId>
      <version>3.0.0</version>
      <scope>test</scope>

      <exclusions>
        <exclusion>
          <groupId>org.netbeans.tools</groupId>
          <artifactId>ct-sym</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Automatic-Module-Name>org.apache.johnzon.jsonb</Automatic-Module-Name>
            <Import-Package>
              javax.ws.rs.*;resolution:=optional,
              *
            </Import-Package>
            <Require-Capability>
              osgi.extender;filter:="(osgi.extender=osgi.serviceloader.registrar)"
            </Require-Capability>
            <_contract>
              JavaAnnotation,
              !JavaCDI,
              !JavaJAXRS,
              JavaJSONB,
              JavaJSONP
            </_contract>
            <Provide-Capability>osgi.serviceloader;osgi.serviceloader=jakarta.json.bind.spi.JsonbProvider</Provide-Capability>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>copy</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>

            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>jakarta.json</groupId>
                  <artifactId>jakarta.json-api</artifactId>
                  <version>${jakarta-jsonp-api.version}</version>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}/signaturedirectory</outputDirectory>
                  <destFileName>jakarta.json-api.jar</destFileName>
                </artifactItem>

                <artifactItem>
                  <groupId>jakarta.json.bind</groupId>
                  <artifactId>jakarta.json.bind-api</artifactId>
                  <version>${jakarta-jsonb-api.version}</version>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}/signaturedirectory</outputDirectory>
                  <destFileName>jakarta.json.bind-api.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire.plugin.version}</version>

        <executions>
          <execution>
            <id>tck-test</id>

            <goals>
              <goal>test</goal>
            </goals>

            <configuration>
              <dependenciesToScan>jakarta.json.bind:jakarta.json.bind-tck</dependenciesToScan>

              <excludes>
                <!-- don't run johnzon tests multiple times, handled in default-test already -->
                <exclude>**/org/apache/johnzon/**</exclude>

                <!-- https://github.com/jakartaee/jsonb-api/issues/344 -->
                <exclude>**/SerializersCustomizationCDITest</exclude>

                <!-- https://github.com/jakartaee/jsonb-api/issues/347 -->
                <exclude>**/AnnotationTypeInfoTest</exclude>
              </excludes>

              <systemPropertyVariables>
                <jimage.dir>${project.build.directory}/jimage</jimage.dir>
                <signature.sigTestClasspath>${project.build.directory}/signaturedirectory/jakarta.json.bind-api.jar:${project.build.directory}/jimage/java.base:${project.build.directory}/jimage/java.rmi:${project.build.directory}/jimage/java.sql:${project.build.directory}/jimage/java.naming</signature.sigTestClasspath>

                <!-- don't serialize BigDecimal/BigInteger as strings. Usually enabled by default in johnzon, see https://github.com/jakartaee/jsonb-api/issues/187 -->
                <johnzon.use-bigdecimal-stringadapter>false</johnzon.use-bigdecimal-stringadapter>
                <johnzon.use-biginteger-stringadapter>false</johnzon.use-biginteger-stringadapter>

                <!-- needed to pass JSON-B 3 TCKs on jdk 13+, see https://github.com/jakartaee/jsonb-api/issues/272 -->
                <java.locale.providers>COMPAT</java.locale.providers>
              </systemPropertyVariables>

              <!-- This is required as a few tests in the TCK are depending on the Locale, see https://github.com/jakartaee/jsonb-api/issues/360 -->
              <argLine>-Duser.language=en -Duser.region=US</argLine>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
