java/sql-vyuka/nbproject/ant-deploy.xml
author František Kučera <franta-hg@frantovo.cz>
Mon Nov 09 19:00:45 2020 +0100 (2020-11-09)
changeset 87 5fff85c7f980
parent 79 aa8c8f51b0cc
permissions -rw-r--r--
nové netbeans
franta-hg@8
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@87
     2
<!--
franta-hg@87
     3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
franta-hg@87
     4
franta-hg@87
     5
Copyright (c) 2008, 2016 Oracle and/or its affiliates. All rights reserved.
franta-hg@87
     6
franta-hg@87
     7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
franta-hg@87
     8
Other names may be trademarks of their respective owners.
franta-hg@87
     9
franta-hg@87
    10
The contents of this file are subject to the terms of either the GNU
franta-hg@87
    11
General Public License Version 2 only ("GPL") or the Common
franta-hg@87
    12
Development and Distribution License("CDDL") (collectively, the
franta-hg@87
    13
"License"). You may not use this file except in compliance with the
franta-hg@87
    14
License. You can obtain a copy of the License at
franta-hg@87
    15
http://www.netbeans.org/cddl-gplv2.html
franta-hg@87
    16
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
franta-hg@87
    17
specific language governing permissions and limitations under the
franta-hg@87
    18
License.  When distributing the software, include this License Header
franta-hg@87
    19
Notice in each file and include the License file at
franta-hg@87
    20
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
franta-hg@87
    21
particular file as subject to the "Classpath" exception as provided
franta-hg@87
    22
by Oracle in the GPL Version 2 section of the License file that
franta-hg@87
    23
accompanied this code. If applicable, add the following below the
franta-hg@87
    24
License Header, with the fields enclosed by brackets [] replaced by
franta-hg@87
    25
your own identifying information:
franta-hg@87
    26
"Portions Copyrighted [year] [name of copyright owner]"
franta-hg@87
    27
franta-hg@87
    28
If you wish your version of this file to be governed by only the CDDL
franta-hg@87
    29
or only the GPL Version 2, indicate your decision by adding
franta-hg@87
    30
"[Contributor] elects to include this software in this distribution
franta-hg@87
    31
under the [CDDL or GPL Version 2] license." If you do not indicate a
franta-hg@87
    32
single choice of license, a recipient has the option to distribute
franta-hg@87
    33
your version of this file under either the CDDL, the GPL Version 2 or
franta-hg@87
    34
to extend the choice of license to its licensees as provided above.
franta-hg@87
    35
However, if you add GPL Version 2 code and therefore, elected the GPL
franta-hg@87
    36
Version 2 license, then the option applies only if the new code is
franta-hg@87
    37
made subject to such option by the copyright holder.
franta-hg@87
    38
franta-hg@87
    39
Contributor(s):
franta-hg@87
    40
-->
franta-hg@8
    41
<project default="-deploy-ant" basedir=".">
franta-hg@8
    42
    <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@8
    43
        <property file="${deploy.ant.properties.file}" />
franta-hg@8
    44
        <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
franta-hg@79
    45
        <available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
franta-hg@8
    46
        <available file="${deploy.ant.resource.dir}" property="has.setup"/>
franta-hg@74
    47
        <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@74
    48
        <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
franta-hg@8
    49
    </target>
franta-hg@87
    50
franta-hg@8
    51
    <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
franta-hg@74
    52
        <tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
franta-hg@8
    53
        <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
franta-hg@8
    54
        <!-- The doctype triggers resolution which can fail -->
franta-hg@8
    55
        <replace file="${temp.sun.web}">
franta-hg@8
    56
            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
franta-hg@8
    57
            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
franta-hg@8
    58
        </replace>
franta-hg@8
    59
        <replace file="${temp.sun.web}">
franta-hg@8
    60
            <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
franta-hg@8
    61
            <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
franta-hg@8
    62
        </replace>
franta-hg@8
    63
        <xmlproperty file="${temp.sun.web}" validate="false">
franta-hg@8
    64
        </xmlproperty>    
franta-hg@8
    65
        <delete file="${temp.sun.web}"/>
franta-hg@79
    66
        <condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
franta-hg@79
    67
            <isset property="sun-web-app.context-root"/>
franta-hg@79
    68
        </condition>
franta-hg@79
    69
        <condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
franta-hg@79
    70
            <isset property="sun-web-app.context-root"/>
franta-hg@79
    71
        </condition>
franta-hg@79
    72
    </target>
franta-hg@79
    73
    <target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
franta-hg@79
    74
        <tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
franta-hg@79
    75
        <copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
franta-hg@79
    76
        <!-- The doctype triggers resolution which can fail -->
franta-hg@79
    77
        <replace file="${temp.gf.web}">
franta-hg@79
    78
            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
franta-hg@79
    79
            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
franta-hg@79
    80
        </replace>
franta-hg@79
    81
        <replace file="${temp.gf.web}">
franta-hg@79
    82
            <replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
franta-hg@79
    83
            <replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
franta-hg@79
    84
        </replace>
franta-hg@79
    85
        <xmlproperty file="${temp.gf.web}" validate="false">
franta-hg@79
    86
        </xmlproperty>
franta-hg@79
    87
        <delete file="${temp.gf.web}"/>
franta-hg@79
    88
        <condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
franta-hg@79
    89
            <isset property="glassfish-web-app.context-root"/>
franta-hg@79
    90
        </condition>
franta-hg@79
    91
        <condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
franta-hg@79
    92
            <isset property="glassfish-web-app.context-root"/>
franta-hg@79
    93
        </condition>
franta-hg@74
    94
    </target>
franta-hg@74
    95
    <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
franta-hg@74
    96
        <property name="deploy.context.root.argument" value=""/>
franta-hg@8
    97
    </target>
franta-hg@8
    98
    <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
franta-hg@74
    99
        <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
franta-hg@74
   100
        <mkdir dir="${gfv3.resources.dir}"/>
franta-hg@74
   101
        <mkdir dir="${gfv3.resources.dir}/META-INF"/>
franta-hg@74
   102
        <copy todir="${gfv3.resources.dir}/META-INF">
franta-hg@8
   103
            <fileset dir="${deploy.ant.resource.dir}"/>
franta-hg@8
   104
        </copy>
franta-hg@8
   105
        <jar destfile="${deploy.ant.archive}" update="true">
franta-hg@74
   106
            <fileset dir="${gfv3.resources.dir}"/>
franta-hg@8
   107
        </jar>
franta-hg@74
   108
        <delete dir="${gfv3.resources.dir}"/>
franta-hg@8
   109
    </target>
franta-hg@79
   110
    <target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
franta-hg@79
   111
        <antcall target="-deploy-without-pw"/>
franta-hg@79
   112
        <antcall target="-deploy-with-pw"/>
franta-hg@79
   113
    </target>
franta-hg@79
   114
franta-hg@79
   115
    <target name="-deploy-without-pw" unless="gfv3.password">
franta-hg@8
   116
        <echo message="Deploying ${deploy.ant.archive}"/>
franta-hg@74
   117
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@74
   118
        <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
franta-hg@79
   119
        <get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
franta-hg@74
   120
            dest="${gfv3.results.file}"/>
franta-hg@74
   121
        <delete file="${gfv3.results.file}"/>    
franta-hg@8
   122
    </target>
franta-hg@79
   123
    <target name="-deploy-with-pw" if="gfv3.password">
franta-hg@79
   124
        <echo message="Deploying ${deploy.ant.archive}"/>
franta-hg@79
   125
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@79
   126
        <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
franta-hg@79
   127
        <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}"
franta-hg@79
   128
            dest="${gfv3.results.file}"/>
franta-hg@79
   129
        <delete file="${gfv3.results.file}"/>
franta-hg@79
   130
    </target>
franta-hg@8
   131
    <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@79
   132
        <antcall target="-undeploy-without-pw"/>
franta-hg@79
   133
        <antcall target="-undeploy-with-pw"/>
franta-hg@79
   134
    </target>
franta-hg@79
   135
franta-hg@79
   136
    <target name="-undeploy-without-pw" unless="gfv3.password">
franta-hg@74
   137
        <echo message="Undeploying ${deploy.ant.archive}"/>
franta-hg@74
   138
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@79
   139
        <get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
franta-hg@74
   140
            dest="${gfv3.results.file}"/>
franta-hg@74
   141
        <delete file="${gfv3.results.file}"/>    
franta-hg@8
   142
    </target>
franta-hg@79
   143
    <target name="-undeploy-with-pw" if="gfv3.password">
franta-hg@79
   144
        <echo message="Undeploying ${deploy.ant.archive}"/>
franta-hg@79
   145
        <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@79
   146
        <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
franta-hg@79
   147
            dest="${gfv3.results.file}"/>
franta-hg@79
   148
        <delete file="${gfv3.results.file}"/>
franta-hg@79
   149
    </target>
franta-hg@8
   150
</project>