<?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">
  <parent>
    <artifactId>nativelibs4java-parent</artifactId>
    <groupId>com.nativelibs4java</groupId>
    <version>1.9</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.nativelibs4java</groupId>
  <artifactId>bridj</artifactId>
  <packaging>bundle</packaging>
  <name>BridJ (NativeLibs4Java C/C++ Interop Layer)</name>
  <version>0.7.0</version>
  <url>http://code.google.com/p/bridj/</url>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.7</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Name>${project.name}</Bundle-Name>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Bundle-Activator>org.bridj.OSGiBundleActivator</Bundle-Activator>
            <Private-Package>org.bridj.relocated.*</Private-Package>
            <Import-Package>org.objectweb.asm;resolution:=optional,
							android.app;resolution:=optional,
							android.content.pm;resolution:=optional,
							android.os;resolution:=optional,
							com.android.dx.dex;resolution:=optional,
							com.android.dx.dex.cf;resolution:=optional,
							com.android.dx.dex.file;resolution:=optional,
							dalvik.system;resolution:=optional,
							org.osgi.framework</Import-Package>
            <Export-Package>org.bridj,
							org.bridj.ann,
							org.bridj.cpp,
							org.bridj.cpp.com,
							org.bridj.cpp.com.shell,
							org.bridj.cpp.mfc,
							org.bridj.cpp.std,
							org.bridj.demangling,
							org.bridj.dyncall,
							org.bridj.func,
							org.bridj.jawt,
							org.bridj.objc,
							org.bridj.util</Export-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.nativelibs4java</groupId>
        <artifactId>maven-velocity-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>android-package</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>android</shadedClassifierName>
              <artifactSet>
                <excludes>
                  <exclude>junit:junit</exclude>
                </excludes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>com.nativelibs4java:bridj</artifact>
                  <excludes>
                    <exclude>org/bridj/cpp/com/**</exclude>
                    <exclude>org/bridj/cpp/mfc/**</exclude>
                    <exclude>org/bridj/func/**</exclude>
                    <exclude>org/bridj/lib/linux_*/**</exclude>
                    <exclude>org/bridj/lib/sunos_*/**</exclude>
                    <exclude>org/bridj/lib/iphoneos_*/**</exclude>
                    <exclude>org/bridj/lib/darwin_*/**</exclude>
                    <exclude>org/bridj/lib/win*/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>junit/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/maven/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
          <execution>
            <id>c-package</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>c-only</shadedClassifierName>
              <artifactSet>
                <excludes>
                  <exclude>com.google.android.tools:dx</exclude>
                  <exclude>junit:junit</exclude>
                </excludes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>com.nativelibs4java:bridj</artifact>
                  <excludes>
                    <exclude>org/bridj/Android**</exclude>
                    <exclude>org/bridj/cpp/**</exclude>
                    <exclude>org/bridj/func/**</exclude>
                    <exclude>org/bridj/objc/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>junit/**</exclude>
                    <exclude>com/android/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/maven/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
          <execution>
            <id>win-package</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>windows-only</shadedClassifierName>
              <artifactSet>
                <excludes>
                  <exclude>com.google.android.tools:dx</exclude>
                  <exclude>junit:junit</exclude>
                </excludes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>com.nativelibs4java:bridj</artifact>
                  <excludes>
                    <exclude>org/bridj/Android**</exclude>
                    <exclude>org/bridj/objc/**</exclude>
                    <exclude>org/bridj/lib/linux_*/**</exclude>
                    <exclude>org/bridj/lib/sunos_*/**</exclude>
                    <exclude>org/bridj/lib/iphoneos_*/**</exclude>
                    <exclude>org/bridj/lib/darwin_*/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>junit/**</exclude>
                    <exclude>com/android/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/maven/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
          <execution>
            <id>unix-package</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>unix-only</shadedClassifierName>
              <artifactSet>
                <excludes>
                  <exclude>com.google.android.tools:dx</exclude>
                  <exclude>junit:junit</exclude>
                </excludes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>com.nativelibs4java:bridj</artifact>
                  <excludes>
                    <exclude>org/bridj/Android**</exclude>
                    <exclude>org/bridj/cpp/com/**</exclude>
                    <exclude>org/bridj/cpp/mfc/**</exclude>
                    <exclude>org/bridj/func/**</exclude>
                    <exclude>org/bridj/objc/**</exclude>
                    <exclude>org/bridj/lib/win*/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>junit/**</exclude>
                    <exclude>com/android/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/maven/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
          <execution>
            <id>desktop</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>false</shadedArtifactAttached>
              <artifactSet>
                <excludes>
                  <exclude>com.google.android.tools:dx</exclude>
                  <exclude>junit:junit</exclude>
                </excludes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>com.nativelibs4java:bridj</artifact>
                  <excludes>
                    <exclude>org/bridj/Android**</exclude>
                    <exclude>org/bridj/lib/android_*/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>junit/**</exclude>
                    <exclude>com/android/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/maven/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <relocations>
            <relocation>
              <pattern>org.objectweb.asm</pattern>
              <shadedPattern>org.bridj.relocated.org.objectweb.asm</shadedPattern>
              <includes>
                <include>org.objectweb.asm.*</include>
                <include>org.objectweb.asm.signature.*</include>
              </includes>
            </relocation>
          </relocations>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <groups>
                <group>
                  <title>Core Packages</title>
                  <packages>org.bridj:org.bridj.cpp:org.bridj.jawt:org.bridj.ann</packages>
                </group>
                <group>
                  <title>Extension Packages</title>
                  <packages>org.bridj.cs*:org.bridj.objc*:org.bridj.cpp.*</packages>
                </group>
                <group>
                  <title>Demos Packages</title>
                  <packages>org.bridj.demos</packages>
                </group>
                <group>
                  <title>Shouldn't-be-there-really Packages</title>
                  <packages>org.bridj.examples:org.bridj.func:org.bridj.util</packages>
                </group>
              </groups>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <mkdir />
                <property />
                <echo />
                <propertyfile>
                  <entry />
                  <entry />
                </propertyfile>
                <echo>To use BridJ in your Android project:
- Copy libs/ to your project's root directory.
- If you're building a native library with the NDK:
    - Copy native-libs/ to your project's root directory.
    - Add the following to your jni/Android.mk file:
    
        include $(CLEAR_VARS)
        LOCAL_MODULE := bridj
        LOCAL_SRC_FILES := ../native-libs/$(TARGET_ARCH_ABI)/libbridj.so
        include $(PREBUILT_SHARED_LIBRARY)
        
- If you're not building any native library with the NDK and just want to use BridJ to bind system libraries:
    - Copy the contents of native-libs/ to libs/.

In any case, if your project is already opened in the ADT / Eclipse, close it and reopen it to make sure it picks up the correct BridJ sources and javadoc locations.

BridJ is opensource software. Please refer to LICENSE.BridJ.txt to know under which conditions you may use it.</echo>
                <zip>
                  <zipfileset />
                  <zipfileset />
                  <zipfileset />
                  <zipfileset />
                  <zipfileset />
                  <zipfileset />
                  <zipfileset />
                </zip>
                <attachartifact />
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/${project.build.finalName}-android.zip</file>
                  <classifier>android</classifier>
                  <type>zip</type>
                </artifact>
                <artifact>
                  <file>${project.build.directory}/${project.build.finalName}-android.zip.asc</file>
                  <classifier>android</classifier>
                  <type>zip.asc</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
              <execution>
                <id>BuildBinaries</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${basedir}/BuildNative</executable>
                  <workingDirectory>${basedir}</workingDirectory>
                </configuration>
              </execution>
              <execution>
                <id>CleanBinaries</id>
                <phase>clean</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${basedir}/BuildNative</executable>
                  <workingDirectory>${basedir}</workingDirectory>
                  <arguments>
                    <argument>clean</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <version>4.3.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>4.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javolution</groupId>
      <artifactId>javolution</artifactId>
      <version>5.5.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <version>2.3.3</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
          <groupId>commons-logging</groupId>
        </exclusion>
        <exclusion>
          <artifactId>httpclient</artifactId>
          <groupId>org.apache.httpcomponents</groupId>
        </exclusion>
        <exclusion>
          <artifactId>opengl-api</artifactId>
          <groupId>org.khronos</groupId>
        </exclusion>
        <exclusion>
          <artifactId>xmlParserAPIs</artifactId>
          <groupId>xerces</groupId>
        </exclusion>
        <exclusion>
          <artifactId>xpp3</artifactId>
          <groupId>xpp3</groupId>
        </exclusion>
        <exclusion>
          <artifactId>json</artifactId>
          <groupId>org.json</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.android.tools</groupId>
      <artifactId>dx</artifactId>
      <version>1.7</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <properties>
    <versionSpecificSubPackage>v0_7_0</versionSpecificSubPackage>
    <maven.compiler.optimize>true</maven.compiler.optimize>
  </properties>
</project>

