<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>net.jangaroo</groupId>
  <artifactId>ext-as</artifactId>
  <packaging>swc</packaging>
  <version>7.2.0-4.1.1</version>

  <description>ActionScript 3 API for Sencha Ext JS Library Version 7.2.0</description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <jangaroo-tools.version>4.1.0</jangaroo-tools.version>
    <jangaroo-libs.version>4.1.0</jangaroo-libs.version>
    <ext6.version>6.2.0.981</ext6.version>
    <ext6.apidoc.version>6.2.0.981</ext6.apidoc.version>
    <ext6.pkg.version>6.2.0</ext6.pkg.version>
  </properties>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
    <relativePath />
  </parent>

  <organization>
    <name>CoreMedia AG</name>
    <url>http://www.coremedia.com/</url>
  </organization>

  <scm>
    <connection>scm:git:https://github.com/CoreMedia/ext-as.git</connection>
    <developerConnection>scm:git:https://github.com/CoreMedia/ext-as.git</developerConnection>
    <url>http://github.com/CoreMedia/ext-as</url>
    <tag>ext-as-7.2.0-4.1.1</tag>
  </scm>

  <build>
    <sourceDirectory>src/main/joo</sourceDirectory>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <excludeResources>true</excludeResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>net.jangaroo</groupId>
        <artifactId>jangaroo-maven-plugin</artifactId>
        <version>${jangaroo-tools.version}</version>
        <extensions>true</extensions>
        <configuration>
          <npmPackageNameReplacers>
            <npmPackageNameReplacer>
              <search>^.*$</search>
              <replace>@jangaroo/ext-ts</replace>
            </npmPackageNameReplacer>
          </npmPackageNameReplacers>
          <npmPackageVersionReplacers>
            <npmPackageVersionReplacer>
              <search>^.*$</search>
              <replace>1.0.0</replace>
            </npmPackageVersionReplacer>
          </npmPackageVersionReplacers>
          <namespaces>
            <namespace>
              <uri>exml:ext.config</uri>
            </namespace>
          </namespaces>
          <extNamespace>Ext</extNamespace>
        </configuration>
      </plugin>
    </plugins>

    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>1.0-beta-6</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.10</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
          <configuration>
            <includeEmptyDirs>true</includeEmptyDirs>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.4.0</version>
        </plugin>
        <plugin>
          <groupId>net.jangaroo</groupId>
          <artifactId>jangaroo-maven-plugin</artifactId>
          <version>${jangaroo-tools.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>net.jangaroo.com.sencha</groupId>
      <artifactId>ext-js-pkg-gpl</artifactId>
      <version>${ext6.pkg.version}</version>
      <type>pkg</type>
      <scope>test</scope> <!-- test scope: we do not want this dependency to spread into modules using ext-as -->
    </dependency>
    <dependency>
      <groupId>net.jangaroo</groupId>
      <artifactId>jangaroo-runtime</artifactId>
      <version>${jangaroo-libs.version}</version>
      <type>swc</type>
    </dependency>
    <dependency>
      <groupId>net.jangaroo</groupId>
      <artifactId>jangaroo-browser</artifactId>
      <version>${jangaroo-libs.version}</version>
      <type>swc</type>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>generate-json</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack</id>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <phase>initialize</phase>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.coremedia.sencha</groupId>
                      <artifactId>ext-js</artifactId>
                      <version>${ext6.version}</version>
                      <type>zip</type>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>jsduck</id>
                <goals>
                  <goal>exec</goal>
                </goals>
                <phase>generate-resources</phase>
                <configuration>
                  <executable>jsduck</executable>
                  <workingDirectory>${project.build.directory}/ext-${ext6.version}</workingDirectory>
                  <arguments>
                    <argument>--verbose</argument>
                    <argument>--export=full</argument>
                    <argument>--output</argument>
                    <argument>../json</argument>
                    <argument>packages/core/src</argument>
                    <argument>classic/classic/src</argument>
                    <argument>classic/classic/overrides</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>generate-api</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <executions>
              <execution>
                <id>remove-source</id>
                <goals>
                  <goal>clean</goal>
                </goals>
                <phase>initialize</phase>
                <configuration>
                  <excludeDefaultDirectories>true</excludeDefaultDirectories>
                  <filesets>
                    <fileset>
                      <directory>${project.build.sourceDirectory}/ext</directory>
                    </fileset>
                  </filesets>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack</id>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <phase>initialize</phase>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.coremedia.sencha</groupId>
                      <artifactId>ext</artifactId>
                      <version>${ext6.apidoc.version}</version>
                      <classifier>apidoc</classifier>
                      <type>zip</type>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-api</id>
                <goals>
                  <goal>java</goal>
                </goals>
                <phase>process-resources</phase>
                <configuration>
                  <mainClass>net.jangaroo.exml.tools.ExtAsApiGenerator</mainClass>
                  <arguments>
                    <argument>${project.build.directory}/json</argument>
                    <argument>${project.build.sourceDirectory}</argument>
                    <argument>true</argument>
                    <argument>false</argument>
                  </arguments>
                  <classpathScope>compile</classpathScope>
                  <additionalClasspathElements>
                    <additionalClasspathElement>${project.basedir}/src/main/config</additionalClasspathElement>
                  </additionalClasspathElements>
                  <includePluginDependencies>true</includePluginDependencies>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>net.jangaroo</groupId>
                <artifactId>ext-as-api-generator</artifactId>
                <version>4.0.41</version>
              </dependency>
              <dependency>
                <groupId>net.jangaroo</groupId>
                <artifactId>jangaroo-runtime</artifactId>
                <version>2.0.14</version>
              </dependency>
              <dependency>
                <groupId>net.jangaroo</groupId>
                <artifactId>jangaroo-browser</artifactId>
                <version>2.0.13</version>
              </dependency>
              <dependency>
                <groupId>net.jangaroo</groupId>
                <artifactId>ext-as</artifactId>
                <version>2.0.13</version>
                <classifier>sources</classifier>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>forTypeScriptComparison</id>
      <build>
        <plugins>
          <plugin>
            <groupId>net.jangaroo</groupId>
            <artifactId>jangaroo-maven-plugin</artifactId>
            <configuration>
              <suppressCommentedActionScriptCode>true</suppressCommentedActionScriptCode>
              <useEcmaParameterInitializerSemantics>true</useEcmaParameterInitializerSemantics>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>migrateToTypeScript</id>
      <build>
        <plugins>
          <plugin>
            <groupId>net.jangaroo</groupId>
            <artifactId>jangaroo-maven-plugin</artifactId>
            <configuration>
              <migrateToTypeScript>true</migrateToTypeScript>
              <suppressCommentedActionScriptCode>true</suppressCommentedActionScriptCode>
              <npmPackageFolderNameReplacers>
                <npmPackageFolderNameReplacer>
                  <search>^.*$</search>
                  <replace>ext-ts</replace>
                </npmPackageFolderNameReplacer>
              </npmPackageFolderNameReplacers>
              <npmDependencyOverrides>
                <npmDependencyOverride>
                  <search>^(@jangaroo/.*):.*$</search>
                  <replace>$1:^1.0.0-alpha</replace>
                </npmDependencyOverride>
              </npmDependencyOverrides>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
