<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2020 Kentyou.
  ~ All rights reserved. This program and the accompanying materials
  ~ are made available under the terms of the Eclipse Public License v1.0
  ~ which accompanies this distribution, and is available at
  ~ http://www.eclipse.org/legal/epl-v10.html
  ~
  ~ Contributors:
*    Kentyou - initial API and implementation
  -->

<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.eclipse.sensinact</groupId>
		<artifactId>gateway</artifactId>
		<version>2.0-SNAPSHOT</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<groupId>org.eclipse.sensinact.gateway</groupId>
	<artifactId>parent</artifactId>
	<packaging>pom</packaging>

	<name>sensiNact IoT Gateway - Platform</name>

	<build>
		<pluginManagement>
			<plugins>				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>sql-maven-plugin</artifactId>
					<executions>
						<execution>
							<id>insert-bundle-signature</id>
							<phase>install</phase>
							<goals>
								<goal>execute</goal>
							</goals>
							<configuration>
								<sqlCommand>UPDATE BUNDLE SET BSHA = '${sha}' WHERE BNAME = '${project.groupId}.${project.artifactId}'</sqlCommand>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<configuration>
					<licenseName>sensinact</licenseName>
					<licenseResolver>classpath://fr/license</licenseResolver>
					<organizationName>Kentyou</organizationName>
					<inceptionYear>2017</inceptionYear>
					<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
					<canUpdateLicense>false</canUpdateLicense>
					<canUpdateDescription>false</canUpdateDescription>
					<canUpdateCopyright>false</canUpdateCopyright>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>update-file-header</goal>
						</goals>
						<configuration>
							<includes>
								<include>**/*.java</include>
							</includes>
							<encoding>UTF-8</encoding>
						</configuration>
					</execution>
				</executions>
			</plugin>
            <!-- This dynamically calculates all the things we need to run our code. -->

			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-maven-plugin</artifactId>
			</plugin>
            <plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-testing-maven-plugin</artifactId>
				<version>${bnd-maven-plugin.version}</version>
				<executions>
					<!-- OSGi integration tests execution -->
					<execution>
						<id>testing</id>
						<goals>
							<goal>testing</goal>
						</goals>
						<configuration>
							<bndruns>
								<include>*.bndrun</include>
							</bndruns>
							<bundles>
								<bundle>${project.build.directory}/${project.build.finalName}-tests.jar</bundle>
							</bundles>
							<failOnChanges>false</failOnChanges>
							<includeDependencyManagement>true</includeDependencyManagement>
							<useMavenDependencies>true</useMavenDependencies>
							<resolve>true</resolve>
							<scopes>
								<scope>compile</scope>
								<scope>runtime</scope>
								<scope>test</scope>
								<scope>provided</scope>
							</scopes>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- This dynamically calculates all the things we need to run our code. -->
            <plugin>
                 <groupId>biz.aQute.bnd</groupId>
                 <artifactId>bnd-resolver-maven-plugin</artifactId>
                 <version>${bnd-maven-plugin.version}</version>
                 <executions>
					<!-- Integration Test Configuration -->
		            <execution>
		                <goals>
		                    <goal>resolve</goal>
		                </goals>
		            </execution>
					<execution>
						<id>resolve-test</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>resolve</goal>
						</goals>
						<configuration>
							<bndruns>
									<include>*.bndrun</include>
							</bndruns>
							<bundles>
								<bundle>${project.build.directory}/${project.build.finalName}-tests.jar</bundle>
							</bundles>
							<failOnChanges>false</failOnChanges>
							<includeDependencyManagement>true</includeDependencyManagement>
							<useMavenDependencies>true</useMavenDependencies>
							<reportOptional>false</reportOptional>							
							<scopes>
								<scope>compile</scope>
								<scope>runtime</scope>
								<scope>test</scope>
								<scope>provided</scope>
							</scopes>
						</configuration>
					</execution>
			</executions>
           </plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven-jar-plugin.version}</version>
				<configuration>
					<archive>
						<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
					</archive>
					<skipIfEmpty>true</skipIfEmpty>
				</configuration>
				<executions>
					<execution>
						<id>test-jar</id>
						<phase>package</phase>
						<goals>
							<goal>test-jar</goal>
						</goals>
						<configuration>
							<archive>
								<manifestFile>${project.build.testOutputDirectory}/META-INF/MANIFEST.MF</manifestFile>
							</archive>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>

	</dependencies>

	<modules>
		<module>sensinact-utils</module>
		<module>sensinact-common</module>
		<module>sensinact-security</module>
		<module>sensinact-datastore</module>
		<module>sensinact-core</module>
		<module>sensinact-historic-manager</module>
		<module>sensinact-remote-osgi</module>
		<module>protocol</module>
		<module>sensinact-generic</module>
		<module>sensinact-historic-api</module>
		<module>sensinact-system</module>
		<module>sensinact-shell</module>
		<module>sensinact-application</module>
		<module>southbound</module>
		<module>northbound</module>
		<module>tools</module>
		<module>../simulated-devices</module>
	</modules>
</project>