<?xml version = "1.0" encoding = "UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~ Copyright (c) 2015-2019 Skymind, Inc.
  ~
  ~ This program and the accompanying materials are made available under the
  ~ terms of the Apache License, Version 2.0 which is available at
  ~ https://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.
  ~
  ~ SPDX-License-Identifier: Apache-2.0
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->

<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">

    <parent>
        <groupId>org.deeplearning4j</groupId>
        <artifactId>deeplearning4j</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.deeplearning4j</groupId>
    <artifactId>pydl4j</artifactId>
    <packaging>jar</packaging>

    <name>pydl4j</name>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <pydl4j.compile.skip>false</pydl4j.compile.skip>
        <pydl4j.version>0.1.3</pydl4j.version>
        <nd4j.backend>nd4j-native</nd4j.backend>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>${nd4j.backend}</artifactId>
            <version>${dl4j.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.deeplearning4j.example.App</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <forceCreation>true</forceCreation>
                </configuration>
                <executions>
                    <execution>
                        <id>empty-javadoc-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>javadoc</classifier>
                            <classesDirectory>${basedir}/javadoc</classesDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>empty-sources-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                            <classesDirectory>${basedir}/src</classesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>python-install-cython</id>
                        <phase>install</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>pip</executable>
                            <workingDirectory>${basedir}</workingDirectory>
                            <arguments>
                                <argument>install</argument>
                                <argument>--user</argument>
                                <argument>Cython</argument>
                                <argument>--install-option=--no-cython-compile</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>python-build</id>
                        <phase>install</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>pip</executable>
                            <workingDirectory>${basedir}</workingDirectory>
                            <arguments>
                                <argument>install</argument>
                                <argument>--user</argument>
                                <argument>-e</argument>
                                <argument>.[tests]</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>python-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>python</executable>
                            <workingDirectory>${basedir}</workingDirectory>
                            <skip>${pydl4j.test.skip}</skip>
                            <arguments>
                                <argument>-m</argument>
                                <argument>pytest</argument>
                                <argument>--pep8</argument>
                                <argument>-m</argument>
                                <argument>pep8</argument>
                                <argument>tests/</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>nd4j-backend</id>
            <activation>
                <property>
                    <name>libnd4j.cuda</name>
                </property>
            </activation>
            <properties>
                <nd4j.backend>nd4j-cuda-${libnd4j.cuda}</nd4j.backend>
            </properties>
        </profile>
    </profiles>
</project>