java/nekurak.net-web/nbproject/ant-deploy.xml
author František Kučera <franta-hg@frantovo.cz>
Sun Jun 20 14:46:47 2010 +0200 (2010-06-20)
changeset 145 0efefbf5f8b6
parent 6 e6581bb3c4a3
child 186 b0f7d9ab4a07
permissions -rw-r--r--
Formátování kódu, důsledné používání tabulátorů, drobné úpravy, StringBuilder
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <project default="-deploy-ant" basedir=".">
     3     <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
     4         <property file="${deploy.ant.properties.file}" />
     5         <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
     6         <available file="${deploy.ant.resource.dir}" property="has.setup"/>
     7         <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
     8         <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
     9     </target>
    10     
    11     <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
    12         <tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
    13         <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
    14         <!-- The doctype triggers resolution which can fail -->
    15         <replace file="${temp.sun.web}">
    16             <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
    17             <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
    18         </replace>
    19         <replace file="${temp.sun.web}">
    20             <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
    21             <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
    22         </replace>
    23         <xmlproperty file="${temp.sun.web}" validate="false">
    24         </xmlproperty>    
    25         <delete file="${temp.sun.web}"/>
    26         <property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
    27         <property name="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}"/>
    28     </target>
    29     <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
    30         <property name="deploy.context.root.argument" value=""/>
    31     </target>
    32     <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
    33         <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
    34         <mkdir dir="${gfv3.resources.dir}"/>
    35         <mkdir dir="${gfv3.resources.dir}/META-INF"/>
    36         <property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
    37         <copy todir="${gfv3.resources.dir}/META-INF">
    38             <fileset dir="${deploy.ant.resource.dir}"/>
    39         </copy>
    40         <jar destfile="${deploy.ant.archive}" update="true">
    41             <fileset dir="${gfv3.resources.dir}"/>
    42         </jar>
    43         <delete dir="${gfv3.resources.dir}"/>
    44     </target>
    45     <target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
    46         <antcall target="-deploy-without-pw"/>
    47         <antcall target="-deploy-with-pw"/>
    48     </target>
    49 
    50     <target name="-deploy-without-pw" unless="gfv3.password">
    51         <echo message="Deploying ${deploy.ant.archive}"/>
    52         <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    53         <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
    54         <get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
    55             dest="${gfv3.results.file}"/>
    56         <delete file="${gfv3.results.file}"/>    
    57     </target>
    58     <target name="-deploy-with-pw" if="gfv3.password">
    59         <echo message="Deploying ${deploy.ant.archive}"/>
    60         <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    61         <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
    62         <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
    63             dest="${gfv3.results.file}"/>
    64         <delete file="${gfv3.results.file}"/>
    65     </target>
    66     <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
    67         <antcall target="-undeploy-without-pw"/>
    68         <antcall target="-undeploy-with-pw"/>
    69     </target>
    70 
    71     <target name="-undeploy-without-pw" unless="gfv3.password">
    72         <echo message="Undeploying ${deploy.ant.archive}"/>
    73         <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    74         <get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
    75             dest="${gfv3.results.file}"/>
    76         <delete file="${gfv3.results.file}"/>    
    77     </target>
    78     <target name="-undeploy-with-pw" if="gfv3.password">
    79         <echo message="Undeploying ${deploy.ant.archive}"/>
    80         <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
    81         <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
    82             dest="${gfv3.results.file}"/>
    83         <delete file="${gfv3.results.file}"/>
    84     </target>
    85 </project>