author | František Kučera <franta-hg@frantovo.cz> |
Tue Jul 19 15:20:47 2011 +0200 (2011-07-19) | |
changeset 187 | e7b3ef7aaef4 |
parent 142 | 44ef544460ca |
permissions | -rw-r--r-- |
franta-hg@98 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
franta-hg@98 | 2 |
<project default="-deploy-ant" basedir="."> |
franta-hg@98 | 3 |
<target name="-init-cl-deployment-env" if="deploy.ant.enabled"> |
franta-hg@98 | 4 |
<property file="${deploy.ant.properties.file}" /> |
franta-hg@98 | 5 |
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/> |
franta-hg@186 | 6 |
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/> |
franta-hg@98 | 7 |
<available file="${deploy.ant.resource.dir}" property="has.setup"/> |
franta-hg@98 | 8 |
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! --> |
franta-hg@98 | 9 |
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/> |
franta-hg@98 | 10 |
</target> |
franta-hg@98 | 11 |
|
franta-hg@98 | 12 |
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present"> |
franta-hg@98 | 13 |
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/> |
franta-hg@98 | 14 |
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/> |
franta-hg@98 | 15 |
<!-- The doctype triggers resolution which can fail --> |
franta-hg@98 | 16 |
<replace file="${temp.sun.web}"> |
franta-hg@98 | 17 |
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken> |
franta-hg@98 | 18 |
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue> |
franta-hg@98 | 19 |
</replace> |
franta-hg@98 | 20 |
<replace file="${temp.sun.web}"> |
franta-hg@98 | 21 |
<replacetoken><![CDATA[<sun-web-app]]></replacetoken> |
franta-hg@98 | 22 |
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue> |
franta-hg@98 | 23 |
</replace> |
franta-hg@98 | 24 |
<xmlproperty file="${temp.sun.web}" validate="false"> |
franta-hg@98 | 25 |
</xmlproperty> |
franta-hg@98 | 26 |
<delete file="${temp.sun.web}"/> |
franta-hg@186 | 27 |
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}"> |
franta-hg@186 | 28 |
<isset property="sun-web-app.context-root"/> |
franta-hg@186 | 29 |
</condition> |
franta-hg@186 | 30 |
<condition property="deploy.context.root.argument" value="&contextroot=${sun-web-app.context-root}" else="/${ant.project.name}"> |
franta-hg@186 | 31 |
<isset property="sun-web-app.context-root"/> |
franta-hg@186 | 32 |
</condition> |
franta-hg@186 | 33 |
</target> |
franta-hg@186 | 34 |
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present"> |
franta-hg@186 | 35 |
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/> |
franta-hg@186 | 36 |
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/> |
franta-hg@186 | 37 |
<!-- The doctype triggers resolution which can fail --> |
franta-hg@186 | 38 |
<replace file="${temp.gf.web}"> |
franta-hg@186 | 39 |
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken> |
franta-hg@186 | 40 |
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue> |
franta-hg@186 | 41 |
</replace> |
franta-hg@186 | 42 |
<replace file="${temp.gf.web}"> |
franta-hg@186 | 43 |
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken> |
franta-hg@186 | 44 |
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue> |
franta-hg@186 | 45 |
</replace> |
franta-hg@186 | 46 |
<xmlproperty file="${temp.gf.web}" validate="false"> |
franta-hg@186 | 47 |
</xmlproperty> |
franta-hg@186 | 48 |
<delete file="${temp.gf.web}"/> |
franta-hg@186 | 49 |
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}"> |
franta-hg@186 | 50 |
<isset property="glassfish-web-app.context-root"/> |
franta-hg@186 | 51 |
</condition> |
franta-hg@186 | 52 |
<condition property="deploy.context.root.argument" value="&contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}"> |
franta-hg@186 | 53 |
<isset property="glassfish-web-app.context-root"/> |
franta-hg@186 | 54 |
</condition> |
franta-hg@98 | 55 |
</target> |
franta-hg@98 | 56 |
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present"> |
franta-hg@98 | 57 |
<property name="deploy.context.root.argument" value=""/> |
franta-hg@98 | 58 |
</target> |
franta-hg@98 | 59 |
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup"> |
franta-hg@98 | 60 |
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/> |
franta-hg@98 | 61 |
<mkdir dir="${gfv3.resources.dir}"/> |
franta-hg@98 | 62 |
<mkdir dir="${gfv3.resources.dir}/META-INF"/> |
franta-hg@98 | 63 |
<copy todir="${gfv3.resources.dir}/META-INF"> |
franta-hg@98 | 64 |
<fileset dir="${deploy.ant.resource.dir}"/> |
franta-hg@98 | 65 |
</copy> |
franta-hg@98 | 66 |
<jar destfile="${deploy.ant.archive}" update="true"> |
franta-hg@98 | 67 |
<fileset dir="${gfv3.resources.dir}"/> |
franta-hg@98 | 68 |
</jar> |
franta-hg@98 | 69 |
<delete dir="${gfv3.resources.dir}"/> |
franta-hg@98 | 70 |
</target> |
franta-hg@186 | 71 |
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled"> |
franta-hg@142 | 72 |
<antcall target="-deploy-without-pw"/> |
franta-hg@142 | 73 |
<antcall target="-deploy-with-pw"/> |
franta-hg@142 | 74 |
</target> |
franta-hg@142 | 75 |
|
franta-hg@142 | 76 |
<target name="-deploy-without-pw" unless="gfv3.password"> |
franta-hg@98 | 77 |
<echo message="Deploying ${deploy.ant.archive}"/> |
franta-hg@98 | 78 |
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! --> |
franta-hg@98 | 79 |
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/> |
franta-hg@142 | 80 |
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}" |
franta-hg@98 | 81 |
dest="${gfv3.results.file}"/> |
franta-hg@98 | 82 |
<delete file="${gfv3.results.file}"/> |
franta-hg@98 | 83 |
</target> |
franta-hg@142 | 84 |
<target name="-deploy-with-pw" if="gfv3.password"> |
franta-hg@142 | 85 |
<echo message="Deploying ${deploy.ant.archive}"/> |
franta-hg@142 | 86 |
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! --> |
franta-hg@142 | 87 |
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/> |
franta-hg@142 | 88 |
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}" |
franta-hg@142 | 89 |
dest="${gfv3.results.file}"/> |
franta-hg@142 | 90 |
<delete file="${gfv3.results.file}"/> |
franta-hg@142 | 91 |
</target> |
franta-hg@98 | 92 |
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled"> |
franta-hg@142 | 93 |
<antcall target="-undeploy-without-pw"/> |
franta-hg@142 | 94 |
<antcall target="-undeploy-with-pw"/> |
franta-hg@142 | 95 |
</target> |
franta-hg@142 | 96 |
|
franta-hg@142 | 97 |
<target name="-undeploy-without-pw" unless="gfv3.password"> |
franta-hg@98 | 98 |
<echo message="Undeploying ${deploy.ant.archive}"/> |
franta-hg@98 | 99 |
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! --> |
franta-hg@142 | 100 |
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}" |
franta-hg@98 | 101 |
dest="${gfv3.results.file}"/> |
franta-hg@98 | 102 |
<delete file="${gfv3.results.file}"/> |
franta-hg@98 | 103 |
</target> |
franta-hg@142 | 104 |
<target name="-undeploy-with-pw" if="gfv3.password"> |
franta-hg@142 | 105 |
<echo message="Undeploying ${deploy.ant.archive}"/> |
franta-hg@142 | 106 |
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! --> |
franta-hg@142 | 107 |
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}" |
franta-hg@142 | 108 |
dest="${gfv3.results.file}"/> |
franta-hg@142 | 109 |
<delete file="${gfv3.results.file}"/> |
franta-hg@142 | 110 |
</target> |
franta-hg@98 | 111 |
</project> |