<?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.royale.compiler</groupId>
    <artifactId>royale-compiler-parent</artifactId>
    <version>0.9.12</version>
  </parent>

  <artifactId>compiler</artifactId>
  <version>0.9.12</version>

  <name>Apache Royale: Compiler: Compiler</name>
  <description>The Apache Royale Compiler</description>

  <build>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <executions>
            <execution>
              <id>default-jar</id>
              <configuration>
                <archive>
                  <manifestEntries>
                    <!-- These paths are all defined the way the layout will be in the distribution -->
                    <Class-Path>compiler-common.jar external/antlr.jar external/antlr-runtime.jar external/commons-cli.jar external/commons-io.jar external/guava.jar external/failureaccess.jar external/lzma-sdk-4j.jar external/flex-tool-api.jar ..</Class-Path>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
            <execution>
              <id>scripts-jar</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
              <configuration>
                <classesDirectory>src/assembly/scripts</classesDirectory>
                <classifier>scripts</classifier>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <executions>
            <execution>
              <id>copy-externc-resources</id>
              <phase>process-test-resources</phase>
              <goals>
                <goal>copy-resources</goal>
              </goals>
            <configuration>
            <outputDirectory>${basedir}/../compiler-externc/target</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/../compiler-externc/src/test/config</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-custom-resources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/src/test/config</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!--
              Do all the JFlex code generation
      -->
      <plugin>
        <groupId>de.jflex</groupId>
        <artifactId>maven-jflex-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-raw-as-tokenizer</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <outputDirectory>target/generated-sources/jflex</outputDirectory>
              <lexDefinitions>
                <lexDefinition>src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.lex</lexDefinition>
              </lexDefinitions>
              <skeleton>src/main/jflex/org/apache/royale/compiler/internal/parsing/as/skeleton.royale</skeleton>
            </configuration>
          </execution>
          <execution>
            <id>generate-raw-as-doc-tokenizer</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <outputDirectory>target/generated-sources/jflex</outputDirectory>
              <lexDefinitions>
                <lexDefinition>src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASDocTokenizer.lex</lexDefinition>
              </lexDefinitions>
              <skeleton>src/main/jflex/org/apache/royale/compiler/internal/parsing/as/skeleton.default</skeleton>
            </configuration>
          </execution>
          <execution>
            <id>generate-raw-mxml-tokenizer</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <outputDirectory>target/generated-sources/jflex</outputDirectory>
              <lexDefinitions>
                <lexDefinition>src/main/jflex/org/apache/royale/compiler/internal/parsing/mxml/RawMXMLTokenizer.lex</lexDefinition>
              </lexDefinitions>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!--
            Do all the Antlr2 code generation
      -->
      <plugin>
        <groupId>org.omnifaces</groupId>
        <artifactId>antlr-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-as-parser</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <grammars>org/apache/royale/compiler/internal/parsing/as/ASParser.g</grammars>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
            <version>2.7.7</version>
          </dependency>
        </dependencies>
      </plugin>

      <!--
          The generation of the metadata-parser requires Antlr to
          load ImportMetadataTokenTypes.txt. Unfortunately Altlr
          looks in the current working directory. The only way to
          force it to work, is to start a new process with the
          working directory in the directory containing the file.
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-metadata-parser</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath />
                <arguments>antlr.Tool</arguments>
                <argument>-o</argument>
                <argument>../../../../../../../../../../target/generated-sources/antlr/org/apache/royale/compiler/internal/parsing/as</argument>
                <argument>MetadataParser.g</argument>
              </arguments>
              <workingDirectory>src/main/antlr/org/apache/royale/compiler/internal/parsing/as</workingDirectory>
              <sourceRoot>target/generated-sources/antlr</sourceRoot>
            </configuration>
          </execution>
          <execution>
              <id>generate-test-js-typedefs</id>
              <phase>test-compile</phase>
              <goals>
                  <goal>exec</goal>
              </goals>
              <configuration>
                  <executable>java</executable>
                  <arguments>
                      <argument>-classpath</argument>
                      <classpath />
                      <arguments>org.apache.royale.compiler.clients.EXTERNC</arguments>
                      <argument>-load-config+=../compiler-externc/src/test/config/externc-config.xml</argument>
                  </arguments>
              </configuration>
          </execution>
          <execution>
              <id>generate-test-js-swc</id>
              <phase>test-compile</phase>
              <goals>
                  <goal>exec</goal>
              </goals>
              <configuration>
                  <executable>java</executable>
                  <arguments>
                      <argument>-classpath</argument>
                      <classpath />
                      <arguments>org.apache.royale.compiler.clients.COMPC</arguments>
                      <argument>-load-config+=../compiler-externc/target/compile-as-config.xml</argument>
                      <argument>-output=../compiler-externc/target/js.swc</argument>
                  </arguments>
              </configuration>
          </execution>
          <execution>
              <id>generate-test-custom-swc</id>
              <phase>test-compile</phase>
              <goals>
                  <goal>exec</goal>
              </goals>
              <configuration>
                  <executable>java</executable>
                  <arguments>
                      <argument>-classpath</argument>
                      <classpath />
                      <arguments>org.apache.royale.compiler.clients.COMPC</arguments>
                      <argument>-load-config+=target/compile-as-config.xml</argument>
                      <argument>-output=target/custom.swc</argument>
                  </arguments>
              </configuration>
          </execution>
        </executions>
      </plugin>

      <!--
            Do all the JBurg code generation.
      -->
      <plugin>
        <groupId>net.sourceforge.jburg</groupId>
        <artifactId>jburg-maven-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>generate-css-emitter</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <includes>
                <include>CSSEmitter.jbg</include>
              </includes>
              <sourceDirectory>src/main/jburg/org/apache/royale/compiler/internal/css/codegen</sourceDirectory>
              <outputDirectory>target/generated-sources/jburg/org/apache/royale/compiler/internal/css/codegen</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>generate-cmc-emitter</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <includes>
                <include>CmcEmitter.jbg</include>
              </includes>
              <sourceDirectory>src/main/jburg/org/apache/royale/compiler/internal/as/codegen</sourceDirectory>
              <outputDirectory>target/generated-sources/jburg/org/apache/royale/compiler/internal/as/codegen</outputDirectory>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <!-- debug=true generates the "dump" method for Emitters, which is used for debugging -->
          <debug>true</debug>
        </configuration>
        <dependencies>
          <!-- this needs to be first in order to patch jburg -->
          <dependency>
            <groupId>org.apache.royale.compiler</groupId>
            <artifactId>compiler-jburg-types</artifactId>
            <version>${compiler-jburg-types.version}</version>
          </dependency>
          <dependency>
            <groupId>net.sourceforge.jburg</groupId>
            <artifactId>jburg</artifactId>
            <version>1.10.3</version>
          </dependency>
        </dependencies>
      </plugin>

      <!--
            Do all the Antlr3 code generation.
      -->
      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr3-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-csslexer-and-cssparser</id>
            <goals>
              <goal>antlr</goal>
            </goals>
            <configuration>
              <includes>
                <include>CSS.g</include>
              </includes>
              <sourceDirectory>src/main/antlr3/org/apache/royale/compiler/internal/css</sourceDirectory>
              <outputDirectory>target/generated-sources/antlr3/org/apache/royale/compiler/internal/css</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>generate-csstree</id>
            <goals>
              <goal>antlr</goal>
            </goals>
            <configuration>
              <includes>
                <include>CSSTree.g</include>
              </includes>
              <sourceDirectory>src/main/antlr3/org/apache/royale/compiler/internal/css</sourceDirectory>
              <outputDirectory>target/generated-sources/antlr3/org/apache/royale/compiler/internal/css</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!--
              Do all the custom processing with the royale build tools.
      -->
      <plugin>
        <groupId>org.apache.royale.compiler</groupId>
        <artifactId>compiler-build-tools</artifactId>
        <executions>
          <execution>
            <id>generate-unknown-tree-handler</id>
            <goals>
              <goal>generate-unknown-tree-handler</goal>
            </goals>
            <configuration>
              <inputFile>org/apache/royale/compiler/internal/as/codegen/UnknownTreeHandlerPatterns.xml</inputFile>
              <outputFile>org/apache/royale/compiler/internal/as/codegen/UnknownTreeHandlerPatterns.java</outputFile>
            </configuration>
          </execution>
          <execution>
            <id>add-suppress-unused-warnings-annotations</id>
            <goals>
              <goal>add-class-annotation</goal>
            </goals>
            <configuration>
              <includes>
                <include>antlr/org/apache/royale/compiler/internal/parsing/as/ASParser.java</include>
                <include>antlr/org/apache/royale/compiler/internal/parsing/as/ASTokenTypes.java</include>
                <include>antlr/org/apache/royale/compiler/internal/parsing/as/MetadataTokenTypes.java</include>
              </includes>
              <annotation>@SuppressWarnings("unused")</annotation>
            </configuration>
          </execution>
          <execution>
            <id>add-suppress-all-warnings-annotations-css</id>
            <goals>
              <goal>add-class-annotation</goal>
            </goals>
            <configuration>
              <includes>
                <include>antlr3/org/apache/royale/compiler/internal/css/CSSLexer.java</include>
                <include>antlr3/org/apache/royale/compiler/internal/css/CSSParser.java</include>
              </includes>
              <annotation>@SuppressWarnings("all")</annotation>
              <dateStart>// $ANTLR 3.5.2 ***CSS.g</dateStart>
            </configuration>
          </execution>
          <execution>
            <id>add-suppress-all-warnings-annotations-csstree</id>
            <goals>
              <goal>add-class-annotation</goal>
            </goals>
            <configuration>
              <includes>
                <include>antlr3/org/apache/royale/compiler/internal/css/CSSTree.java</include>
              </includes>
              <annotation>@SuppressWarnings("all")</annotation>
              <dateStart>// $ANTLR 3.5.2 ***CSSTree.g</dateStart>
            </configuration>
          </execution>
          <execution>
            <id>add-suppress-all-warnings-annotations-jburg</id>
            <goals>
              <goal>add-class-annotation</goal>
            </goals>
            <configuration>
              <includes>
                <include>antlr/org/apache/royale/compiler/internal/parsing/as/MetadataParser.java</include>
              </includes>
              <annotation>@SuppressWarnings("all")</annotation>
            </configuration>
          </execution>
          <execution>
            <id>add-suppress-rawtypes-unchecked-unused-warnings-annotations</id>
            <goals>
              <goal>add-class-annotation</goal>
            </goals>
            <configuration>
              <includes>
                <include>jburg/org/apache/royale/compiler/internal/css/codegen/CSSEmitter.java</include>
                <include>jburg/org/apache/royale/compiler/internal/as/codegen/CmcEmitter.java</include>
              </includes>
              <annotation>@SuppressWarnings({"rawtypes", "unchecked", "unused"})</annotation>
              <dateStart>/*  Generated</dateStart>
              <dateEnd> by JBurg</dateEnd>
            </configuration>
          </execution>
          <execution>
            <id>generate-problems-enum</id>
            <goals>
              <goal>generate-problems-enum</goal>
            </goals>
          </execution>
          <execution>
            <id>generate-problems-resource-bundle</id>
            <goals>
              <goal>generate-problems-resource-bundle</goal>
            </goals>
          </execution>
          <execution>
            <id>order-jflex-switch-statements</id>
            <goals>
              <goal>order-jflex-switches</goal>
            </goals>
            <configuration>
              <includes>
              <include>jflex/org/apache/royale/compiler/internal/parsing/as/RawASDocTokenizer.java</include>
              <include>jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.java</include>
              <include>jflex/org/apache/royale/compiler/internal/parsing/mxml/RawMXMLTokenizer.java</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Make the surefire execute all unit-tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*Tests.java</include>
          </includes>
          <excludes>
            <exclude>as/**/*Tests.java</exclude>
            <exclude>f/**</exclude>
            <exclude>mxml/tags/**</exclude>
            <exclude>properties/**</exclude>
            <exclude>**/MXMLComponentTagTests.java</exclude>
            <exclude>**/MXMLComponentNodeTests.java</exclude>
            <exclude>**/MXMLHTTPServiceTagTests.java</exclude>
            <exclude>**/MXMLModelTagTests.java</exclude>
            <exclude>**/MXMLRemoteObjectNodeTests.java</exclude>
            <exclude>**/MXMLWebServiceNodeTests.java</exclude>
            <exclude>**/MXMLDesignLayerNodeTests.java</exclude>
            <exclude>**/MXMLHTTPServiceNodeTests.java</exclude>
            <exclude>**/MXMLModelNodeTests.java</exclude>
            <exclude>**/MXMLRemoteObjectTagTests.java</exclude>
            <exclude>**/MXMLStateNodeTests.java</exclude>
            <exclude>**/MXMLVectorNodeTests.java</exclude>
            <exclude>**/MXMLWebServiceTagTests.java</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <includes>
            <include>as/**/*Tests.java</include>
          </includes>
          <excludes>
            <exclude>f/**</exclude>
            <exclude>mxml/tags/**</exclude>
            <exclude>properties/**</exclude>
            <exclude>**/MXMLComponentTagTests.java</exclude>
            <exclude>**/MXMLComponentNodeTests.java</exclude>
            <exclude>**/MXMLHTTPServiceTagTests.java</exclude>
            <exclude>**/MXMLModelTagTests.java</exclude>
            <exclude>**/MXMLRemoteObjectNodeTests.java</exclude>
            <exclude>**/MXMLWebServiceNodeTests.java</exclude>
            <exclude>**/MXMLDesignLayerNodeTests.java</exclude>
            <exclude>**/MXMLHTTPServiceNodeTests.java</exclude>
            <exclude>**/MXMLModelNodeTests.java</exclude>
            <exclude>**/MXMLRemoteObjectTagTests.java</exclude>
            <exclude>**/MXMLStateNodeTests.java</exclude>
            <exclude>**/MXMLVectorNodeTests.java</exclude>
            <exclude>**/MXMLWebServiceTagTests.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
        This profile adds one test, that relies on the original FDK being
        available as it compiles each project in the framework/projects
        directory. It requires some environment variables being set.
    -->
    <profile>
      <id>option-with-flex-sdk-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes combine.children="append">
                <include>f/**/*Tests.java</include>
                <include>mxml/**/*Tests.java</include>
                <include>properties/**/*Tests.java</include>
                <include>**/MXMLComponentTagTests.java</include>
                <include>**/MXMLComponentNodeTests.java</include>
                <include>**/MXMLHTTPServiceTagTests.java</include>
                <include>**/MXMLModelTagTests.java</include>
                <include>**/MXMLRemoteObjectNodeTests.java</include>
                <include>**/MXMLWebServiceNodeTests.java</include>
                <include>**/MXMLDesignLayerNodeTests.java</include>
                <include>**/MXMLHTTPServiceNodeTests.java</include>
                <include>**/MXMLModelNodeTests.java</include>
                <include>**/MXMLRemoteObjectTagTests.java</include>
                <include>**/MXMLStateNodeTests.java</include>
                <include>**/MXMLVectorNodeTests.java</include>
                <include>**/MXMLWebServiceTagTests.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Also run tests using the FLASHPLAYER_DEBUGGER -->
    <profile>
      <id>option-with-swf</id>
      <dependencies>
        <!-- Ensure the playerglobal is available for running tests -->
        <dependency>
          <groupId>com.adobe.flash.framework</groupId>
          <artifactId>playerglobal</artifactId>
          <version>${flash.version}</version>
          <type>swc</type>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>org.apache.royale.compiler</groupId>
      <artifactId>compiler-jburg-types</artifactId>
      <version>${compiler-jburg-types.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.royale.compiler</groupId>
      <artifactId>compiler-common</artifactId>
      <version>0.9.12</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flex</groupId>
      <artifactId>flex-tool-api</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.11.0</version>
    </dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr</artifactId>
      <version>3.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>32.0.0-jre</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>failureaccess</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.jburg</groupId>
      <artifactId>jburg</artifactId>
      <version>1.10.3</version>
    </dependency>
    <dependency>
      <groupId>de.jflex</groupId>
      <artifactId>jflex</artifactId>
      <version>1.6.0</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.ant</groupId>
          <artifactId>ant</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.b1.pack</groupId>
      <artifactId>lzma-sdk-4j</artifactId>
      <version>9.22.0</version>
    </dependency>

    <dependency>
      <groupId>org.apache.royale.compiler</groupId>
      <artifactId>compiler-test-utils</artifactId>
      <version>0.9.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.royale.compiler</groupId>
      <artifactId>compiler-externc</artifactId>
      <version>0.9.12</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <!-- TODO: Currently only needed for the duplicate FlashplayerSecurityHandler -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.4</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

<properties /></project>
