git-svn-id: https://svn.coded.pt/svn/SIPRP@1834 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Frederico Palma 12 years ago
parent 57a4760722
commit ad846afa99

@ -17,7 +17,6 @@
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-httpclient-3.1.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-io-1.4.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-lang-2.4.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/commons-lang-2.4.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-validator-1.3.1.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/commons-validator-1.3.1.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/cursos.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/cursos.jar"/>
<classpathentry kind="lib" path="web/WEB-INF/lib/dataprovider.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/dataprovider.jar"/>
@ -73,5 +72,6 @@
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="web/WEB-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

@ -8,8 +8,16 @@
<include name="**/*.java" /> <include name="**/*.java" />
</depend> </depend>
<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" /> <javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" />
<antcall target="create-app-properties-file"/>
<antcall target="app-post-build"/> <antcall target="app-post-build"/>
</target> </target>
<target name="create-app-properties-file">
<propertyfile file="${app.build.dir}/${app.name}.properties">
<entry key="timestamp" type="date" value="now"/>
<entry key="user" value="${user.name}"/>
</propertyfile>
</target>
<target name="run-codegen" description="Runs codegen for this project" depends="load-properties"> <target name="run-codegen" description="Runs codegen for this project" depends="load-properties">
<available file="${codegen.project.ant}" property="codegen.project.exists"/> <available file="${codegen.project.ant}" property="codegen.project.exists"/>

@ -1,29 +1,47 @@
<project name="evo-app-deploy-common" basedir="../../"> <project name="evo-app-deploy-common" basedir="../../" >
<!--xmlns:ac="antlib:net.sf.antcontrib"-->
<import file="evo-app-load-properties.xml" />
<!-- PROPERTIES --> <!-- PROPERTIES -->
<property name="properties.key.name" value="name" /> <property name="properties.key.name" value="name" />
<property name="properties.key.major" value="major" /> <property name="properties.key.major" value="major" />
<property name="properties.key.minor" value="minor" /> <property name="properties.key.minor" value="minor" />
<property name="properties.key.build" value="build" /> <property name="properties.key.build" value="build" />
<path id="lib.dir-jars">
<fileset dir="lib" >
<include name="*.jar"/>
</fileset>
</path>
<!-- SETUP --> <!-- SETUP -->
<target name="prepare-deploy-location"> <target name="prepare-deploy-location">
<sshexec trust="yes" host="${app.deploy.server}" username="${deploy.user}" command="sh ${deploy.prepare.script} ${app.name}" password="${deploy.password}" />
</target> </target>
<target name="run-jnlp-task" > <target name="run-jnlp-task" >
<typedef classpathref="lib.tools.classpath" resource="net/jtools/classloadertask/antlib.xml"> <typedef classpathref="lib.classpath" resource="net/jtools/classloadertask/antlib.xml">
<classpath> <classpath>
<path refid="lib.tools.classpath"/> <path refid="lib.classpath"/>
</classpath> </classpath>
</typedef> </typedef>
<classloader loader="project"> <classloader loader="project">
<classpath> <classpath>
<fileset dir="${lib.tools.dir}" includes="*.jar"/> <fileset dir="${app.lib.dir}" includes="*.jar"/>
</classpath> </classpath>
</classloader> </classloader>
<taskdef name="generate-jnlp" classpathref="lib.tools.classpath" classname="com.evolute.ant.JNLPGeneratorTask" onerror="ignore"/> <taskdef name="generate-jnlp" classpathref="lib.classpath" classname="com.evolute.ant.JNLPGeneratorTask" onerror="ignore"/>
<generate-jnlp propertiesDir="${properties.dir}" basedir="${app.dir}" /> <if>
<isset property="TESTDEPLOY"/>
<then>
<generate-jnlp propertiesDir="${properties.dir}" basedir="${app.dir}" production="false"/>
</then>
<else>
<generate-jnlp propertiesDir="${properties.dir}" basedir="${app.dir}" production="true"/>
</else>
</if>
<antcall target="send-jnlp"/>
</target> </target>
<!-- DEPLOY --> <!-- DEPLOY -->
@ -38,10 +56,15 @@
</input> </input>
</target> </target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib.tools/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="ask-deploy.jars" unless="deploy.jars"> <target name="ask-deploy.jars" unless="deploy.jars">
<input defaultvalue="${basedir}:${app.appName}" addproperty="deploy.jars"> <property name="deploy.jars" refid="lib.dir-jars"/>
<handler classpathref="lib.tools.classpath" classname="com.evolute.ant.JarInputHandler" /> <var name="deploy.jars" value="${basedir}/${app.appName}.jar:${deploy.jars} "/>
</input>
</target> </target>
<target name="ask-deploy.user" unless="deploy.user"> <target name="ask-deploy.user" unless="deploy.user">
@ -60,6 +83,7 @@
<antcall target="app-deploy-create-jar"/> <antcall target="app-deploy-create-jar"/>
<antcall target="pre-deploy" /> <antcall target="pre-deploy" />
<antcall target="run-jnlp-task" /> <antcall target="run-jnlp-task" />
<antcall target="update-jar-jnlp"/>
<condition property="do.abort"> <condition property="do.abort">
<equals arg1="${deploy.jars}" arg2="null"/> <equals arg1="${deploy.jars}" arg2="null"/>
</condition> </condition>
@ -67,6 +91,39 @@
<antcall target="app-deploy-version-jars"/> <antcall target="app-deploy-version-jars"/>
</target> </target>
<!--<scriptdef language="javascript" name="upper">
<attribute name="string" />
<attribute name="to" />
project.setProperty( attributes.get( "to" ),
attributes.get( "string" ).toUpperCase() );
</scriptdef>-->
<target name="update-jar-jnlp">
<mkdir dir="${app.build.dir}/JNLP-INF"/>
<!--<upper string="${app.name}" to="app.name.upper"/>-->
<!--<echo message="olha auqui o nome em maiusculas ${app.name.upper}"></echo>-->
<if>
<isset property="TESTDEPLOY"/>
<then>
<copy file="${basedir}/jnlp/test/${app.name}.jnlp" tofile="${app.build.dir}/JNLP-INF/APPLICATION.JNLP"/>
</then>
<else>
<copy file="${basedir}/jnlp/production/${app.name}.jnlp" tofile="${app.build.dir}/JNLP-INF/APPLICATION.JNLP"/>
</else>
</if>
<jar destfile="${app.deploy.dist.dir}/${app.jar.name}" update="true" >
<fileset dir="${app.build.dir}">
<include name="**/*" />
</fileset>
</jar>
<copy todir="${app.deploy.dist.lib.dir}">
<fileset dir="${app.lib.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="app-version-increase-test"> <target name="app-version-increase-test">
<property name="TESTDEPLOY" value="yes"/> <property name="TESTDEPLOY" value="yes"/>
<antcall target="app-version-increase-build"/> <antcall target="app-version-increase-build"/>
@ -75,9 +132,9 @@
<target name="app-version-increase-major"> <target name="app-version-increase-major">
<propertyfile file="${app.version.file}" comment="${app.version.comment}" > <propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/> <entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="1"/> <entry key="${properties.key.major}" type="int" operation="+" value="1" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="=" value="0"/> <entry key="${properties.key.minor}" type="int" operation="=" value="0" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="=" value="0"/> <entry key="${properties.key.build}" type="int" operation="=" value="0" pattern="0" />
</propertyfile> </propertyfile>
<antcall target="app-deploy-version"/> <antcall target="app-deploy-version"/>
</target> </target>
@ -85,42 +142,691 @@
<target name="app-version-increase-minor"> <target name="app-version-increase-minor">
<propertyfile file="${app.version.file}" comment="${app.version.comment}" > <propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/> <entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="0"/> <entry key="${properties.key.major}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="+" value="1"/> <entry key="${properties.key.minor}" type="int" operation="+" value="1" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="=" value="0"/> <entry key="${properties.key.build}" type="int" operation="=" value="0" pattern="0" />
</propertyfile> </propertyfile>
<antcall target="app-deploy-version"/> <antcall target="app-deploy-version"/>
</target> </target>
<target name="app-version-increase-build"> <target name="app-version-increase-build">
<exec executable="hostname" outputproperty="computer.hostname"/>
<propertyfile file="${app.version.file}" comment="${app.version.comment}" > <propertyfile file="${app.version.file}" comment="${app.version.comment}" >
<entry key="${properties.key.name}" value="${app.name}"/> <entry key="${properties.key.name}" value="${app.name}"/>
<entry key="${properties.key.major}" type="int" operation="+" value="0"/> <entry key="${properties.key.major}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.minor}" type="int" operation="+" value="0"/> <entry key="${properties.key.minor}" type="int" operation="+" value="0" pattern="0" />
<entry key="${properties.key.build}" type="int" operation="+" value="1"/> <entry key="${properties.key.build}" type="int" operation="+" value="1" pattern="0" />
<entry key="timestamp" type="date" value="now"/>
<entry key="user" value="${user.name}"/>
<entry key="computer" value="${computer.hostname}"/>
</propertyfile> </propertyfile>
<antcall target="app-deploy-version"/> <antcall target="app-deploy-version"/>
</target> </target>
<target name="deploy-test" if="TESTDEPLOY"> <target name="deploy-test" if="TESTDEPLOY">
<sshexec trust="yes" host="${app.deploy.server}" username="${deploy.user}" command="sh ${app.deploy.test.script} ${app.name}" password="${deploy.password}" />
</target> </target>
<target name="deploy-production" unless="TESTDEPLOY"> <!-- NEW -->
<path id="lib.classpath">
<fileset dir="${app.lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="send-jnlp">
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="mkdir -p /home/software/public_html/versoes_teste/${app.appName}/lib" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="mkdir -p /home/software/public_html/${app.appName}/lib" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
<if>
<isset property="TESTDEPLOY"/>
<then>
<if>
<available file="${basedir}/jnlp/test" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/test" includes="*.jnlp"/>
</scp>
</then>
</if>
<if>
<available file="${basedir}/jnlp/extensions/test" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/extensions/test" includes="*.jnlp"/>
</scp>
</then>
</if>
</then>
<else>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/production" includes="*.jnlp"/>
</scp>
<if>
<available file="${basedir}/jnlp/extensions/production" type="dir"/>
<then>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/jnlp/extensions/production" includes="*.jnlp"/>
</scp>
</then>
</if>
</else>
</if>
</target>
<!-- CORRER INICIALMENTE -->
<path id="pack.dir-jars">
<fileset dir="signed/packed" >
<include name="lib/*.jar*"/>
<include name="${app.jar.name}*"/>
</fileset>
</path>
<target name="inicial">
<echo message="Jars: ${deploy.jars}"/>
<delete dir="signed"/>
<mkdir dir="signed/lib"/>
<mkdir dir="signed/packed/lib"/>
<property name="unsigned.jars" value=""/>
<property name="signed.jars" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<exec dir="deploy/lib" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar is unsigned"/>
<then>
<var name="unsigned.jars" value="${unsigned.jars} @{jar}"/>
</then>
<else>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="signed.jars" value="${signed.jars} @{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="unsigned: ${unsigned.jars}"/>
<echo message="Signed jars = ${signed.jars}"/>
<echo message="Repacking..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<apply executable="pack200" parallel="false" failonerror="false">
<arg value="--repack"/>
<arg value="--segment-limit=-1"/>
<fileset file="@{jar}" />
</apply>
</sequential>
</for>
<echo message=" home = ${user.home}"/>
<echo message="Signing..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset file="@{jar}" />
</path>
</signjar>
</sequential>
</for>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset dir="deploy" includes="${app.name}.jar" />
</path>
</signjar>
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} @{jar}"/>
</sequential>
</for>
<for list="${deploy.jars.copy}" param="jar" delimiter=" ">
<sequential>
<delete file="@{jar}.pack.gz"/>
</sequential>
</for>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<echo message="Packing..."/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<apply executable="pack200" parallel="false" dest="signed/packed/lib" failonerror="false">
<arg value="--segment-limit=-1"/>
<targetfile/>
<srcfile/>
<fileset file="@{jar}" />
<mapper type="glob" from="*" to="*.pack.gz" />
</apply>
</sequential>
</for>
</then>
</if>
<for list="${signed.jars}" param="jar" delimiter=" ">
<sequential>
<echo message="@{jar}"/>
<copy failonerror="false" verbose="true" overwrite="true" toDir="signed/lib" >
<fileset file="@{jar}"/>
</copy>
</sequential>
</for>
<property name="pack.jars" refid="pack.dir-jars"/>
<echo message="Pack jars = ${pack.jars}"/>
<property name="pack.jars.copy" value=""/>
<for list="${pack.jars}" param="jar" delimiter=":">
<sequential>
<var name="pack.jars.copy" value="${pack.jars.copy} @{jar}"/>
</sequential>
</for>
<echo message="Pack jars = ${pack.jars.copy}"/>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} ${pack.jars.copy} inicial"/>
</java>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="isto é um teste"/>
<echo message="other jars = ${other.jars}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="${deploy.jars}"/>
</scp>
</then>
<else>
<echo message="other jars = ${other.jars}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="**/*.jar"/>
</scp>
</else>
</if>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="**/*.pack.gz"/>
</scp>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
<delete file="signed/${app.appName}.jar"/>
<delete file="signed/packed/${app.appName}.jar.pack.gz"/>
</target>
<!-- FIM CORRER INICIALMENTE -->
<target name="deploy-production">
<echo message="Deploying to ${deploy.user}@${app.deploy.server}"/> <echo message="Deploying to ${deploy.user}@${app.deploy.server}"/>
<sshexec failonerror="true" trust="yes" host="${app.deploy.server}" username="${deploy.user}" command="sh ${app.deploy.production.script} ${app.name}" password="${deploy.password}" /> <if>
<available file="${basedir}/clientJars.xml" type="file"/>
<then>
<xmlproperty file="clientJars.xml"/>
<if>
<not>
<isset property="project.signed-jar-files.name"/>
</not>
<then>
<antcall target="inicial"/>
</then>
<else>
<antcall target="create-new-xml-client-jar"/>
<antcall target="delete-principal-jar"/>
</else>
</if>
</then>
<else>
<antcall target="inicial"/>
</else>
</if>
</target>
<target name="create-new-xml-client-jar">
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} @{jar}"/>
</sequential>
</for>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} novo"/>
</java>
</target> </target>
<target name="recognize-xml-2">
<xmlproperty file="clientJars.xml"/>
<xmlproperty file="newClientJars.xml"/>
</target>
<target name="compare-old-and-current-2" depends="recognize-xml-2">
<property name="different.jars" value=" "/>
<property name="toDeploy.packed" value=" "/>
<echo message="project.jar-files = ${project.jar-files.name}"/>
<echo message="project.new-jar-files = ${project.new-jar-files.name}"/>
<for list="${project.new-jar-files.name}" param="jar">
<sequential>
<if>
<and>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<not>
<available file="${basedir}/signed/packed/${project.new-jar-files.name(@{jar}-path)}@{jar}.pack.gz" type="file"/>
</not>
<not>
<contains string="${signed.jars}" substring="@{jar}"/>
</not>
</and>
<then>
<var name="toDeploy.packed" value="${toDeploy.packed} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
<if>
<not>
<available file="${basedir}/signed/${project.new-jar-files.name(@{jar}-path)}@{jar}" type="file"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
<else>
<for list="${project.jar-files.name}" param="oldJar">
<sequential>
<if>
<equals arg1="@{jar}" arg2="@{oldJar}"/>
<then>
<property name="@{jar}-name-exists" value=""/>
<if>
<not>
<equals arg1="${project.jar-files.name(@{jar}-md5)}" arg2="${project.new-jar-files.name(@{oldJar}-md5)}"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</then>
</if>
</sequential>
</for>
<if>
<not>
<isset property="@{jar}-name-exists"/>
</not>
<then>
<var name="different.jars" value="${different.jars} ${project.new-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="different jars = ${different.jars}"/>
</target>
<target name="check-if-is-signed" depends="compare-old-and-current-2">
<property name="unsigned.jars" value=""/>
<property name="signed.jars" value=""/>
<for list="${different.jars}" param="jar" delimiter=" ">
<sequential>
<exec dir="deploy" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar is unsigned"/>
<then>
<var name="unsigned.jars" value="${unsigned.jars} @{jar}"/>
</then>
<else>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="signed.jars" value="${signed.jars} @{jar}"/>
</then>
</if>
</else>
</if>
</sequential>
</for>
<echo message="unsigned: ${unsigned.jars}"/>
<echo message="Signed jars = ${signed.jars}"/>
</target>
<target name="repack-jars" depends="check-if-is-signed">
<apply executable="pack200" parallel="false" failonerror="false">
<arg value="--repack"/>
<arg value="--segment-limit=-1"/>
<fileset dir="deploy" includes="${unsigned.jars}" />
</apply>
</target>
<target name="sign-jars-2" depends="repack-jars">
<echo message="Signing jars..."/>
<mkdir dir="signed/lib"/>
<mkdir dir="signed/packed/lib"/>
<signjar destDir="signed" alias="id evolute, consultoria informática do comodo ca limited" storetype="pkcs12" keystore="ant/evolute.keystore" storepass="Typein" >
<path>
<fileset dir="deploy" includes="${unsigned.jars}" />
</path>
</signjar>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<delete file="${basedir}/signed/packed/@{jar}.pack.gz"/>
</sequential>
</for>
</target>
<target name="copy-signed" depends="sign-jars-2">
<if>
<contains string="${signed.jars}" substring=" "/>
<then>
<copy failonerror="false" verbose="true" overwrite="true" toDir="signed" >
<fileset dir="deploy" includes="${signed.jars}"/>
</copy>
</then>
</if>
</target>
<target name="pack-jars-2" depends="copy-signed">
<echo message="Unsigned: ${unsigned.jars} "/>
<for list="${unsigned.jars}" param="jar" delimiter=" ">
<sequential>
<if>
<not>
<contains string="${toDeploy.packed}" substring="@{jar}"/>
</not>
<then>
<var name="toDeploy.packed" value="${toDeploy.packed} @{jar}"/>
</then>
</if>
</sequential>
</for>
<property name="toDeploy.packed.copy" value=""/>
<property name="deploy.signed" value=""/>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<exec dir="deploy/lib" command="jarsigner" outputproperty="@{jar}.verify">
<arg line="-verify"/>
<arg line="@{jar}"/>
</exec>
<if>
<contains string="${@{jar}.verify}" substring="jar verified"/>
<then>
<var name="deploy.signed" value="${deploy.signed} @{jar}"/>
</then>
</if>
</sequential>
</for>
</then>
</if>
<for list="${toDeploy.packed}" param="jar" delimiter=" ">
<sequential>
<if>
<not>
<contains string="${deploy.signed}" substring="@{jar}"/>
</not>
<then>
<var name="toDeploy.packed.copy" value="${toDeploy.packed.copy} @{jar}"/>
</then>
</if>
</sequential>
</for>
<if>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
<then>
<echo message="Packing jars..."/>
<echo message="toDeploy.packed.copy = ${toDeploy.packed.copy}"/>
<apply executable="pack200" parallel="false" dest="signed/packed" failonerror="false">
<arg value="--modification-time=latest"/>
<arg value="--deflate-hint=true"/>
<arg value="--segment-limit=-1"/>
<targetfile/>
<srcfile/>
<fileset dir="signed" includes="${toDeploy.packed.copy}" />
<mapper type="glob" from="*" to="*.pack.gz" />
</apply>
</then>
</if>
</target>
<target name="alter-client-jar-xml" depends="pack-jars-2">
<property name="deploy.jars.copy" value=""/>
<for list="${deploy.jars}" param="jar" delimiter=":">
<sequential>
<var name="deploy.jars.copy" value="${deploy.jars.copy} @{jar}"/>
</sequential>
</for>
<property name="pack.jars" refid="pack.dir-jars"/>
<echo message="Pack jars = ${pack.jars}"/>
<property name="pack.jars.copy" value=""/>
<for list="${pack.jars}" param="jar" delimiter=":">
<sequential>
<var name="pack.jars.copy" value="${pack.jars.copy} @{jar}"/>
</sequential>
</for>
<echo message="Deploy jars = ${deploy.jars.copy}"/>
<echo message="Pack jars = ${pack.jars.copy}"/>
<java fork="true" failonerror="yes" classname="com.evolute.xml.BuildXML" classpathref="lib.tools.classpath">
<arg line="${basedir} ${deploy.jars.copy} ${pack.jars.copy} inicial"/>
</java>
</target>
<target name="verify-jars-at-server-2" depends="alter-client-jar-xml">
<echo message="nome da aplicacao = ${app.name}"/>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec verbose="false" failonerror="true" trust="yes" host="${app.deploy.server}" username="${deploy.user}" command='find /home/software/public_html/versoes_teste/${app.name} -name "*.jar*" -exec md5sum {} +' password="${deploy.password}" output="jarsAtServer.txt" outputproperty="trash" />
<java fork="true" failonerror="yes" classname="com.evolute.xml.ServerJarsXml" classpathref="lib.tools.classpath">
<arg line="versoes_teste/${app.appName}"/>
</java>
</then>
<else>
<sshexec verbose="false" failonerror="true" trust="yes" host="${app.deploy.server}" username="${deploy.user}" command='find /home/software/public_html/${app.name} -name "*.jar*" -exec md5sum {} +' password="${deploy.password}" output="jarsAtServer.txt" outputproperty="trash" />
<java fork="true" failonerror="yes" classname="com.evolute.xml.ServerJarsXml" classpathref="lib.tools.classpath">
<arg line="${app.appName}"/>
</java>
</else>
</if>
<xmlproperty file="currentServerJars.xml"/>
</target>
<target name="compare-client-and-server-jars" depends="verify-jars-at-server-2">
<xmlproperty file="clientJars.xml" prefix="new"/>
<xmlproperty file="currentServerJars.xml"/>
<property name="toDeploy.jars" value=""/>
<for list="${new.project.signed-jar-files.name}" param="jar">
<sequential>
<for list="${current-server-jar-files.name}" param="currJar">
<sequential>
<if>
<and>
<equals arg1="@{jar}" arg2="@{currJar}"/>
<equals arg1="${new.project.signed-jar-files.name(@{jar}-md5)}" arg2="${current-server-jar-files.name(@{currJar}-md5)}"/>
</and>
<then>
<property name="@{jar}-exists-on-server" value=""/>
</then>
</if>
</sequential>
</for>
<if>
<not>
<isset property="@{jar}-exists-on-server"/>
</not>
<then>
<var name="toDeploy.jars" value="${toDeploy.jars} ${new.project.signed-jar-files.name(@{jar}-path)}@{jar}"/>
</then>
</if>
</sequential>
</for>
<echo message="toDeploy.jars = ${toDeploy.jars}"/>
</target>
<target name="send-jars-to-server-2" depends="compare-client-and-server-jars">
<echo message="Jars to deploy: ${toDeploy.jars}"/>
<for list="${toDeploy.jars}" param="jar" delimiter=" ">
<sequential>
<if>
<and>
<contains string="@{jar}" substring=".pack.gz"/>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
</and>
<then>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="@{jar}"/>
</scp>
</then>
<else>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed/packed" includes="@{jar}"/>
</scp>
</else>
</if>
</then>
<else>
<if>
<and>
<not>
<contains string="@{jar}" substring=".pack.gz"/>
</not>
<not>
<equals arg1="${jnlp.resources.property.jnlp.packEnabled}" arg2="true"/>
</not>
</and>
<then>
<if>
<isset property="TESTDEPLOY"/>
<then>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/versoes_teste/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="@{jar}"/>
</scp>
</then>
<else>
<echo message="scp @{jar} ${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}"/>
<scp todir="${deploy.user}@${app.deploy.server}:/home/software/public_html/${app.appName}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${basedir}/signed" includes="@{jar}"/>
</scp>
</else>
</if>
</then>
</if>
</else>
</if>
</sequential>
</for>
<if>
<isset property="TESTDEPLOY"/>
<then>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/versoes_teste/${app.appName}; true" password="${deploy.password}" />
</then>
<else>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chmod -R -f g+w /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="chown -R -f :software /home/software/public_html/${app.appName}; true" password="${deploy.password}" />
</else>
</if>
</target>
<target name="delete-principal-jar" depends="send-jars-to-server-2">
<delete file="signed/${app.appName}.jar"/>
<delete file="signed/packed/${app.appName}.jar.pack.gz"/>
<delete file="currentServerJars.xml"/>
<delete file="jarsAtServer.txt"/>
<delete file="newClientJars.xml"/>
</target>
<!-- END NEW -->
<!-- TEST PROJECT -->
<target name="test-project">
<property file="script.properties"/>
<echo message="${svn_repo} ${user} ${pass} ${target} ${build}"/>
<antcall target="app-create-jar"/>
</target>
<target name="deploy-project-script">
<property file="script.properties"/>
<antcall target="app-deploy"/>
</target>
<!-- END TEST PROJECT -->
<target name="app-deploy-version-jars-user-pass" if="deploy.password"> <target name="app-deploy-version-jars-user-pass" if="deploy.password">
<antcall target="prepare-deploy-location" /> <antcall target="prepare-deploy-location" />
<echo message="Uploading files: ${deploy.jars}"/> <echo message="Uploading files: ${deploy.jars}"/>
<scp verbose="yes" todir="${deploy.user}@${app.deploy.server}:${app.deploy.path}" password="${deploy.password}" sftp="true" trust="true" > <scp todir="${deploy.user}@${app.deploy.server}:${app.deploy.path}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${app.deploy.dist.dir}" includes="${deploy.jars}"/> <fileset dir="${app.deploy.dist.dir}" includes="${deploy.jars}"/>
</scp> </scp>
<echo message="Uploading jnlps"/> <echo message="Uploading jnlps"/>
<scp verbose="yes" todir="${deploy.user}@${app.deploy.server}:${app.deploy.jnlp.path}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${jnlp.dir}" includes="**/*.jnlp"/>
</scp>
<antcall target="deploy-test"/> <antcall target="deploy-test"/>
<antcall target="deploy-production"/> <antcall target="deploy-production"/>
</target> </target>
@ -156,7 +862,6 @@
</classpath> </classpath>
</classloader> </classloader>
<taskdef name="createTask" classpathref="lib.tools.classpath" classname="com.evolute.ant.CreateSoftwareAntTask" onerror="ignore"/> <taskdef name="createTask" classpathref="lib.tools.classpath" classname="com.evolute.ant.CreateSoftwareAntTask" onerror="ignore"/>
<createTask projectVersion="${version.major}.${version.minor}.${version.build}" projectName="${app.name}" /> <createTask projectVersion="${version.major}.${version.minor}.${version.build}" projectName="${app.name}" />
</target> </target>
@ -187,7 +892,7 @@
</classpath> </classpath>
</classloader> </classloader>
<sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="sh ${app.docs.prepare.script} ${app.name}" password="${deploy.password}" /> <sshexec trust="yes" host="${app.deploy.docs.server}" username="${deploy.user}" command="sh ${app.docs.prepare.script} ${app.name}" password="${deploy.password}" />
<scp verbose="yes" todir="${deploy.user}@${app.deploy.docs.server}:${app.deploy.docs.path}" password="${deploy.password}" sftp="true" trust="true" > <scp todir="${deploy.user}@${app.deploy.docs.server}:${app.deploy.docs.path}" password="${deploy.password}" sftp="true" trust="true" >
<fileset dir="${docs.dir}"/> <fileset dir="${docs.dir}"/>
</scp> </scp>
</target> </target>

@ -36,7 +36,6 @@
<path id="app.build.classpath"> <path id="app.build.classpath">
<pathelement location="${app.build.dir}" /> <pathelement location="${app.build.dir}" />
<path refid="app.jar.classpath" /> <path refid="app.jar.classpath" />
<path refid="lib.tools.classpath" />
</path> </path>
<path id="lib.docs.classpath"> <path id="lib.docs.classpath">
@ -86,4 +85,4 @@
<property name="deployer.main" value="com.evolute.deploy.Main" /> <property name="deployer.main" value="com.evolute.deploy.Main" />
</target> </target>
</project> </project>

@ -46,17 +46,17 @@
<include name="**/*.java" /> <include name="**/*.java" />
</depend> </depend>
<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" source="1.5" target="1.5" /> <javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" source="1.5" target="1.5" />
<antcall target="app-datanucleus"/> <!-- <antcall target="app-datanucleus"/>-->
</target> </target>
<target name="app-datanucleus"> <!-- <target name="app-datanucleus">
<path id="jpox.enhancer.classpath"> <path id="jpox.enhancer.classpath">
<fileset dir="${lib.tools.dir}" /> <fileset dir="${lib.tools.dir}" />
<path refid="app.build.classpath" /> <path refid="app.build.classpath" />
</path> </path>
<taskdef name="jpoxEnhancer" description="JPOX Enhancer" classpathref="jpox.enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" /> <taskdef name="jpoxEnhancer" description="JPOX Enhancer" classpathref="jpox.enhancer.classpath" classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<jpoxEnhancer maxmemory="256M" classpathref="jpox.enhancer.classpath" dir="${app.build.dir}" verbose="true"/> <jpoxEnhancer maxmemory="256M" classpathref="jpox.enhancer.classpath" dir="${app.build.dir}" verbose="true"/>
</target> </target>-->
<target name="app-clean" description="Removes all generated files"> <target name="app-clean" description="Removes all generated files">
<delete failonerror="false"> <delete failonerror="false">

@ -10,16 +10,17 @@ server.siprp = localhost
port.siprp = 5436 port.siprp = 5436
database.siprp = siprp database.siprp = siprp
username.siprp = postgres username.siprp = postgres
#password.siprp = password.siprp = dummy
server.siprp_local = localhost server.siprp_local = localhost
port.siprp_local = 5436 port.siprp_local = 5436
database.siprp_local = siprp_local_3 database.siprp_local = siprp_local_3
username.siprp_local = postgres username.siprp_local = postgres
#password.siprp_local = password.siprp_local = dummy
debug = false debug = false
run_license_module=false
# tests # tests
#server.siprp = localhost #server.siprp = localhost

@ -0,0 +1,2 @@
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

@ -37,8 +37,8 @@ public class PlanosActuacaoLogger
// EvoProxyObject.configSystemProxySelector(); // EvoProxyObject.configSystemProxySelector();
// EvoProxyObject.getProxy( user, pass, host, port ); // EvoProxyObject.getProxy( user, pass, host, port );
Logger logger = new WSLogger( properties ); // Logger logger = new WSLogger( properties );
ErrorLogger.initializeLogger( logger ); // ErrorLogger.initializeLogger( logger );
} }
} }

Loading…
Cancel
Save