<?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.royale.compiler</groupId>
  <artifactId>royale-compiler-parent</artifactId>
  <version>0.9.2</version>
  <packaging>pom</packaging>

  <name>Apache Royale: Compiler: Parent</name>
  <description>The Apache Royale Project</description>

  <scm>
    <connection>scm:git:git@github.com:apache/royale-compiler.git</connection>
    <developerConnection>scm:git:git@github.com:apache/royale-compiler.git</developerConnection>
    <url>scm:git:git@github.com:apache/royale-compiler.git</url>
    <tag>org.apache.royale.compiler-0.9.2-rc2</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>

    <jburgTypesRequired>true</jburgTypesRequired>
    <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://builds.apache.org/analysis</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>apache.website</id>
      <url>scm:git:https://github.com/apache/royale-compiler.git</url>
    </site>
  </distributionManagement>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/apache/royale-compiler/issues</url>
  </issueManagement>

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

  <!--
      As the compiler build uses the jburg plugin which has a dependency on
      the compiler-jburg-types artifact that are part of this project. We therefore have
      a utils profile, that builds these these artifacts so Maven doesn't fail
      as it resolves plugin dependencies before starting the build.
      After one build with "-P -main,utils" (don't use main profile, use utils profile
      has been built, the default build should be able to do it's job.
  -->
  <profiles>
    <profile>
      <id>utils</id>
      <activation>
          <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
          <jburgTypesRequired>false</jburgTypesRequired>
      </properties>
      <modules>
        <module>compiler-build-tools</module>
        <module>compiler-jburg-types</module>
      </modules>
    </profile>
    <profile>
        <id>main</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <modules>
            <module>compiler-common</module>
            <module>compiler-externc</module>
            <module>compiler</module>
            <module>compiler-jx</module>
            <module>compiler-test-utils</module>
            <module>swfutils</module>
            <module>debugger</module>
            <module>flex-compiler-oem</module>
            <module>royale-ant-tasks</module>
            <!--<module>royale-maven-extension</module>-->
            <module>royale-maven-plugin</module>
        </modules>
        <build>
          <plugins>
            <plugin>
              <groupId>net.sourceforge.jburg</groupId>
              <artifactId>jburg-maven-plugin</artifactId>
              <version>1.10.4</version>
              <dependencies>
                <dependency>
                  <groupId>org.apache.royale.compiler</groupId>
                  <artifactId>compiler-jburg-types</artifactId>
                  <version>${compiler-jburg-types.version}</version>
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </build>
    </profile>
    <profile>
      <id>apache-release</id>
      <activation>
          <activeByDefault>false</activeByDefault>
      </activation>
      <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 -->
            <!-- FlashBuilder settings. frameworks/fb.properties contains Alex' path entries and should be removed -->
            <exclude>fb.properties</exclude>
            <!-- FlashBuilder / Eclipse settings. If checked in, they should have apache headers -->
            <exclude>**/.settings/**</exclude>
            <exclude>**/*.classpath</exclude>
            <exclude>**/*.project</exclude>
            <!-- Ignore IntelliJ IDEA project files -->
            <exclude>**/*.iml</exclude>
            <exclude>**/.idea/**</exclude>
            <!--
                Exclude any eventually existing content of target directories.
                Some times when building with a bigger maven reactor and then
                with a smaller one, RAT will complain about stuff still in the
                target directories. We don't want that.
            -->
            <exclude>**/target/**</exclude>
            <!-- Stuff an Ant build might have left behind. -->
            <exclude>lib/**</exclude>
            <!--
                In case of an ANT based release the typedefs are included as a
                subdirectory. We need to exclude this directory from the compiler checks
                as the typedefs build will handle all content in that directory
            -->
            <exclude>royale-typedefs/**</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-dependency-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>analyze</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <configuration>
              <failOnWarning>false</failOnWarning>
            </configuration>
          </execution>
        </executions>
      </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.9</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>
        <!-- Downgraded to 3.4 as 3.5 and 3.5.1 seem to have issues with the velocity tools -->
        <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>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-core</artifactId>
            <version>1.6</version>
          </dependency>
          <!-- All dependencies needed by the reflow skin -->
          <dependency>
            <groupId>lt.velykis.maven.skins</groupId>
            <artifactId>reflow-velocity-tools</artifactId>
            <version>1.1.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
          </dependency>
          <!-- add support for scm/git site deployment -->
          <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-scm</artifactId>
            <version>2.10</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-api</artifactId>
            <version>1.9.5</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-manager-plexus</artifactId>
            <version>1.9.5</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.9.5</version>
          </dependency>
        </dependencies>
      </plugin>

      <!--
        Make the maven-site-plugin stage the output in the "asf-site" branch
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-publish-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>scm-publish</id>
            <phase>site-deploy</phase>
            <!-- deploy site with maven-scm-publish-plugin -->
            <goals>
              <goal>publish-scm</goal>
            </goals>
            <configuration>
              <!-- mono-module doesn't require site:stage -->
              <content>${project.build.directory}/site</content>
              <!-- branch where to deploy -->
              <scmBranch>asf-site</scmBranch>
            </configuration>
          </execution>
        </executions>
      </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.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.9</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>
