<?xml version="1.0" encoding="UTF-8"?>
<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>
        <artifactId>gremlin-tools</artifactId>
        <groupId>org.apache.tinkerpop</groupId>
        <version>3.4.7</version>
    </parent>
    <artifactId>gremlin-io-test</artifactId>
    <name>Apache TinkerPop :: Gremlin IO Test</name>
    <dependencies>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-driver</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>tinkergraph-gremlin</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>io</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>io</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.gmavenplus</groupId>
                        <artifactId>gmavenplus-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                                <version>${groovy.version}</version>
                                <type>pom</type>
                                <scope>runtime</scope>
                            </dependency>
                            <dependency>
                                <groupId>log4j</groupId>
                                <artifactId>log4j</artifactId>
                                <version>1.2.17</version>
                                <scope>runtime</scope>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>generate-io-files-graphson</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>projectBuildDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectBaseDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectVersion</name>
                                            <value>${project.version}</value>
                                        </property>
                                    </properties>
                                    <scripts>
                                        <script>${project.basedir}/scripts/generate-graphson-resources.groovy</script>
                                    </scripts>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-io-files-gryo</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>projectBuildDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectBaseDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectVersion</name>
                                            <value>${project.version}</value>
                                        </property>
                                    </properties>
                                    <scripts>
                                        <script>${project.basedir}/scripts/generate-gryo-resources.groovy</script>
                                    </scripts>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-io-files-graphbinary</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>projectBuildDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectBaseDir</name>
                                            <value>${project.build.directory}</value>
                                        </property>
                                        <property>
                                            <name>projectVersion</name>
                                            <value>${project.version}</value>
                                        </property>
                                    </properties>
                                    <scripts>
                                        <script>${project.basedir}/scripts/generate-graphbinary-resources.groovy</script>
                                    </scripts>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-io-model-csv</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <scripts>
                                        <script>
                                            <![CDATA[
import org.apache.tinkerpop.gremlin.structure.io.Model
import java.io.File

new File("${project.build.directory}/dev-docs/").mkdirs()
Model.instance().saveAsCsv("${project.build.directory}/dev-docs/model.csv")
]]>
                                        </script>
                                    </scripts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>