<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.drools</groupId>
    <artifactId>drools-examples-android</artifactId>
    <version>7.22.0.Final</version>
  </parent>

  <artifactId>serialized-kbase</artifactId>
  <packaging>apk</packaging>

  <name>Drools Android Examples :: Serialized KnowledgeBase</name>

  <dependencies>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-android</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.xml.parsers</groupId>
          <artifactId>jaxp-ri</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-internal</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.github.tony19</groupId>
      <artifactId>logback-android-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.github.tony19</groupId>
      <artifactId>logback-android-classic</artifactId>
      <exclusions>
        <exclusion>
          <groupId>com.google.android</groupId>
          <artifactId>android</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <kiebases>
            <kiebase>HelloKB</kiebase>
          </kiebases>
          <resDirectory>${basedir}/src/main/res/raw</resDirectory>
          <systemProperties>
            <property>
              <name>drools.dialect.java.compiler.lnglevel</name>
              <value>1.6</value>
            </property>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <id>touch</id>
            <goals>
              <goal>touch</goal>
            </goals>
            <phase>generate-sources</phase>
          </execution>
          <execution>
            <id>compile-kbase</id>
            <goals>
              <goal>build</goal>
            </goals>
            <phase>compile</phase>
          </execution>
          <execution>
            <id>serialize</id>
            <goals>
              <goal>serialize</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.simpligility.maven.plugins</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <sdk>
            <platform>21</platform>
          </sdk>
          <manifest>
            <versionName/>
            <versionCodeUpdateFromVersion>true</versionCodeUpdateFromVersion>
            <debuggable>true</debuggable>
          </manifest>
          <dex>
            <coreLibrary>true</coreLibrary>
            <jvmArguments>
              <jvmArgument>-Xmx2048m</jvmArgument>
            </jvmArguments>
          </dex>
          <extractDuplicates>true</extractDuplicates>
          <apk>
            <metaInf>
              <includes>
                <include>services/**</include>
                <include>kmodule.*</include>
                <include>HelloKB/**</include>
                <include>drools**</include>
                <include>maven/${project.groupId}/${project.artifactId}/**</include>
              </includes>
            </metaInf>
          </apk>
          <proguard>
            <skip>false</skip>
            <config>proguard.cfg</config>
            <configs>
              <config>${env.ANDROID_HOME}/tools/proguard/proguard-android.txt</config>
            </configs>
            <filterManifest>true</filterManifest>
          </proguard>
        </configuration>
        <executions>
          <execution>
            <id>manifest</id>
            <phase>process-resources</phase>
            <goals>
              <goal>manifest-update</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
