<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.openautonomousconnection.luaj</groupId>
        <artifactId>parent</artifactId>
        <version>0.0.0-STABLE-1.0</version>
    </parent>

    <artifactId>jme</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.openautonomousconnection.luaj</groupId>
            <artifactId>core</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>jme</id>
            <activation>
                <property>
                    <name>env.WTK_HOME</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.6.3</version>
                        <configuration>
                            <failOnError>true</failOnError>
                            <failOnWarnings>true</failOnWarnings>
                            <doclint>none</doclint>
                            <locale>en_US</locale>
                            <encoding>UTF-8</encoding>
                            <docencoding>UTF-8</docencoding>
                            <charset>UTF-8</charset>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>copy-sources</id>
                                <phase>generate-sources</phase>
                                <goals><goal>copy-resources</goal></goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/generated-sources/luaj-jme</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.basedir}/../luaj-core/src/main/java</directory>
                                            <includes><include>**/*.java</include></includes>
                                        </resource>
                                        <resource>
                                            <directory>${project.basedir}/src/main/java</directory>
                                            <includes><include>**/*.java</include></includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>com.google.code.maven-replacer-plugin</groupId>
                        <artifactId>replacer</artifactId>
                        <executions>
                            <execution>
                                <id>rewrite-branding</id>
                                <phase>generate-sources</phase>
                                <goals><goal>replace</goal></goals>
                                <configuration>
                                    <basedir>${project.build.directory}/generated-sources/luaj-jme</basedir>
                                    <includes><include>**/*.java</include></includes>
                                    <replacements>
                                        <replacement>
                                            <token>"Luaj 0.0"</token>
                                            <value>"${luaj.brand.jme}"</value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-generated-sources</id>
                                <phase>generate-sources</phase>
                                <goals><goal>add-source</goal></goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/generated-sources/luaj-jme</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <release>${maven.compiler.release}</release>
                            <compilerArgs>
                                <arg>-bootclasspath</arg>
                                <arg>${env.WTK_HOME}/lib/cldcapi11.jar${path.separator}${env.WTK_HOME}/lib/midpapi20.jar${path.separator}${env.WTK_HOME}/lib/mmapi.jar</arg>
                            </compilerArgs>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals><goal>jar</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>