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

    <groupId>io.github.alexanderschuetz97</groupId>
    <artifactId>lualfs</artifactId>
    <version>0.1.2</version>
    <packaging>bundle</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>luaLFS is library compatible to LuaFileSystem using linux system commands instead of native libraries</description>
    <url>https://github.com/AlexanderSchuetz97/luaLFS/tree/master</url>

    <licenses>
        <license>
            <name>GNU GENERAL PUBLIC LICENSE Version 3</name>
            <url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>AlexanderSchuetz97</id>
            <name>Alexander Schuetz</name>
            <email>aschuetz@protonmail.com</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/AlexanderSchuetz97/luaLFS.git</connection>
        <developerConnection>scm:git:ssh://github.com:AlexanderSchuetz97/luaLFS.git</developerConnection>
        <url>https://github.com/AlexanderSchuetz97/luaLFS/tree/master</url>
    </scm>

    <build>
        <plugins>
            <!-- OSGI Bundle creator -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Export-Package>io.github.alexanderschuetz97.lualfs.*</Export-Package>
                        <Import-Package>org.luaj.vm2.*</Import-Package>
                        <Include-Resource>{maven-resources},lualfs/=target/luajcoutput/</Include-Resource>
                    </instructions>
                </configuration>
            </plugin>

            <!-- Remove username from manifest -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifestEntries>
                            <Built-By>maven</Built-By>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- Generate Source Jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Generate Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Sign all jars using GPG key -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Configure compiler for java 7 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>7</source>
                    <target>7</target>
                </configuration>
            </plugin>

            <!-- Copy dependencies to temporary folder in target needed by next step to compile lua to java-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <outputDirectory>target/deps</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/deps</outputDirectory>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>




            <!-- compile lua scripts to java -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>first-execution</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>io.github.alexanderschuetz97.lualfs.ScriptPreCompiler</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.luaj</groupId>
            <artifactId>luaj-jse</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.bcel</groupId>
            <artifactId>bcel</artifactId>
            <version>6.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

    </dependencies>
</project>