Introduce Argeo PDE Maven plugin
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 8 Jul 2008 12:00:45 +0000 (12:00 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 8 Jul 2008 12:00:45 +0000 (12:00 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1387 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

maven/plugins/maven-argeo-pde-plugin/.project [new file with mode: 0644]
maven/plugins/maven-argeo-pde-plugin/pom.xml [new file with mode: 0644]
maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.build.xml [new file with mode: 0644]
maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.mojos.xml [new file with mode: 0644]

diff --git a/maven/plugins/maven-argeo-pde-plugin/.project b/maven/plugins/maven-argeo-pde-plugin/.project
new file mode 100644 (file)
index 0000000..7cafba5
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>maven-argeo-pde-plugin</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+       </buildSpec>
+       <natures>
+       </natures>
+</projectDescription>
diff --git a/maven/plugins/maven-argeo-pde-plugin/pom.xml b/maven/plugins/maven-argeo-pde-plugin/pom.xml
new file mode 100644 (file)
index 0000000..73b6e26
--- /dev/null
@@ -0,0 +1,34 @@
+<project>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.argeo.slc.maven.plugins</groupId>
+       <artifactId>maven-argeo-pde-plugin</artifactId>
+       <version>0.1.1-SNAPSHOT</version>
+       <packaging>maven-plugin</packaging>
+       <name>Argeo PDE Plugin</name>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.apache.maven</groupId>
+                       <artifactId>maven-script-ant</artifactId>
+                       <version>2.0.9</version>
+               </dependency>
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <artifactId>maven-plugin-plugin</artifactId>
+                               <dependencies>
+                                       <dependency>
+                                               <groupId>org.apache.maven</groupId>
+                                               <artifactId>maven-plugin-tools-ant</artifactId>
+                                               <version>2.1</version>
+                                       </dependency>
+                               </dependencies>
+                               <configuration>
+                                       <goalPrefix>argeo-pde</goalPrefix>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
\ No newline at end of file
diff --git a/maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.build.xml b/maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.build.xml
new file mode 100644 (file)
index 0000000..29ca2ea
--- /dev/null
@@ -0,0 +1,73 @@
+<project>
+       <property name="projectDirectory" location="${basedir}" />
+       <property name="eclipseAntArgs" value="" />
+       <property name="elementBuildScript" location="${projectDirectory}/build.xml" />
+       <property name="buildTempFolder" location="${projectDirectory}/target/argeo-pde-temp" />
+       <property name="buildScriptProperties" value="" />
+
+       <available file="${projectDirectory}/plugin.xml" property="elementType" value="plugin" />
+       <available file="${projectDirectory}/feature.xml" property="elementType" value="feature" />
+
+       <property name="pluginDestination" location="${projectDirectory}/target/plugins" />
+       <property name="featureDestination" location="${projectDirectory}/target/features" />
+
+       <target name="build" depends="init">
+               <fail message="Property buildScriptTargets has to be set" unless="buildScriptTargets" />
+               <eclipseAnt antfile="${ant.file}" antargs="eclipse.generateScripts" />
+               <eclipseAnt antfile="${elementBuildScript}" antargs="${buildScriptTargets} -Dplugin.destination=${pluginDestination} -Dfeature.destination=${featureDestination} ${buildScriptProperties}" />
+       </target>
+
+       <target name="clean" depends="logContext,clean.elementBuildScript">
+               <delete file="${projectDirectory}/javaCompiler...args" verbose="true" />
+       </target>
+
+       <target name="clean.elementBuildScript" if="elementBuildScript.exists">
+               <ant antfile="${elementBuildScript}" target="clean" />
+               <delete file="${elementBuildScript}" verbose="true" />
+       </target>
+
+       <target name="logContext">
+               <echo message="basedir=${basedir}" />
+               <echo message="ant.file=${ant.file}" />
+               <echo message="projectDirectory=${projectDirectory}" />
+               <echo message="baseLocation=${baseLocation}" />
+               <echo message="elementId=${elementId}" />
+               <echo message="elementBuildScript=${elementBuildScript}" />
+               <echo message="eclipseAntArgs=${eclipseAntArgs}" />
+               <echo message="buildScriptTargets=${buildScriptTargets}" />
+               <echo message="buildScriptProperties=${buildScriptProperties}" />
+
+               <available file="${elementBuildScript}" property="elementBuildScript.exists" value="true" />
+       </target>
+
+       <target name="init" depends="logContext">
+               <mkdir dir="${projectDirectory}/target/plugins" />
+               <mkdir dir="${projectDirectory}/target/features" />
+       </target>
+
+       <!-- TARGETS TO BE CALLED WITH ANT ECLIPSE -->
+       <target name="eclipse.generateScripts">
+               <fail message="Property elementType has to be set" unless="elementType" />
+               <eclipse.buildScript elements="${elementType}@${elementId}" buildDirectory="${projectDirectory}/../.." baseLocation="${baseLocation}" outputUpdateJars="true" generateVersionsLists="true"/>
+       </target>
+
+       <!-- MACRODEFS -->
+       <macrodef name="eclipseAnt">
+               <attribute name="antfile" />
+               <attribute name="antargs" />
+               <sequential>
+                       <java fork="true" classname="org.eclipse.core.launcher.Main" failonerror="true">
+                               <classpath>
+                                       <fileset dir="${baseLocation}/plugins">
+                                               <include name="org.eclipse.equinox.launcher_*.jar" />
+                                       </fileset>
+                               </classpath>
+                               <arg line="-application org.eclipse.ant.core.antRunner" />
+                               <arg line="-buildfile @{antfile}" />
+                               <arg line="-DbaseLocation=${baseLocation} -DprojectDirectory=${projectDirectory} -DelementId=${elementId} -DbuildTempFolder=${buildTempFolder} -Dtemp.folder=${buildTempFolder}/temp.folder -Dfeature.temp.folder=${buildTempFolder}/feature.temp.folder" />
+                               <arg line="${eclipseAntArgs}" />
+                               <arg line="@{antargs}" />
+                       </java>
+               </sequential>
+       </macrodef>
+</project>
\ No newline at end of file
diff --git a/maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.mojos.xml b/maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.mojos.xml
new file mode 100644 (file)
index 0000000..9c35af2
--- /dev/null
@@ -0,0 +1,92 @@
+<pluginMetadata>
+       <mojos>
+               <mojo>
+                       <goal>build</goal>
+                       <call>build</call>
+                       <description>Generate PDE build scripts</description>
+
+                       <requiresProject>true</requiresProject>
+
+                       <parameters>
+                               <parameter>
+                                       <name>baseLocation</name>
+                                       <property>baseLocation</property>
+                                       <required>true</required>
+                                       <expression>${baseLocation}</expression>
+                                       <type>java.lang.String</type>
+                                       <description>The Eclipse base location</description>
+                               </parameter>
+                               <parameter>
+                                       <name>buildScriptTargets</name>
+                                       <property>buildScriptTargets</property>
+                                       <required>true</required>
+                                       <expression>${buildScriptTargets}</expression>
+                                       <defaultValue>
+                                               clean build.jars zip.plugin
+                                       </defaultValue>
+                                       <type>java.lang.String</type>
+                                       <description>
+                                               The targets to execute in the generated build
+                                               script
+                                       </description>
+                               </parameter>
+                               <parameter>
+                                       <name>buildScriptProperties</name>
+                                       <property>buildScriptProperties</property>
+                                       <required>true</required>
+                                       <expression>${buildScriptProperties}</expression>
+                                       <defaultValue></defaultValue>
+                                       <type>java.lang.String</type>
+                                       <description>
+                                               The properties to pass to the generated build
+                                               script
+                                       </description>
+                               </parameter>
+                               <parameter>
+                                       <name>eclipseAntArgs</name>
+                                       <property>eclipseAntArgs</property>
+                                       <expression>${eclipseAntArgs}</expression>
+                                       <defaultValue></defaultValue>
+                                       <type>java.lang.String</type>
+                                       <description>
+                                               Additional args passed to Eclipse Ant (such as
+                                               verbose/debug level)
+                                       </description>
+                               </parameter>
+                               <parameter>
+                                       <name>elementId</name>
+                                       <property>elementId</property>
+                                       <required>true</required>
+                                       <readonly>true</readonly>
+                                       <defaultValue>${project.artifactId}</defaultValue>
+                                       <type>java.lang.String</type>
+                                       <description>
+                                               The artifact id of the project by default, will
+                                               be used as element id.
+                                       </description>
+                               </parameter>
+                       </parameters>
+               </mojo>
+               <mojo>
+                       <goal>clean</goal>
+                       <call>clean</call>
+                       <description>Clean generated artifacts</description>
+
+                       <requiresProject>true</requiresProject>
+                       <parameters>
+                               <parameter>
+                                       <name>elementId</name>
+                                       <property>elementId</property>
+                                       <required>true</required>
+                                       <readonly>true</readonly>
+                                       <defaultValue>${project.artifactId}</defaultValue>
+                                       <type>java.lang.String</type>
+                                       <description>
+                                               The artifact id of the project by default, will
+                                               be used as element id.
+                                       </description>
+                               </parameter>
+                       </parameters>
+               </mojo>
+       </mojos>
+</pluginMetadata>
\ No newline at end of file