java/nekurak.net-ejb/nbproject/ant-deploy.xml
author František Kučera <franta-hg@frantovo.cz>
Tue, 09 Mar 2010 20:54:58 +0100
changeset 62 d9df3f7b67dd
parent 27 88f3012c60a2
child 142 44ef544460ca
permissions -rw-r--r--
SQL: změny v databázovém schématu (role, uživatelé, rozšíření… zapomenuté změny).
franta-hg@27
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@27
     2
<project default="-deploy-ant" basedir=".">
franta-hg@27
     3
    <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@27
     4
        <property file="${deploy.ant.properties.file}" />
franta-hg@27
     5
        <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
franta-hg@27
     6
        <available file="${deploy.ant.resource.dir}" property="has.setup"/>
franta-hg@27
     7
        <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@27
     8
        <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
franta-hg@27
     9
    </target>
franta-hg@27
    10
    
franta-hg@27
    11
    <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
franta-hg@27
    12
        <tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
franta-hg@27
    13
        <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
franta-hg@27
    14
        <!-- The doctype triggers resolution which can fail -->
franta-hg@27
    15
        <replace file="${temp.sun.web}">
franta-hg@27
    16
            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
franta-hg@27
    17
            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
franta-hg@27
    18
        </replace>
franta-hg@27
    19
        <replace file="${temp.sun.web}">
franta-hg@27
    20
            <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
franta-hg@27
    21
            <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
franta-hg@27
    22
        </replace>
franta-hg@27
    23
        <xmlproperty file="${temp.sun.web}" validate="false">
franta-hg@27
    24
        </xmlproperty>    
franta-hg@27
    25
        <delete file="${temp.sun.web}"/>
franta-hg@27
    26
        <property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
franta-hg@27
    27
        <property name="deploy.context.root.argument" value="?contextroot=${sun-web-app.context-root}"/>
franta-hg@27
    28
    </target>
franta-hg@27
    29
    <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
franta-hg@27
    30
        <property name="deploy.context.root.argument" value=""/>
franta-hg@27
    31
    </target>
franta-hg@27
    32
    <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
franta-hg@27
    33
        <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
franta-hg@27
    34
        <mkdir dir="${gfv3.resources.dir}"/>
franta-hg@27
    35
        <mkdir dir="${gfv3.resources.dir}/META-INF"/>
franta-hg@27
    36
        <property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
franta-hg@27
    37
        <copy todir="${gfv3.resources.dir}/META-INF">
franta-hg@27
    38
            <fileset dir="${deploy.ant.resource.dir}"/>
franta-hg@27
    39
        </copy>
franta-hg@27
    40
        <jar destfile="${deploy.ant.archive}" update="true">
franta-hg@27
    41
            <fileset dir="${gfv3.resources.dir}"/>
franta-hg@27
    42
        </jar>
franta-hg@27
    43
        <delete dir="${gfv3.resources.dir}"/>
franta-hg@27
    44
    </target>
franta-hg@27
    45
    <target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
franta-hg@27
    46
        <echo message="Deploying ${deploy.ant.archive}"/>
franta-hg@27
    47
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@27
    48
        <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
franta-hg@27
    49
        <get src="${gfv3.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}?force=true?name=${ant.project.name}"
franta-hg@27
    50
            dest="${gfv3.results.file}"/>
franta-hg@27
    51
        <delete file="${gfv3.results.file}"/>    
franta-hg@27
    52
    </target>
franta-hg@27
    53
    <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@27
    54
        <echo message="Undeploying ${deploy.ant.archive}"/>
franta-hg@27
    55
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@27
    56
        <get src="${gfv3.url}/__asadmin/undeploy?name=${ant.project.name}"
franta-hg@27
    57
            dest="${gfv3.results.file}"/>
franta-hg@27
    58
        <delete file="${gfv3.results.file}"/>    
franta-hg@27
    59
    </target>
franta-hg@27
    60
</project>