<?xml version="1.0" encoding="UTF-8"?>
<!--
* SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
* SPDX-License-Identifier: MIT
-->
<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>org.eolang</groupId>
    <artifactId>eo-parent</artifactId>
    <version>0.62.1</version>
  </parent>
  <artifactId>eo-runtime</artifactId>
  <packaging>jar</packaging>
  <name>eo-runtime</name>
  <description>EO runtime library</description>
  <properties>
    <!-- This is required for later correct replacement of argline -->
    <argLine/>
    <!--
    Enables atom return-type checking in AtomTyped (default off, see #5280).
    Off because atoms with error-branches return a union the declared forma
    cannot express; set to true to verify return types.
    -->
    <eo.typing>false</eo.typing>
  </properties>
  <dependencies>
    <dependency>
      <!--
      This dependency is required by the javadoc plugin. In the eo-runtime,
      we use classes from this JAR, but can't have it as a normal dependency.
      That's why the scope is "provided" here: it won't become a transitive
      one, but at the same time will satisfy javadoc plugin.
      -->
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>5.19.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <version>2.0.18</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.18</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.6.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eolang</groupId>
      <artifactId>xax</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>jaxec</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>jhome</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jcabi</groupId>
      <artifactId>jcabi-log</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jcabi</groupId>
      <artifactId>jcabi-xml</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jcabi</groupId>
      <artifactId>jcabi-manifests</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.cactoos</groupId>
      <artifactId>cactoos</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.llorllale</groupId>
      <artifactId>cactoos-matchers</artifactId>
      <version>0.25</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit-pioneer</groupId>
      <artifactId>junit-pioneer</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>jping</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.sf.saxon</groupId>
      <artifactId>Saxon-HE</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>farea</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>mktmp</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>together</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.yegor256</groupId>
      <artifactId>maybeslow</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eolang</groupId>
      <artifactId>jucs</artifactId>
      <!-- version from parent POM -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.github.artsok</groupId>
      <artifactId>rerunner-jupiter</artifactId>
      <version>2.1.6</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>${skipUTs}</skipTests>
          <runOrder>random</runOrder>
          <argLine>
            @{argLine} -Xmx${heap-size} -Xss${stack-size} -Duser.language=ru -Duser.region=RU
          </argLine>
          <systemPropertyVariables>
            <eo.version>${project.version}</eo.version>
            <eo.typing>${eo.typing}</eo.typing>
            <!--
            Where PhCoverage.hit() appends coverage records at runtime. It
            pairs with coverageTracking on eo-maven-plugin below, which wraps
            located objects into PhCoverage at transpile time, so both ends
            agree on one file (see #5673).
            -->
            <eo.coverageFile>${project.build.directory}/coverage.txt</eo.coverageFile>
            <java.util.logging.config.file>
              ${project.basedir}/src/test/resources/jul.properties
            </java.util.logging.config.file>
          </systemPropertyVariables>
          <!--
          Default surefire plugin corrupts native stdout. It means the text that was
          printed in native method will not be printed in 'mvn clean install'. This configuration
          switches surefire communication channel from default to TCP/IP and solves the bug.
          More detailed: https://stackoverflow.com/questions/55272870/surefire-maven-plugin-corrupted-stdout-by-directly-writing-to-native-stream-in
          and https://maven.apache.org/surefire/maven-surefire-plugin/examples/process-communication.html
          -->
          <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
          <properties>
            <configurationParameters>
              junit.jupiter.execution.parallel.enabled = true
              junit.jupiter.execution.parallel.mode.default = concurrent
              junit.jupiter.execution.parallel.mode.classes.default = concurrent
            </configurationParameters>
          </properties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eolang</groupId>
        <artifactId>eo-maven-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <foreign>${project.build.directory}/eo-foreign.csv</foreign>
          <foreignFormat>csv</foreignFormat>
          <!-- Every lint warning is an error here; nothing may be tolerated. -->
          <failOnWarning>true</failOnWarning>
          <offline>true</offline>
          <ignoreRuntime>true</ignoreRuntime>
          <!--
          Cache is disabled because it is keyed on the plugin version
          (1.0-SNAPSHOT during development), so any plugin or configuration
          change would be silently ignored until the cache is cleared manually.
          -->
          <cacheEnabled>false</cacheEnabled>
          <!-- Tests assert on precise .eo locations in panics (off by default). -->
          <trackLocations>true</trackLocations>
          <!-- Wrap located objects into PhCoverage so tests record EO coverage. -->
          <coverageTracking>false</coverageTracking>
        </configuration>
        <executions>
          <execution>
            <id>compile</id>
            <goals>
              <goal>register</goal>
              <goal>format</goal>
              <goal>compile</goal>
              <goal>transpile</goal>
              <goal>atoms-table</goal>
              <goal>unplace</goal>
              <goal>unspile</goal>
            </goals>
            <configuration>
              <!--
              Objects with an optional fallback argument, like 'string.as-fixed'
              or 'win32', are applied with and without it on purpose, and the
              lint reads every such pair as an inconsistency.
              -->
              <skipProgramLints>
                <lint>inconsistent-args</lint>
              </skipProgramLints>
              <keepBinaries>
                <glob>org/eolang/EO_number/package-info.class</glob>
                <glob>org/eolang/EO_string/package-info.class</glob>
                <glob>org/eolang/package-info.class</glob>
              </keepBinaries>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <!--
          Transpiled atoms carry their XMIR in the docblock, where Javadoc
          reads the <o> elements as unknown HTML; only the handwritten
          sources are documented
          -->
          <sourcepath>${project.basedir}/src/main/java</sourcepath>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <executions>
          <execution>
            <id>snippet-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <argLine>
                @{argLine} -Xmx${heap-size} -Xss${stack-size} -Duser.language=ru -Duser.region=RU
              </argLine>
              <systemPropertyVariables combine.children="append">
                <java.class.path>${project.build.outputDirectory}</java.class.path>
                <xmir.xsd>${project.basedir}/../eo-parser/src/main/resources/XMIR.xsd</xmir.xsd>
              </systemPropertyVariables>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>jacoco</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>jacoco-initialize</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>jacoco-check</id>
                <phase>test</phase>
                <goals>
                  <goal>check</goal>
                  <goal>report</goal>
                </goals>
                <configuration>
                  <rules>
                    <rule>
                      <element>BUNDLE</element>
                      <limits>
                        <limit>
                          <counter>INSTRUCTION</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.14</minimum>
                        </limit>
                        <limit>
                          <counter>LINE</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.13</minimum>
                        </limit>
                        <limit>
                          <counter>BRANCH</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.03</minimum>
                        </limit>
                        <limit>
                          <counter>COMPLEXITY</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.08</minimum>
                        </limit>
                        <limit>
                          <counter>METHOD</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.12</minimum>
                        </limit>
                        <limit>
                          <counter>CLASS</counter>
                          <value>MISSEDCOUNT</value>
                          <maximum>1514</maximum>
                        </limit>
                      </limits>
                    </rule>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>qulice</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eolang</groupId>
            <artifactId>eo-maven-plugin</artifactId>
            <configuration>
              <skipLinting>false</skipLinting>
            </configuration>
          </plugin>
          <plugin>
            <groupId>com.qulice</groupId>
            <artifactId>qulice-maven-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>dependencies:org.eolang:eo-maven-plugin</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>groovy-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>project-validate</id>
                <phase>verify</phase>
                <goals>
                  <goal>execute</goal>
                </goals>
                <configuration>
                  <source>${project.basedir}/src/test/groovy/verify.groovy</source>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.apache.groovy</groupId>
                <artifactId>groovy-xml</artifactId>
                <version>5.0.7</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>hone</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eolang</groupId>
            <artifactId>hone-maven-plugin</artifactId>
            <version>0.29.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>pull</goal>
                  <goal>optimize</goal>
                  <goal>rmi</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
