<?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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>18</version>
  </parent>

  <groupId>org.apache.flex.flexjs</groupId>
  <artifactId>flexjs-compiler-parent</artifactId>
  <version>0.7.0</version>
  <packaging>pom</packaging>

  <name>Apache Flex - FlexJS: Compiler: Parent</name>
  <description>The Apache Flex FlexJS Project</description>

  <scm>
    <connection>scm:git:https://git-wip-us.apache.org/repos/asf/flex-falcon.git</connection>
    <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/flex-falcon.git</developerConnection>
    <url>https://github.com/apache/flex-falcon</url>
    <tag>flexjs-compiler-parent-0.7.0</tag>
  </scm>

  <properties>
    <java.version>1.6</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputencoding>UTF-8</project.reporting.outputencoding>
    <maven.version>3.3.1</maven.version>

    <flex.version>4.15.0</flex.version>
    <flash.version>20.0</flash.version>
    <air.version>20.0</air.version>

    <compiler-build-tools.version>1.0.0</compiler-build-tools.version>
    <compiler-jburg-types.version>1.0.0</compiler-jburg-types.version>

    <!-- URL of the ASF SonarQube server -->
    <sonar.host.url>https://analysis.apache.org/</sonar.host.url>
    <!-- Tell sonar where the coverage reports are located -->
    <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco-ut.exec</sonar.jacoco.reportPath>
    <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec</sonar.jacoco.itReportPath>
    <!-- Exclude all generated code -->
    <sonar.exclusions>file:**/generated-sources/**</sonar.exclusions>

    <website.path>latest-dev</website.path>
  </properties>

  <!-- Only configure the site distribution as the rest is handled by the apache parent -->
  <distributionManagement>
    <site>
      <id>website</id>
      <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/flex/content/maven/flexjs/${website.path}</url>
    </site>
  </distributionManagement>

  <issueManagement>
    <system>Jira</system>
    <url>https://issues.apache.org/jira/browse/FLEX</url>
  </issueManagement>

  <mailingLists>
    <mailingList>
      <name>Apache Flex User List</name>
      <subscribe>users-subscribe@flex.apache.org</subscribe>
      <unsubscribe>users-unsubscribe@flex.apache.org</unsubscribe>
      <post>users@flex.apache.org</post>
      <archive>http://mail-archives.apache.org/mod_mbox/flex-users/</archive>
    </mailingList>
    <mailingList>
      <name>Apache Flex Developer List</name>
      <subscribe>dev-subscribe@flex.apache.org</subscribe>
      <unsubscribe>dev-unsubscribe@flex.apache.org</unsubscribe>
      <post>dev@flex.apache.org</post>
      <archive>http://mail-archives.apache.org/mod_mbox/flex-dev/</archive>
    </mailingList>
  </mailingLists>

  <modules>
    <module>compiler</module>
    <module>compiler-jx</module>
    <module>compiler-test-utils</module>
    <module>debugger</module>
    <module>flex-compiler-oem</module>
    <module>flexjs-ant-tasks</module>
    <!-- Commented out for now -->
    <!--module>flexjs-maven-extension</module-->
    <module>flexjs-maven-plugin</module>
  </modules>

  <!--
      As the compiler needs artifacts that are part of this project, the build
      will fail, if the utility artifacts compiler-build-tools or compiler-jburg-types
      haven't been built. We therefore have a utils profile, that builds these
      prerequisites. After one build with "-P utils" has been built, the default
      build should be able to do it's job.
  -->
  <profiles>
    <profile>
      <id>apache-release</id>
      <properties>
        <website.path>${project.version}</website.path>
      </properties>
    </profile>
  </profiles>

  <build>
    <plugins>
      <!-- Check if all source files have the required apache license headers -->
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.12</version>
        <executions>
          <execution>
            <id>license-check</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <excludes>
            <exclude>LICENSE*</exclude>
            <exclude>NOTICE*</exclude>
            <exclude>README*</exclude>
            <exclude>RELEASE_NOTES*</exclude>
            <!-- Modules which are excluded from the build -->
            <exclude>compiler-build-tools/**</exclude>
            <exclude>compiler-jburg-types/**</exclude>
            <exclude>flexjs-maven-extension/**</exclude>
            <exclude>externs/**</exclude>
            <!-- Stuff an Ant build might have left behind. -->
            <exclude>lib/**</exclude>
          </excludes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-core</artifactId>
            <version>1.6</version>
            <exclusions>
              <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.6.201602180812</version>
        <executions>
          <!--
              Prepares the property pointing to the JaCoCo runtime agent which
              is passed as VM argument when Maven the Surefire plugin is executed.
          -->
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
              <!--
                  Sets the name of the property containing the settings
                  for JaCoCo runtime agent.
              -->
              <propertyName>surefireArgLine</propertyName>
            </configuration>
          </execution>
          <!--
              Ensures that the code coverage report for unit tests is created after
              unit tests have been run.
          -->
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
              <!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
            </configuration>
          </execution>
          <!--
              Prepares the property pointing to the JaCoCo runtime agent which
              is passed as VM argument when Maven the Failsafe plugin is executed.
          -->
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
              <!--
                  Sets the name of the property containing the settings
                  for JaCoCo runtime agent.
              -->
              <propertyName>failsafeArgLine</propertyName>
            </configuration>
          </execution>
          <!--
              Ensures that the code coverage report for integration tests after
              integration tests have been run.
          -->
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data. -->
              <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
              <!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Make the surefire execute all unit-tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19</version>
        <configuration>
          <argLine>${surefireArgLine}</argLine>
          <systemPropertyVariables>
            <buildType>Maven</buildType>
            <flexVersion>${flex.version}</flexVersion>
            <flashVersion>${flash.version}</flashVersion>
            <airVersion>${air.version}</airVersion>
            <mavenLocalRepoDir>${settings.localRepository}</mavenLocalRepoDir>
          </systemPropertyVariables>
          <!--
              Currently some tests need this to be disabled,
              but actually this is a bug. For now I'll disable
              them to avoid problems during the maven migration.
              After this is finished, we should defnitely fix
              the tests so assertions can be enabled.
          -->
          <enableAssertions>false</enableAssertions>
        </configuration>
      </plugin>

      <!-- Make the failsafe execute all integration-tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.18.1</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <argLine>${failsafeArgLine}</argLine>
          <systemPropertyVariables>
            <buildType>Maven</buildType>
            <flexVersion>${flex.version}</flexVersion>
            <flashVersion>${flash.version}</flashVersion>
            <airVersion>${air.version}</airVersion>
            <mavenLocalRepoDir>${settings.localRepository}</mavenLocalRepoDir>
            <FLASHPLAYER_DEBUGGER>${env.FLASHPLAYER_DEBUGGER}</FLASHPLAYER_DEBUGGER>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <!-- Plugin to detect problems with JDK incompatibilities -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>1.15</version>
        <executions>
          <execution>
            <id>check-jdk-1.6</id>
            <phase>test</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java16</artifactId>
            <version>1.1</version>
          </signature>
        </configuration>
      </plugin>

      <!-- Configure the Site generation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.4</version>
        <configuration>
          <generateReports>true</generateReports>
          <generateSitemap>true</generateSitemap>
          <relativizeDecorationLinks>false</relativizeDecorationLinks>
          <locales>en</locales>
          <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
          <outputEncoding>${project.reporting.outputencoding}</outputEncoding>
          <!-- Configure the asciidoctor configuration -->
          <asciidoc>
            <sourceDirectory>src/site/asciidoc</sourceDirectory>
            <requires>
              <require>asciidoctor-diagram</require>
            </requires>
            <backend>html5</backend>
            <attributes>
              <toc>left</toc>
              <toclevels>2</toclevels>
              <icons>font</icons>
              <imagesdir>images</imagesdir>
              <imagesoutdir>${project.build.directory}/site/images</imagesoutdir>
              <sectanchors>true</sectanchors>
              <idprefix />
              <idseparator>-</idseparator>
              <source-highlighter>coderay</source-highlighter>
              <coderay-css>style</coderay-css>
            </attributes>
          </asciidoc>
        </configuration>
        <dependencies>
          <!-- All dependencies needed by asciidoctor -->
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <version>1.5.3</version>
          </dependency>
          <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <version>1.7.21</version>
          </dependency>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj</artifactId>
            <version>1.5.4</version>
          </dependency>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-diagram</artifactId>
            <version>1.3.1</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.4</version>
      </plugin>

      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.0.2</version>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.4</version>
          <configuration>
            <tags>
              <tag>
                <name>goal</name>
                <placement>a</placement>
                <head>Goal:</head>
              </tag>
              <tag>
                <name>phase</name>
                <placement>a</placement>
                <head>Phase:</head>
              </tag>
              <tag>
                <name>threadSafe</name>
                <placement>a</placement>
                <head>Thread Safe:</head>
              </tag>
              <tag>
                <name>requiresDependencyResolution</name>
                <placement>a</placement>
                <head>Requires Dependency Resolution:</head>
              </tag>
              <tag>
                <name>requiresProject</name>
                <placement>a</placement>
                <head>Requires Project:</head>
              </tag>
            </tags>
            <!-- TODO: This should only be a measure of last resort -->
            <failOnError>false</failOnError>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <reporting>
    <plugins>

      <!-- Generates a changelog report from GIT commits -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changelog-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <!-- Automatically link Jira issues -->
          <issueLinkUrl>https://issues.apache.org/jira/browse/%ISSUE%</issueLinkUrl>
        </configuration>
      </plugin>

      <!-- Generates a report with the details of the unit- and integrationtests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.19.1</version>
      </plugin>

      <!-- Generates a report with the test coverages -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.6.201602180812</version>
      </plugin>

      <!-- Generates a report with the SonarQube analysis reports -->
      <plugin>
        <groupId>org.codehaus.sonar-plugins</groupId>
        <artifactId>maven-report</artifactId>
        <version>0.1</version>
      </plugin>

      <!-- Generate the JavaDoc API documentation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.4</version>
      </plugin>
    </plugins>
  </reporting>

  <repositories>
    <repository>
      <id>apache-release</id>
      <url>https://repository.apache.org/content/repositories/releases</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>apache-snapshots</id>
      <url>https://repository.apache.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>apache-plugins-release</id>
      <url>https://repository.apache.org/content/repositories/releases</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
    <pluginRepository>
      <id>apache-plugins-snapshots</id>
      <url>https://repository.apache.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

</project>