<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>
  <parent>
    <groupId>com.expedia.tesla</groupId>
    <artifactId>tesla</artifactId>
    <version>4.0</version>
  </parent>

  <groupId>com.expedia.tesla</groupId>
  <artifactId>tesla-compiler</artifactId>
  <packaging>jar</packaging>
  <version>4.0</version>
  <name>tesla-compiler</name>
  
  <dependencies>
    <dependency>
      <groupId>com.expedia.tesla</groupId>
      <artifactId>tesla-core</artifactId>
      <version>4.0</version>
    </dependency>
    <dependency>
      <groupId>com.expedia.tesla</groupId>
      <artifactId>tesla-schema</artifactId>
      <version>4.0</version>
    </dependency>
    <dependency>
      <groupId>com.expedia.tesla</groupId>
      <artifactId>tesla-annotation</artifactId>
      <version>4.0</version>
    </dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mozilla</groupId>
      <artifactId>rhino</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
    </dependency>
    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.velocity</groupId>
      <artifactId>velocity</artifactId>
    </dependency>
    
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/resources</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/java/resources</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>
        <executions>
          <execution>
            <id>generate-test-sources-java</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <workingDirectory>${basedir}</workingDirectory>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.expedia.tesla.compiler.Compiler</argument>
                <argument>-l</argument>
                <argument>java</argument>
                <argument>-o</argument>
                <argument>${project.build.directory}/generated-test-sources/tesla/java</argument>
                <argument>-s</argument>
                <argument>com.expedia.tesla.compiler.test.Serializer</argument>
                <argument>**/src/test/resources/passcompile/full/**.tml</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>generate-test-sources-cpp</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <workingDirectory>${basedir}</workingDirectory>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.expedia.tesla.compiler.Compiler</argument>
                <argument>-l</argument>
                <argument>cpp</argument>
                <argument>-o</argument>
                <argument>${project.build.directory}/generated-test-sources/tesla/cpp</argument>
                <argument>**/src/test/resources/passcompile/full/**.tml</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>generate-test-sources-csharp</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <workingDirectory>${basedir}</workingDirectory>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.expedia.tesla.compiler.Compiler</argument>
                <argument>-l</argument>
                <argument>csharp</argument>
                <argument>-o</argument>
                <argument>${project.build.directory}/generated-test-sources/tesla/csharp</argument>
                <argument>**/src/test/resources/passcompile/full/**.tml</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>
        <executions>
          <execution>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <workingDirectory>${basedir}</workingDirectory>
          <executable>java</executable>
          <arguments>
            <argument>-classpath</argument>
            <classpath />
            <argument>com.expedia.tesla.compiler.Compiler</argument>
            <argument>-l</argument>
            <argument>java</argument>
            <argument>-o</argument>
            <argument>${project.build.directory}/generated-test-sources/tesla/java</argument>
            <argument>**/src/test/resources/positive/full/**/*.tml</argument>
          </arguments>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-test-sources/tesla/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>shade-compiler</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <outputFile>${project.build.directory}/${project.artifactId}-executable-${project.version}.jar</outputFile>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.expedia.tesla.compiler.Compiler</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
          <execution>
            <id>shade-schema-generator</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <outputFile>${project.build.directory}/tesla-schema-generator-executable-${project.version}.jar</outputFile>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.expedia.tesla.compiler.SchemaGenerator</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
