<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2014 Alexey Andreev.

    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>

  <groupId>org.teavm</groupId>
  <artifactId>teavm</artifactId>
  <version>0.7.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>TeaVM</name>
  <description>TeaVM aggregate project</description>
  <url>http://teavm.org</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>konsoletyper</id>
      <name>Alexey Andreev</name>
      <email>konsoletyper@gmail.com</email>
      <timezone>+4</timezone>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/konsoletyper/teavm</url>
    <connection>scm:git:git@github.com:konsoletyper/teavm.git</connection>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl>

    <html4j.version>1.5</html4j.version>
    <slf4j.version>1.7.30</slf4j.version>
    <asm.version>9.1</asm.version>

    <java.version>1.8</java.version>
    <java-tests.version>11</java-tests.version>

    <rhino.version>1.7.11</rhino.version>

    <testng.version>7.1.0</testng.version>
    <junit.version>4.13.2</junit.version>

    <commons-cli.version>1.4</commons-cli.version>
    <commons-io.version>2.8.0</commons-io.version>

    <jzlib.version>1.1.3</jzlib.version>
    <joda-time.version>2.7</joda-time.version>
    <hppc.version>0.8.2</hppc.version>

    <jetty.version>9.4.38.v20210224</jetty.version>
    <javax-websocket.version>1.0</javax-websocket.version>
    <jackson.version>2.12.2</jackson.version>
    <gson.version>2.8.6</gson.version>

    <idea.version>2018.2.8</idea.version>

    <maven-plugin-api.version>3.3.3</maven-plugin-api.version>
    <maven-plugin-annotations.version>3.3</maven-plugin-annotations.version>

    <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
    <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
    <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
    <wagon-ftp.version>3.4.3</wagon-ftp.version>
    <checkstyle.version>8.41</checkstyle.version>

    <teavm.test.incremental>false</teavm.test.incremental>
    <teavm.test.threads>1</teavm.test.threads>
    <teavm.test.skip>true</teavm.test.skip>
  </properties>

  <modules>
    <module>metaprogramming/api</module>
    <module>interop/core</module>
    <module>core</module>
    <module>classlib</module>
    <module>jso/core</module>
    <module>jso/apis</module>
    <module>jso/impl</module>
    <module>html4j</module>
    <module>platform</module>
    <module>tools/c-incremental</module>
    <module>tools/core</module>
    <module>tools/maven</module>
    <module>tools/chrome-rdp</module>
    <module>tools/junit</module>
    <module>tools/devserver</module>
    <module>tests</module>
    <module>extras-slf4j</module>
    <module>metaprogramming/impl</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
      </dependency>
      <dependency>
        <groupId>org.netbeans.html</groupId>
        <artifactId>net.java.html.boot</artifactId>
        <version>${html4j.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.netbeans.html</groupId>
        <artifactId>net.java.html.json.tck</artifactId>
        <version>${html4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.netbeans.html</groupId>
        <artifactId>ko4j</artifactId>
        <version>${html4j.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
      </dependency>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm-commons</artifactId>
        <version>${asm.version}</version>
      </dependency>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm-util</artifactId>
        <version>${asm.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>${maven-plugin-api.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>${maven-plugin-annotations.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-core</artifactId>
        <version>${maven-plugin-api.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-artifact</artifactId>
        <version>${maven-plugin-api.version}</version>
      </dependency>
      <dependency>
        <groupId>javax.websocket</groupId>
        <artifactId>javax.websocket-api</artifactId>
        <version>${javax-websocket.version}</version>
      </dependency>
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-server</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <dependency>
        <groupId>org.eclipse.jetty.websocket</groupId>
        <artifactId>javax-websocket-server-impl</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-client</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <dependency>
        <groupId>org.eclipse.jetty.websocket</groupId>
        <artifactId>websocket-client</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.version}</version>
      </dependency>
      <dependency>
        <groupId>org.mozilla</groupId>
        <artifactId>rhino</artifactId>
        <version>${rhino.version}</version>
      </dependency>
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>${commons-cli.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${gson.version}</version>
      </dependency>
      <dependency>
        <groupId>com.jcraft</groupId>
        <artifactId>jzlib</artifactId>
        <version>${jzlib.version}</version>
      </dependency>
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
      </dependency>
      <dependency>
        <groupId>com.carrotsearch</groupId>
        <artifactId>hppc</artifactId>
        <version>${hppc.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>${wagon-ftp.version}</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <executions>
            <execution>
              <id>build-javadoc</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <phase>post-integration-test</phase>
              <configuration>
                <quiet>true</quiet>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <source>${java.version}</source>
            <show>protected</show>
            <failOnError>false</failOnError>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>post-integration-test</phase>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</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>
          <executions>
            <execution>
              <id>validate</id>
              <phase>validate</phase>
              <configuration>
                <encoding>UTF-8</encoding>
                <consoleOutput>true</consoleOutput>
                <failsOnError>true</failsOnError>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
              </configuration>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <propertyExpansion>config_loc=${basedir}/..</propertyExpansion>
            <configLocation>../checkstyle.xml</configLocation>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven-shade-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${exec-maven-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>with-samples</id>
      <activation>
        <property>
          <name>teavm.build.all</name>
          <value>!false</value>
        </property>
      </activation>
      <modules>
        <module>samples</module>
      </modules>
    </profile>

    <profile>
      <id>with-cli</id>
      <modules>
        <module>tools/cli</module>
      </modules>
    </profile>
    
    <profile>
      <id>with-idea</id>
      <modules>
        <module>tools/idea</module>
      </modules>
    </profile>
    
    <profile>
      <id>with-eclipse</id>
      <modules>
        <module>tools/eclipse</module>
      </modules>
    </profile>

    <profile>
      <id>with-classlib-comparison</id>
      <modules>
        <module>tools/classlib-comparison-gen</module>
      </modules>
    </profile>

    <profile>
      <id>sign-artifacts</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>deploy-to-bintray</id>
      <distributionManagement>
        <repository>
          <id>bintray-teavm</id>
          <name>Bintray Preview Repository</name>
          <url>https://api.bintray.com/maven/konsoletyper/teavm/teavm-dev/;publish=1</url>
        </repository>
      </distributionManagement>
    </profile>

    <profile>
      <id>deploy-to-teavm</id>
      <distributionManagement>
        <repository>
          <id>teavm-repo</id>
          <name>Development Preview Repository</name>
          <url>{{TEAVM_DEPLOY_URL}}</url>
        </repository>
      </distributionManagement>
    </profile>
  </profiles>
</project>