<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>es.uvigo.esei.dgss.teamA.microstories</groupId>
    <artifactId>dgss2021-teamA-microstories-pom</artifactId>
    <version>0.1.0-SNAPSHOT</version>
  </parent>
  <artifactId>dgss2021-teamA-microstories-jsf</artifactId>
  <packaging>war</packaging>

  <name>JSF</name>
  <description>μStories 20/21 Team A - JSF</description>

  <dependencies>
    <!-- General -->
    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>dgss2021-teamA-microstories-service</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
	    <groupId>org.webjars</groupId>
	    <artifactId>bootstrap</artifactId>
	</dependency>
   

    <!-- Testing -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>dgss2021-teamA-microstories-tests</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>java-hamcrest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymock</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.extension</groupId>
      <artifactId>arquillian-persistence-dbunit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.graphene</groupId>
      <artifactId>graphene-webdriver</artifactId>
      <type>pom</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jsf-geckodriver-download-unix</id>
      <activation>
        <os>
          <family>unix</family>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>download-geckodriver</id>
                <phase>process-test-resources</phase>
                <configuration>
                  <tasks>
                    <mkdir dir="${geckodriver.basepath}" />
                    <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true" />
                    <untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip" />
                    <chmod file="${geckodriver.uncompressed.path}" perm="a+x" />
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <webdriver.gecko.driver>${geckodriver.uncompressed.path}</webdriver.gecko.driver>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jsf-geckodriver-download-windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>download-geckodriver</id>
                <phase>process-test-resources</phase>
                <configuration>
                  <tasks>
                    <mkdir dir="${geckodriver.basepath}" />
                    <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true" />
                    <unzip src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" />
                    <chmod file="${geckodriver.uncompressed.path}" perm="a+x" />
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <webdriver.gecko.driver>${geckodriver.uncompressed.path}</webdriver.gecko.driver>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-unix-amd64</id>
      <activation>
        <os>
          <family>unix</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-linux64.tar.gz</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-linux64.tar.gz</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-unix-x86</id>
      <activation>
        <os>
          <family>unix</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-linux32.tar.gz</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-linux32.tar.gz</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-unix-i386</id>
      <activation>
        <os>
          <family>unix</family>
          <arch>i386</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-linux32.tar.gz</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-linux32.tar.gz</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-windows-amd64</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-win64.zip</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-win64.zip</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver.exe</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-windows-x86</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-win32.zip</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-win32.zip</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver.exe</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-windows-i386</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>i386</arch>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-win32.zip</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-win32.zip</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver.exe</geckodriver.uncompressed.path>
      </properties>
    </profile>
    <profile>
      <id>jsf-geckodriver-properties-and-download-mac</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <geckodriver.url>https://github.com/mozilla/geckodriver/releases/download/${geckodriver.version}/geckodriver-${geckodriver.version}-macos.tar.gz</geckodriver.url>
        <geckodriver.basepath>${project.build.directory}${file.separator}geckodriver</geckodriver.basepath>
        <geckodriver.compressed.path>${geckodriver.basepath}${file.separator}geckodriver-${geckodriver.version}-macos.tar.gz</geckodriver.compressed.path>
        <geckodriver.uncompressed.path>${geckodriver.basepath}${file.separator}geckodriver</geckodriver.uncompressed.path>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>download-geckodriver</id>
                <phase>process-test-resources</phase>
                <configuration>
                  <tasks>
                    <mkdir dir="${geckodriver.basepath}" />
                    <get src="${geckodriver.url}" dest="${geckodriver.compressed.path}" skipexisting="true" />
                    <untar src="${geckodriver.compressed.path}" dest="${geckodriver.basepath}" compression="gzip" />
                    <chmod file="${geckodriver.uncompressed.path}" perm="a+x" />
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <webdriver.gecko.driver>${geckodriver.uncompressed.path}</webdriver.gecko.driver>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
