<?xml version="1.0" encoding="ISO-8859-1"?>
-<project name="XEMELIOS-generator-pes-pjs" default="jars" basedir=".">
- <import file="../../common-tasks.xml"/>
- <description>Builds, tests the plugin generator-pes-pj</description>
+<project name="XEMELIOS-generator-pes-pj" default="usage" basedir=".">
+ <description>Upload component to XeMeLios Update site</description>
<property file="${user.home}/.ant.properties"/>
- <property name="compile.debug" value="true"/>
- <xmlproperty file="component-definition-properties.xml"/>
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <property name="upload-target" value="/var/lib/gforge/chroot/home/groups/xemelios/www/updatesV5"/>
<target name="usage">
<echo>
</echo>
</target>
- <target name="compile" depends="mk-output-dirs,define-compile-debug,prepare">
- <javac srcdir="java" destdir="build/classes" debug="${compile.debug}" encoding="ISO-8859-1">
- <classpath>
- <pathelement path="../api-plugin/build/classes"/>
- <pathelement path="../core/build/classes"/>
- <pathelement path="../starter/build/classes"/>
- <pathelement path="../xml-marshall/build/classes"/>
- <fileset dir="../core/lib" includes="*.jar"/>
- <fileset dir="../swing-utils/lib" includes="*.jar"/>
- </classpath>
- </javac>
- <copy todir="build/classes">
- <fileset dir="java">
- <include name="**/*"/>
- <exclude name="**/*.java"/>
- </fileset>
- </copy>
- </target>
-
- <target name="jars">
- <copy file="manifest/manifest.txt" tofile="build/manifest.txt">
- <filterset>
- <filter token="version" value="${component.release}"/>
- <filter token="name" value="${component.name}"/>
- </filterset>
- </copy>
- <jar destfile="build/jars/${component.name}.jar" basedir="build/classes" manifest="build/manifest.txt"/>
- </target>
-
<target name="config" depends="get-configuration,prepare">
<property name="component.dir" value="build/config/source/${component.name}/${component.release}"/>
- <copy file="component-definition-properties.xml" tofile="build/config/source/component-definition-properties.xml"/>
+ <copy file="publication/component-definition-properties.xml" tofile="build/config/source/component-definition-properties.xml"/>
<mkdir dir="${component.dir}"/>
<copy todir="${component.dir}">
- <fileset dir="build/jars" includes="*.jar"/>
- </copy>
- <!--antcall target="prepare-config-metier"/-->
- <antcall target="generate-update"/>
- </target>
-
- <target name="setup">
- <copy todir="../../build/setup/root/tools">
- <fileset dir="build/jars" includes="*.jar"/>
+ <fileset dir="generator-ui/target" includes="pes-pj-generator-generator-ui.jar"/>
</copy>
+ <antcall target="generate-update"/>
+ </target>
+
+ <target name="generate-update">
+ <java classname="fr.gouv.finances.cp.buildtools.Gen">
+ <classpath>
+ <fileset dir="./publication" includes="*.jar"/>
+ <fileset dir="${user.home}/.m2/repository/xerces/xercesImpl/2.6.2/" includes="xercesImpl-2.6.2.jar"/>
+ </classpath>
+ <arg value="build/config/source"/>
+ <arg value="build/config/deploy"/>
+ <arg value="${configuration}"/>
+ </java>
+ <xmlvalidate file="build/config/deploy/${component.name}/${configuration}/update.xml"
+ lenient="true" failonerror="true" warn="true">
+ <attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
+ <attribute name="http://xml.org/sax/features/namespaces" value="true"/>
+ <!-- le schema doit etre donné en relatif par rapport au fichier xml -->
+ <property
+ name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
+ value="../../../../../publication/update.xsd"/>
+ </xmlvalidate>
</target>
-
+ <target name="upload" depends="prepare,get-configuration">
+ <!-- on check les dependances. Pour le moment, on le fait pas -->
+ <!--java classname="fr.gouv.finances.cp.buildtools.DependencyChecker" dir="." fork="true" failonerror="true">
+ <classpath>
+ <fileset dir="publication" includes="*.jar"/>
+ <pathelement path="../core/lib/saxon9he.jar"/>
+ <pathelement path="../core/build/classes"/>
+ </classpath>
+ <arg value="build/config/deploy/${component.name}/${configuration}/update.xml"/>
+ <arg value="${configuration}"/>
+ </java -->
+ <!-- on upload -->
+ <scp
+ todir="${adullact.user.name}:${adullact.user.passwd}@projets.adullact.net:${upload-target}"
+ sftp="true" trust="true">
+ <fileset dir="build/config/deploy">
+ <include name="**/*"/>
+ <exclude name="**/component.properties"/>
+ <exclude name="**/update.xml"/>
+ </fileset>
+ </scp>
+ <!-- on rétablit les droits sur les fichiers uploadés -->
+ <sshexec
+ host="projets.adullact.net" username="${adullact.user.name}" password="${adullact.user.passwd}"
+ command="cd ${upload-target}; chown -R $USER:xemelios *; chmod -R g+wx *; exit;"
+ failonerror="false" trust="true"/>
+ <!-- on vérifié l'upload -->
+ <mkdir dir="build/check"/>
+ <java classname="fr.gouv.finances.cp.buildtools.UploadChecker" fork="true" failonerror="true" dir="." >
+ <classpath>
+ <fileset dir="publication" includes="*.jar"/>
+ <!--pathelement path="../core/lib/saxon9he.jar"/>
+ <pathelement path="../core/build/classes"/ -->
+ </classpath>
+ <arg value="build/config/deploy/${component.name}/${configuration}/update.xml"/>
+ <arg value="build/check"/>
+ </java>
+ <delete dir="build/check"/>
+ <!-- on upload le update.xml -->
+ <move file="build/config/deploy/${component.name}/${configuration}/update.xml" tofile="build/config/deploy/${component.name}/${configuration}/update-origin.xml"/>
+ <trycatch property="error.msg">
+ <try>
+ <get src="${component.url}/${configuration}/update.xml" dest="build/config/update-remote.xml"/>
+ <pathconvert property="remote.file">
+ <path>
+ <pathelement location="build/config/update-remote.xml"/>
+ </path>
+ </pathconvert>
+ <xslt processor="trax" style="publication/update-merger.xsl" in="build/config/deploy/${component.name}/${configuration}/update-origin.xml" out="build/config/deploy/${component.name}/${configuration}/update.xml">
+ <param name="remote.file" expression="${remote.file}"/>
+ <factory name="net.sf.saxon.TransformerFactoryImpl"/>
+ </xslt>
+ </try>
+ <catch>
+ <echo>il n'existait pas de version publiée, on publie la première</echo>
+ <copy file="build/config/deploy/${component.name}/${configuration}/update-origin.xml" tofile="build/config/deploy/${component.name}/${configuration}/update.xml"/>
+ </catch>
+ </trycatch>
+ <echo>${error.msg}</echo>
+ <delete file="build/config/deploy/${component.name}/${configuration}/update-origin.xml"/>
+ <scp
+ todir="${adullact.user.name}:${adullact.user.passwd}@projets.adullact.net:${upload-target}"
+ sftp="true" trust="true">
+ <fileset dir="build/config/deploy">
+ <include name="**/update.xml"/>
+ </fileset>
+ </scp>
+ </target>
+
<target name="clean">
<delete dir="build"/>
</target>
<mkdir dir="build/jars"/>
<mkdir dir="build/config"/>
</target>
+
+ <target name="prepare">
+ <xmlproperty file="./publication/component-definition-properties.xml"/>
+ </target>
+ <target name="get-configuration" unless="configuration">
+ <input addproperty="configuration" defaultvalue="PRIVATE" description="Pour quelle configuration générez-vous ?" validargs="PRODUCTION,RECETTE,PRIVATE"/>
+ </target>
+
</project>