Bug 497803 - [Components][releng] add a way to update the target
platform version

-adding the profile
-adding minimal documentation
-grouping plugins definition and configuration

Change-Id: Ic6e41aca246bfba8797b6cf97dd932a535e32387
Signed-off-by: Francois Le Fevre - CEA <francois.le-fevre@cea.fr>
diff --git a/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/pom.xml b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/pom.xml
index 86f3760..30cbba5 100644
--- a/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/pom.xml
+++ b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/pom.xml
@@ -5,7 +5,7 @@
 	<parent>
 		<groupId>org.eclipse.papyrus.components</groupId>
 		<artifactId>org.eclipse.papyrus.components.parent</artifactId>
-		<version>0.0.5</version>
+		<version>0.0.6</version>
 	</parent>
 	<artifactId>org.eclipse.papyrus.components.archetype</artifactId>
 	<packaging>jar</packaging>
diff --git a/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon-papyrusnightly/target.file b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon-papyrusnightly/target.file
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon-papyrusnightly/target.file
diff --git a/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon/target.file b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon/target.file
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/components/org.eclipse.papyrus.components.parent/org.eclipse.papyrus.components.archetype/src/main/resources/archetype-resources/targetplatform/__groupId__.targetplatform.neon/target.file
diff --git a/components/org.eclipse.papyrus.components.parent/pom.xml b/components/org.eclipse.papyrus.components.parent/pom.xml
index 2003160..144d87c 100644
--- a/components/org.eclipse.papyrus.components.parent/pom.xml
+++ b/components/org.eclipse.papyrus.components.parent/pom.xml
@@ -4,7 +4,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>org.eclipse.papyrus.components</groupId>
 	<artifactId>org.eclipse.papyrus.components.parent</artifactId>
-	<version>0.0.5</version>
+	<version>0.0.6</version>
 	<packaging>pom</packaging>
 	<name>Papyrus Shared Components Descriptor</name>
 
@@ -91,6 +91,8 @@
 		<maven-jxr-version>2.3</maven-jxr-version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 
+		<rcptt-runner-version>2.1.0</rcptt-runner-version>
+		
 		<!-- Sonar properties -->
 		<sonar.language>java</sonar.language>
 		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
@@ -120,12 +122,38 @@
 				<enabled>false</enabled>
 			</snapshots>
 		</pluginRepository>
+		<pluginRepository>
+			<id>jboss-public-repository-group</id>
+			<name>JBoss Public Repository Group</name>
+			<url>http://repository.jboss.org/nexus/content/groups/public/</url>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</pluginRepository>
+		<pluginRepository>
+			<id>rcptt-releases</id>
+			<name>RCPTT Maven repository</name>
+			<url>https://repo.eclipse.org/content/repositories/rcptt-releases/</url>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</pluginRepository>
 	</pluginRepositories>
 	
 	<modules>
 		<module>org.eclipse.papyrus.components.archetype</module>
 	</modules>
-
+	
+	<dependencyManagement>
+		<dependencies>
+	 		<dependency>
+		    	<groupId>org.eclipse.papyrus.tools</groupId>
+				<artifactId>org.eclipse.papyrus.tools.rcptt</artifactId>
+				<version>0.0.1</version>
+	    		<type>rcpttTest</type>
+	    	</dependency>
+	    </dependencies>
+	</dependencyManagement>
 
 	<build>
 		<pluginManagement>
@@ -228,6 +256,11 @@
 					<version>${tycho-version}</version>
 				</plugin>
 				<plugin>
+					<groupId>org.eclipse.tycho.extras</groupId>
+					<artifactId>tycho-version-bump-plugin</artifactId>
+					<version>${tychoExtrasVersion}</version>
+				</plugin>
+				<plugin>
 					<groupId>org.jacoco</groupId>
 					<artifactId>jacoco-maven-plugin</artifactId>
 					<version>${jacoco-version}</version>
@@ -257,6 +290,85 @@
 					<artifactId>eclipse-jarsigner-plugin</artifactId>
 					<version>1.1.2</version>
 				</plugin>
+				<plugin>
+					<!-- https://github.com/jbosstools/jbosstools-maven-plugins/wiki -->
+					<groupId>org.jboss.tools.tycho-plugins</groupId>
+					<artifactId>repository-utils</artifactId>
+					<version>0.23.2</version>
+				</plugin>
+				<plugin>
+					<groupId>org.eclipse.rcptt</groupId>
+					<artifactId>rcptt-maven-plugin</artifactId>
+					<version>2.1.0</version>
+					<extensions>true</extensions>
+					<configuration>
+						<runner>
+							<version>${rcptt-runner-version}</version>
+							<!-- Manage the memory used by Runner -->
+							<vmArgs>
+								<vmArg>-Xmx1024m</vmArg>
+								<!--<vmArg>-javaagent:${user.home}/.m2/repository/org/jacoco/org.jacoco.agent/${jacoco-version}/org.jacoco.agent-${jacoco-version}-runtime.jar=destfile=${sonar.jacoco.reportPath}</vmArg>-->
+							</vmArgs>
+						</runner>
+	
+						<aut>
+							<explicit>../${component.package.rootname}.product/target/products/${component.package.rootname}.product-[platform].zip</explicit>
+							<!-- reuseExistingWorkspace>false</reuseExistingWorkspace -->
+							
+							<args>
+							    <arg>-clean</arg>
+							    <arg>-port</arg>
+							    <arg>8080</arg>
+							</args>  
+	
+							<vmArgs> 
+							   <vmArg>-Xmx1536m</vmArg>  
+							   <vmArg>-XX:MaxPermSize=1024m</vmArg> 
+							</vmArgs> 
+						</aut>
+						<testOptions>
+							<!-- Timeout for all tests, in seconds -->
+							<execTimeout>3600</execTimeout>
+							<!-- Timeout for a single test case, in seconds -->
+							<testExecTimeout>1200</testExecTimeout>
+							<!-- When true, include output of 'take-screenshot' and 'trace' ECL commands into a report 
+							<passedTestDetails>true</passedTestDetails>-->
+						</testOptions>					
+					</configuration>
+				</plugin>
+				<!--This plugin's configuration is used to store Eclipse m2e settings 
+					only. It has no influence on the Maven build itself. -->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>
+											org.eclipse.rcptt
+										</groupId>
+										<artifactId>
+											rcptt-maven-plugin
+										</artifactId>
+										<versionRange>
+											[2.0.1,)
+										</versionRange>
+										<goals>
+											<goal>resources</goal>
+											<goal>execute</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore></ignore>
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
 			</plugins>
 		</pluginManagement>
 
@@ -1176,5 +1288,47 @@
 				</plugins>
 			</build>
 		</profile>
+		
+		<!-- This profile allows updating any target platform file with the latest version of the feature
+		usage at the root of the project or directly at the target platform location
+		prerequisite: you need to add a target.file at the root of your maven plugin
+		
+		mvn validate -DtargetUpdate=true -Declipse.targetrelease=neon-papyrusnightly -Declipse.release=neon-papyrusnightly -f targetplatform/pom.xml 
+		-Declipse.targetrelease=neon-papyrusnightly -Declipse.release=neon-papyrusnightly: to specify which target to update
+		-DtargetUpdate=true: to force the update
+		it is linked to the validate phase 
+		 -->
+		<profile>
+			<id>targetUpdate</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+				<property>
+					<name>targetUpdate</name>
+					<value>true</value>
+				</property>
+				<file>
+            		<exists>target.file</exists>
+        		</file>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.eclipse.tycho.extras</groupId>
+						<artifactId>tycho-version-bump-plugin</artifactId>
+						<executions>
+							<execution>
+								<phase>validate</phase>
+								<goals>
+									<goal>update-target</goal>
+								</goals>
+								<configuration>
+									<targetFile>${component.package.rootname}.targetplatform.${eclipse.targetrelease}.target</targetFile>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
 	</profiles>
 </project>
\ No newline at end of file
diff --git a/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/index.xml b/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/index.xml
index 9640b23..574764d 100644
--- a/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/index.xml
+++ b/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/index.xml
@@ -15,6 +15,11 @@
 				<p>The Papyrus Components project aims at providing a shared developer environment to help to integrate additional Papyrus Component.</p>
 			</subsection>
 		</section>
+		<section name="Standard Operating Procedure">
+			<ul>
+			<li><a href="sop-targetPlatformUpdate.html">SOP Target Platform Update</a></li>
+			</ul>
+		</section>
 	</body>
 
 </document>
\ No newline at end of file
diff --git a/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/sop-targetPlatformUpdate.xml b/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/sop-targetPlatformUpdate.xml
new file mode 100644
index 0000000..5050648
--- /dev/null
+++ b/components/org.eclipse.papyrus.components.parent/src/site/xdoc/developer/sop-targetPlatformUpdate.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+
+	<properties>
+		<title>sop-targetPlatformUpdate</title>
+	</properties>
+
+	<body>
+		<section name="Context">
+			<p>All components are based upon a set of targets platform localized at the targetplatform directory. You can update them with the Obeo plugin or directly from a maven command.</p>
+			<p>It will switch resolve all feature with the latest ones found on the different update site you are refering.</p>
+		</section>
+		<section name="How to?">
+			<subsection name="Pre-requisite">
+				<p>You have to have a target.file at the root of your target platform plugin. You need to specify with target platform to activate through profile management.</p>
+				
+				<source>
+				mvn validate -DtargetUpdate=true -Declipse.targetrelease=neon-papyrusnightly -Declipse.release=neon-papyrusnightly -f targetplatform/pom.xml
+				</source>
+				<p>the tycho-version-bump-plugin is bound to the validate phase</p>
+				<p>-DtargetUpdate=true ensure you enforce the taregtUpdate</p>
+				<p>-Declipse.targetrelease=neon-papyrusnightly -Declipse.release=neon-papyrusnightly: specify with target to update</p>
+				<p>-f targetplatform/pom.xml: specify the pom to look at</p>
+			</subsection>
+		</section>
+	</body>
+
+</document>
\ No newline at end of file