<!--
  #%L
  Gravia :: Runtime :: OSGi
  %%
  Copyright (C) 2013 - 2014 JBoss by Red Hat
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://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.
  #L%
  -->
<!--
    Set these VM properties in your IDE debugger 

    -Dtest.archive.directory=${workspace_loc:gravia-runtime-osgi/target}/test-libs 
    -Dlog4j.configuration=${workspace_loc:gravia-runtime-osgi}/src/test/resources/logging.properties
-->
<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>
    
    <parent>
        <groupId>org.jboss.gravia</groupId>
        <artifactId>gravia-runtime</artifactId>
        <version>1.1.0.Beta21</version>
    </parent>

    <name>Gravia :: Runtime :: OSGi</name>
    
    <artifactId>gravia-runtime-osgi</artifactId>
    <packaging>bundle</packaging>

    <!-- Properties -->
    <properties>
    </properties>
    
    <dependencies>
        <dependency>
	        <groupId>org.jboss.gravia</groupId>
	        <artifactId>gravia-runtime-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.gravia</groupId>
            <artifactId>gravia-provision</artifactId>
            <version>${project.version}</version>
        </dependency>
        
        <!-- Provided Dependencies -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.enterprise</artifactId>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.configadmin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.log</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.metatype</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.ant</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        
        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.container</groupId>
            <artifactId>arquillian-container-jbosgi-embedded</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.osgi</groupId>
            <artifactId>arquillian-osgi-bundle</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

	<build>
		<plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundles</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>directory-single</goal>
                        </goals>
                        <configuration>
                            <finalName>test-libs</finalName>
                            <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>scripts/assembly-bundles.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
			<plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>scr-descriptor</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <property name="project.version" value="${project.version}" />
                                <property name="version.scr" value="${version.apache.felix.scr}" />
                                <property name="version.scr.ant" value="${version.apache.felix.scr.generator}" />
                                <property name="version.ds.annotations" value="${version.apache.felix.scr.ds.annotations}" />
                                <property name="version.osgi" value="${version.osgi}" />
                                <ant antfile="scripts/antrun-scr-plugin.xml" target="generate" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Activator>org.jboss.gravia.runtime.osgi.internal.OSGiRuntimeActivator</Bundle-Activator>
						<Export-Package>
							org.jboss.gravia.runtime.osgi;version="${project.version}",
                            org.jboss.gravia.runtime.osgi.spi;version="${project.version}",
						</Export-Package>
					</instructions>
				</configuration>
			</plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${surefire.system.args}</argLine>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <systemPropertyVariables>
                        <test.archive.directory>${project.build.directory}/test-libs</test.archive.directory>
                        <log4j.configuration>file://${basedir}/src/test/resources/logging.properties</log4j.configuration>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
		</plugins>
	</build>
</project>
