<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2021, 1C-Soft LLC and others.
   
    This program and the accompanying materials are made
    available under the terms of the Eclipse Public License 2.0
    which is available at https://www.eclipse.org/legal/epl-2.0/
   
    SPDX-License-Identifier: EPL-2.0
   
    Contributors:
        1C-Soft LLC - initial API and implementation
 -->
<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.e1c.v8codestyle</groupId>
  <artifactId>bom</artifactId>
  <version>0.5.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>BOM</name>

  <prerequisites>
    <maven>3.6.0</maven>
  </prerequisites>

  <properties>
    <tycho.version>2.2.0</tycho.version>
    <tycho.extras.version>2.2.0</tycho.extras.version>
    <markdown-page-generator.version>2.3.1</markdown-page-generator.version>
    <!-- Override this property in each project -->
    <markdown.page.generator.html.file.path>${project.basedir}</markdown.page.generator.html.file.path>
    
    <spotbugs.maven.plugin.version>3.1.12.2</spotbugs.maven.plugin.version>
    <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
    <checkstyle.version>8.29</checkstyle.version>
    <checkstyle.header.file>java.header</checkstyle.header.file>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.release>11</maven.compiler.release>

    <maven.build.timestamp.format>'v'yyyyMMdd-HHmm</maven.build.timestamp.format>
    <qualifier>${maven.build.timestamp}</qualifier>

    <eclipse.p2.latest>http://download.eclipse.org/releases/2020-06/</eclipse.p2.latest>

    <p2repo.archive.skip>false</p2repo.archive.skip>
    <org.jacoco.version>0.8.6</org.jacoco.version>
    <!-- SonarQube Settings -->
    <sonar.projectKey>1C-Company_v8-code-style</sonar.projectKey>
    <sonar.organization>1c-company</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
    <!-- JaCoCo code coverage, pass to SonarQube -->
    <sonar.coverage.jacoco.xmlReportPaths>../../**/target/site/jacoco*/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
    
    <sonar.issue.ignore.multicriteria>e1,e2,e3,e4,t1,t2,t3,t4</sonar.issue.ignore.multicriteria>
    <!-- Static non-final field names should comply with a naming convention -->
    <sonar.issue.ignore.multicriteria.e1.ruleKey>java:S3008</sonar.issue.ignore.multicriteria.e1.ruleKey>
    <sonar.issue.ignore.multicriteria.e1.resourceKey>**/Messages.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
    <!-- Instance methods should not write to "static" fields -->
    <sonar.issue.ignore.multicriteria.e2.ruleKey>java:S2696</sonar.issue.ignore.multicriteria.e2.ruleKey>
    <sonar.issue.ignore.multicriteria.e2.resourceKey>**/*Plugin.java</sonar.issue.ignore.multicriteria.e2.resourceKey>
    <!-- Generic exceptions should never be thrown -->
    <sonar.issue.ignore.multicriteria.e3.ruleKey>java:S112</sonar.issue.ignore.multicriteria.e3.ruleKey>
    <sonar.issue.ignore.multicriteria.e3.resourceKey>**/*Plugin.java</sonar.issue.ignore.multicriteria.e3.resourceKey>
    <!-- Non-primitive fields should not be "volatile" -->
    <sonar.issue.ignore.multicriteria.e4.ruleKey>java:S3077</sonar.issue.ignore.multicriteria.e4.ruleKey>
    <sonar.issue.ignore.multicriteria.e4.resourceKey>**/*Plugin.java</sonar.issue.ignore.multicriteria.e4.resourceKey>
    <!-- Generic exceptions should never be thrown -->
    <sonar.issue.ignore.multicriteria.t1.ruleKey>java:S112</sonar.issue.ignore.multicriteria.t1.ruleKey>
    <sonar.issue.ignore.multicriteria.t1.resourceKey>/tests/**/*.java</sonar.issue.ignore.multicriteria.t1.resourceKey>
    <!-- Null pointers should not be dereferenced -->
    <sonar.issue.ignore.multicriteria.t2.ruleKey>java:S2259</sonar.issue.ignore.multicriteria.t2.ruleKey>
    <sonar.issue.ignore.multicriteria.t2.resourceKey>/tests/**/*.java</sonar.issue.ignore.multicriteria.t2.resourceKey>
    <!-- "throws" declarations should not be superfluous -->
    <sonar.issue.ignore.multicriteria.t3.ruleKey>java:S1130</sonar.issue.ignore.multicriteria.t3.ruleKey>
    <sonar.issue.ignore.multicriteria.t3.resourceKey>/tests/**/*.java</sonar.issue.ignore.multicriteria.t3.resourceKey>
    <!-- Reflection should not be used to increase accessibility of classes, methods, or fields -->
    <sonar.issue.ignore.multicriteria.t4.ruleKey>java:S3011</sonar.issue.ignore.multicriteria.t4.ruleKey>
    <sonar.issue.ignore.multicriteria.t4.resourceKey>/tests/**/*.java</sonar.issue.ignore.multicriteria.t4.resourceKey>
    <!-- Source files should not have any duplicated blocks -->
    <sonar.cpd.exclusions>**/*Plugin.java,/tests/**/*</sonar.cpd.exclusions>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>target-platform-configuration</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <resolver>p2</resolver>
            <executionEnvironment>JavaSE-11</executionEnvironment>
            <includePackedArtifacts>false</includePackedArtifacts>
            <target>
              <artifact>
                <groupId>com.e1c.v8codestyle</groupId>
                <artifactId>default</artifactId>
                <version>0.5.0-SNAPSHOT</version>
              </artifact>
            </target>
            <environments>
              <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86_64</arch>
              </environment>
              <environment>
                <os>linux</os>
                <ws>gtk</ws>
                <arch>x86_64</arch>
              </environment>
              <environment>
                <os>macosx</os>
                <ws>cocoa</ws>
                <arch>x86_64</arch>
              </environment>
            </environments>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-maven-plugin</artifactId>
          <version>${tycho.version}</version>
          <extensions>true</extensions>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-compiler-plugin</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <encoding>UTF-8</encoding>
            <strictCompilerTarget>true</strictCompilerTarget>
            <useProjectSettings>true</useProjectSettings>
            <showWarnings>true</showWarnings>
            <showDeprecation>true</showDeprecation>
            <verbose>true</verbose>
            <optimize>true</optimize>
            <compilerArgs>
              <!--arg>-Werror</arg-->
              <arg>-Xlint:all</arg>
              <arg>-Xlint:serial</arg>
              <arg>-Xlint:serial</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-source-plugin</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <archive>
              <addMavenDescriptor>false</addMavenDescriptor>
            </archive>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>plugin-source</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-surefire-plugin</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <skip>${tycho.surefire.skipPluginTest}</skip>
            <systemProperties>
              <file.encoding>UTF-8</file.encoding>
              <sun.jnu.encoding>UTF-8</sun.jnu.encoding>
            </systemProperties>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-packaging-plugin</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <forceContextQualifier>${qualifier}</forceContextQualifier>
            <format>'v'yyyyMMddHHmm</format>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-plugin</artifactId>
          <version>${tycho.version}</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-repository-plugin</artifactId>
          <version>${tycho.version}</version>
          <configuration>
            <repositoryName>Repository</repositoryName>
            <finalName>${project.artifactId}</finalName>
            <skipArchive>{p2repo.archive.skip}</skipArchive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.tycho.extras</groupId>
          <artifactId>tycho-eclipserun-plugin</artifactId>
          <version>${tycho.extras.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven.checkstyle.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <configLocation>checkstyle.xml</configLocation>
            <consoleOutput>true</consoleOutput>
            <failOnViolation>true</failOnViolation>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <logViolationsToConsole>true</logViolationsToConsole>
            <violationSeverity>warning</violationSeverity>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.8</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
            <version>${org.jacoco.version}</version>
            <configuration>
              <excludes>
                <exclude>**/MdClassPackageImpl*</exclude>
              </excludes>
            </configuration>
        </plugin>
        <plugin>
          <groupId>com.ruleoftech</groupId>
          <artifactId>markdown-page-generator-plugin</artifactId>
          <version>${markdown-page-generator.version}</version>
          <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
          </executions>
          <configuration>
            <recursiveInput>true</recursiveInput>
            <copyDirectories>${markdown.page.generator.html.file.path}/html/css,${markdown.page.generator.html.file.path}/html/js,*.files,pict</copyDirectories>
            <headerHtmlFile>${markdown.page.generator.html.file.path}/html/header.html</headerHtmlFile>
            <footerHtmlFile>${markdown.page.generator.html.file.path}/html/footer.html</footerHtmlFile>
            <pegdownExtensions>TABLES,FENCED_CODE_BLOCKS,AUTOLINKS,SMARTS,TASKLISTITEMS,EXTANCHORLINKS,TOC</pegdownExtensions>
            <attributes>
              <attribute>TableBlock|class=table table-striped table-bordered</attribute>
              <attribute>BlockQuote|class=red</attribute>
            </attributes>
            <transformRelativeMarkdownLinks>true</transformRelativeMarkdownLinks>
            <inputEncoding>UTF-8</inputEncoding>
            <outputEncoding>UTF-8</outputEncoding>
            <applyFiltering>true</applyFiltering>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>native2ascii-maven-plugin</artifactId>
          <version>2.0.1</version>
          <executions>
            <execution>
              <id>utf8-to-latin1</id>
              <goals>
                <goal>resources</goal>
              </goals>
              <phase>compile</phase>
            </execution>
          </executions>
          <configuration>
            <srcDir>src</srcDir>
            <targetDir>${project.build.outputDirectory}</targetDir>
            <encoding>${project.build.sourceEncoding}</encoding>
            <excludes>
              <exclude>**/build.properties</exclude>
            </excludes>
           </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/xcore-gen</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>export-properties</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echoproperties prefix="qualifier" destfile="${project.build.directory}/build.properties" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
  	  <id>find-bugs</id>
  	  <build>
  	    <plugins>
  	      <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>${spotbugs.maven.plugin.version}</version>
            <configuration>
              <effort>Max</effort>
              <threshold>Low</threshold>
              <xmlOutput>true</xmlOutput>
              <maxRank>9</maxRank>
              <fork>true</fork>
              <jvmArgs>-Xmx1536m</jvmArgs>
              <maxHeap>1536</maxHeap>
              <findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory>
            </configuration>
            <executions>
              <execution>
                <id>analyze-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
            <dependencies>
              <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
              <dependency>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs</artifactId>
                <version>4.0.0-beta2</version>
              </dependency>
            </dependencies>
          </plugin>
  	    </plugins>
  	  </build>
  	</profile>
  </profiles>
</project>
