[bugzilla 372463] HTML Export for the Intent Documentation (Step 5)

- fixing build : adding Acceleo compilation to build tasks
diff --git a/features/org.eclipse.mylyn.docs.intent.update/category.xml b/features/org.eclipse.mylyn.docs.intent.update/category.xml
index a9a5249..23ead3a 100644
--- a/features/org.eclipse.mylyn.docs.intent.update/category.xml
+++ b/features/org.eclipse.mylyn.docs.intent.update/category.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>

-<site>

+<site>   

+   <feature id="org.eclipse.mylyn.docs.intent.feature" version="0.0.0">

+      <category name="mylyn.intent"/>

+   </feature>

    <feature id="org.eclipse.mylyn.docs.intent.exporter.feature" version="0.0.0">

       <category name="mylyn.intent"/>

    </feature>

    <feature id="org.eclipse.mylyn.docs.intent.markup.feature" version="0.0.0">

       <category name="mylyn.intent"/>

 	</feature>

-   <feature id="org.eclipse.mylyn.docs.intent.feature" version="0.0.0">

-      <category name="mylyn.intent"/>

-   </feature>

    <category-def name="mylyn.intent" label="Mylyn Intent (Incubation)">

       <description>

          Mylyn Intent (Incubation)

diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter/.classpath b/plugins/org.eclipse.mylyn.docs.intent.exporter/.classpath
index abfee04..a2f9dbb 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter/.classpath
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter/.classpath
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-    <classpathentry kind="src" path="src"/>
-    <classpathentry kind="output" path="bin"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src-acceleo-build"/>
+	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter/build.properties b/plugins/org.eclipse.mylyn.docs.intent.exporter/build.properties
index 5d7928e..b12e3d0 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter/build.properties
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter/build.properties
@@ -1,4 +1,5 @@
-source.. = src/
+source.. = src/,\
+           src-acceleo-build/
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter/pom.xml b/plugins/org.eclipse.mylyn.docs.intent.exporter/pom.xml
index 2854442..97d2946 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter/pom.xml
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter/pom.xml
@@ -26,6 +26,31 @@
         <groupId>org.eclipse.tycho</groupId>

         <artifactId>tycho-source-plugin</artifactId>

       </plugin>   

+      <plugin>  

+          <groupId>org.codehaus.mojo</groupId>  

+          <artifactId>exec-maven-plugin</artifactId>  

+          <version>1.1.1</version>  

+          <executions>  

+            <execution>  

+              <phase>compile</phase>  

+              <goals>  

+                <goal>java</goal>  

+              </goals>

+              <configuration>

+                <!--

+                   Calls the AcceleoCompiler to launch the compilation.

+                -->

+                <mainClass>org.eclipse.mylyn.docs.intent.exporter.AcceleoCompiler</mainClass>  

+                <arguments>  

+                  <argument>${basedir}/src/</argument>  <!-- The source folder -->  

+                  <argument>${basedir}/target/classes</argument>  <!-- The output folder -->

+                  <argument>true</argument>  <!-- Indicates if we should use binary resources serializations -->

+                  <argument></argument>  <!-- The project dependencies in the workspace -->

+                </arguments>  

+              </configuration>  

+            </execution>  

+          </executions>  

+        </plugin>

     </plugins>

   </build>

 

diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter/src-acceleo-build/org/eclipse/mylyn/docs/intent/exporter/AcceleoCompiler.java b/plugins/org.eclipse.mylyn.docs.intent.exporter/src-acceleo-build/org/eclipse/mylyn/docs/intent/exporter/AcceleoCompiler.java
new file mode 100644
index 0000000..87774d6
--- /dev/null
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter/src-acceleo-build/org/eclipse/mylyn/docs/intent/exporter/AcceleoCompiler.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Obeo.
+ * 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:
+ *     Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.docs.intent.exporter;
+
+import org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.mylyn.docs.intent.markup.markup.MarkupPackage;
+import org.eclipse.mylyn.docs.intent.markup.wikigen.WikigenPackage;
+
+/**
+ * The Acceleo Stand Alone compiler.
+ * 
+ * @author <a href="mailto:stephane.begaudeau@obeo.fr">Stephane Begaudeau</a>
+ * @since 3.1
+ */
+public class AcceleoCompiler extends AbstractAcceleoCompiler {
+    
+    /**
+     * The entry point of the compilation.
+     * 
+     * @param args
+     *             The arguments used in the compilation: the source folder,
+     *             the output folder, a boolean indicating if we should use binary resource
+     *             serialization and finally the dependencies of the project.
+     */
+    public static void main(String[] args) {
+        if (args.length < 3) {
+            throw new IllegalArgumentException("Missing parameters"); //$NON-NLS-1$
+        }
+        AcceleoCompiler acceleoCompiler = new AcceleoCompiler();
+        acceleoCompiler.setSourceFolder(args[0]);
+        acceleoCompiler.setOutputFolder(args[1]);
+        acceleoCompiler.setBinaryResource(Boolean.valueOf(args[2]).booleanValue());
+        if (args.length == 4 && args[3] != null && !"".equals(args[3])) { //$NON-NLS-1$
+            acceleoCompiler.setDependencies(args[3]);
+        }
+        acceleoCompiler.doCompile(new BasicMonitor());
+    }
+    
+    /**
+     * Launches the compilation of the mtl files in the generator.
+     * 
+     * @see org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler#doCompile(org.eclipse.emf.common.util.Monitor)
+     */
+    @Override
+    public void doCompile(Monitor monitor) {
+        super.doCompile(monitor);
+    }
+    
+    /**
+     * Registers the packages of the metamodels used in the generator.
+     * 
+     * @see org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler#registerPackages()
+     */
+    @Override
+    protected void registerPackages() {
+        super.registerPackages();
+        /*
+         * If you want to add the other packages used by your generator, for example UML:
+         * org.eclipse.emf.ecore.EPackage.Registry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+         **/
+        org.eclipse.emf.ecore.EPackage.Registry.INSTANCE.put(MarkupPackage.eNS_URI, MarkupPackage.eINSTANCE);
+        org.eclipse.emf.ecore.EPackage.Registry.INSTANCE.put(WikigenPackage.eNS_URI, WikigenPackage.eINSTANCE);
+    }
+
+    /**
+     * Registers the resource factories.
+     * 
+     * @see org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler#registerResourceFactories()
+     */
+    @Override
+    protected void registerResourceFactories() {
+        super.registerResourceFactories();
+        /*
+         * If you want to add other resource factories, for example if your metamodel uses a specific serialization:
+         * org.eclipse.emf.ecore.resource.Resource.Factory.Registry.getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+         **/
+    }
+}
+
diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter/tasks/HTMLBootstrapGenDocument.xml b/plugins/org.eclipse.mylyn.docs.intent.exporter/tasks/HTMLBootstrapGenDocument.xml
index aa502bb..28f70cf 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter/tasks/HTMLBootstrapGenDocument.xml
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter/tasks/HTMLBootstrapGenDocument.xml
@@ -43,6 +43,7 @@
         <pathelement location="${ECLIPSE_WORKSPACE}//.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar"/>
         <pathelement location="${ECLIPSE_WORKSPACE}//.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jface_3.7.0.I20110522-1430.jar"/>
         <pathelement location="${ECLIPSE_WORKSPACE}//.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar"/>
+        <pathelement location="${ECLIPSE_WORKSPACE}//.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.resources_3.7.100.v20110510-0712.jar"/>
     </path>
 
     <path id="org.eclipse.mylyn.docs.intent.exporter.classpath">
diff --git a/plugins/org.eclipse.mylyn.docs.intent.markup.gen/pom.xml b/plugins/org.eclipse.mylyn.docs.intent.markup.gen/pom.xml
index d89dc2c..60205e4 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.markup.gen/pom.xml
+++ b/plugins/org.eclipse.mylyn.docs.intent.markup.gen/pom.xml
@@ -1,4 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2011 Obeo
+
+   Cedric Brun <cedric.brun@obeo.fr>
+-->
 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>