PageRenderTime 106ms CodeModel.GetById 84ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/asl/asl-scm-p4.xml

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
XML | 213 lines | 130 code | 18 blank | 65 comment | 0 complexity | a29c22617584c044210573c660424d0c MD5 | raw file
  1<?xml version="1.0" encoding="utf-8"?> 
  2<!--
  3********************************************************************************
  4* Ant Script Library - Source Control Management for Perforce
  5* Module that imports all the other java modules for a plain java build
  6* Module property prefix: "scm"
  7********************************************************************************
  8* Copyright 2009 Joe Schmetzer
  9*
 10* Licensed under the Apache License, Version 2.0 (the "License");
 11* you may not use this file except in compliance with the License.
 12* You may obtain a copy of the License at
 13*
 14*     http://www.apache.org/licenses/LICENSE-2.0
 15*
 16* Unless required by applicable law or agreed to in writing, software
 17* distributed under the License is distributed on an "AS IS" BASIS,
 18* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 19* See the License for the specific language governing permissions and
 20* limitations under the License.
 21********************************************************************************
 22 -->
 23<project name="asl-scm-p4">
 24    <dirname property="asl-scm-p4.basedir" file="${ant.file.asl-scm-p4}"/>
 25
 26    <import file="${asl-scm-p4.basedir}/asl-common.xml"/>
 27    
 28    <property name="scm.p4-executable" value="p4"/>
 29    <property name="scm.p4-tag-base" value="unknown"/>
 30
 31    <!-- ***********************************************************************
 32    * macro: scm-checkout
 33    ************************************************************************ -->
 34    <macrodef name="scm-export">
 35        <attribute name="serverpath"/>
 36        <attribute name="version"/>
 37        <attribute name="localpath"/>
 38        <sequential>
 39            <property name="scm.p4-workspace-name" value="@{version}-release-ws"/>
 40
 41        	<echo>scm-export:
 42    serverpath: @{serverpath}
 43    version: @{version}
 44    localpath: @{localpath}
 45    workspace: ${scm.p4-workspace-name}</echo>
 46            <antcall target="-p4-create-workspace">
 47                <param name="scm.p4-ws-server-path" value="@{serverpath}"/>
 48                <param name="scm.p4-ws-version"     value="@{version}"/>
 49            	<param name="scm.p4-ws-local-path"  value="@{localpath}"/>
 50                <param name="scm.p4-workspace-name" value="${scm.p4-workspace-name}"/>
 51            </antcall>
 52            <antcall target="-p4-sync-workspace">
 53                <param name="scm.p4-ws-server-path" value="@{serverpath}"/>
 54                <param name="scm.p4-ws-version"     value="@{version}"/>
 55                <param name="scm.p4-ws-local-path"  value="@{localpath}"/>
 56                <param name="scm.p4-workspace-name" value="${scm.p4-workspace-name}"/>
 57            </antcall>
 58            <antcall target="-p4-delete-workspace">
 59                <param name="scm.p4-workspace-name" value="${scm.p4-workspace-name}"/>
 60            </antcall>
 61        </sequential>
 62    </macrodef>
 63
 64    <!-- ***********************************************************************
 65    * macro: scm-update
 66    ************************************************************************ -->
 67    <macrodef name="scm-update">
 68        <attribute name="dir"/>
 69        <sequential>
 70            <exec command="${scm.p4-executable}">
 71                <arg value="sync"/>
 72                <arg value="@{dir}/..."/>
 73            </exec>
 74        </sequential>
 75    </macrodef>
 76
 77    <!-- ***********************************************************************
 78    * macro: scm-tag
 79    * p4 label -i
 80    * p4 tag -l ${label-name} ${project-path}/...
 81    ************************************************************************ -->
 82    <macrodef name="scm-tag">
 83        <attribute name="dir"/>
 84    	<attribute name="tag"/>
 85        <sequential>
 86        	<antcall target="-p4-create-label">
 87                <param name="scm.p4-label-path" value="@{dir}"/>
 88        	    <param name="scm.p4-label-name" value="@{tag}"/>
 89        	</antcall>
 90        	<antcall target="-p4-apply-tag">
 91                <param name="scm.p4-label-path" value="@{dir}"/>
 92                <param name="scm.p4-label-name" value="@{tag}"/>
 93            </antcall>
 94        </sequential>
 95    </macrodef>
 96
 97    <!-- ***********************************************************************
 98    * target: -p4-create-label
 99    ************************************************************************ -->
100	<target name="-p4-create-label"
101		 depends="-p4-create-label-spec, -p4-apply-label-spec, -p4-delete-label-spec"/>
102
103    <!-- ***********************************************************************
104    * target: -p4-create-label-spec
105    ************************************************************************ -->
106    <target name="-p4-create-label-spec">
107    	<property name="p4-label-spec-file" location="${java.io.tmpdir}/${ant.project.name}-p4-label-spec.txt"/>
108    	<echo message="Using p4 label spec file ${p4-label-spec-file}"/>
109    	<echo file="${p4-label-spec-file}">
110Label:  ${scm.p4-label-name}
111View:
112    	    ${scm.p4-label-path}/...</echo>
113    </target>
114	
115    <!-- ***********************************************************************
116    * target: -p4-apply-label-spec
117    ************************************************************************ -->
118    <target name="-p4-apply-label-spec">
119        <exec executable="${scm.p4-executable}"
120        	  input="${p4-label-spec-file}"
121        	  failonerror="true">
122        	<arg value="label"/>
123            <arg value="-i"/>
124        </exec>
125    </target>
126    
127    <!-- ***********************************************************************
128    * target: -p4-delete-label-spec
129    ************************************************************************ -->
130    <target name="-p4-delete-label-spec">
131    	<delete file="${p4-label-spec-file}"/>
132    </target>
133    
134    <!-- ***********************************************************************
135    * target: -p4-apply-tag
136    ************************************************************************ -->
137	<target name="-p4-apply-tag">
138        <exec executable="${scm.p4-executable}" failonerror="true">
139            <arg value="tag"/>
140        	<arg value="-l"/>
141        	<arg value="${scm.p4-label-name}"/>
142        	<arg value="${scm.p4-label-path}/..."/>
143        </exec>
144	</target>
145	
146    <!-- ***********************************************************************
147    * target: -p4-create-workspace
148    ************************************************************************ -->
149	<target name="-p4-create-workspace"
150		    depends="-p4-create-workspace-spec, -p4-apply-workspace-spec, -p4-delete-workspace-spec"/>
151	
152    <!-- ***********************************************************************
153    * target: -p4-create-workspace-spec
154    ************************************************************************ -->
155    <target name="-p4-create-workspace-spec">
156        <property name="p4-workspace-spec-file" location="${java.io.tmpdir}/${ant.project.name}-p4-workspace-spec.txt"/>
157        <echo message="Using p4 workspace spec file ${p4-workspace-spec-file}"/>
158        <echo file="${p4-workspace-spec-file}">
159Client:  ${scm.p4-workspace-name}
160Owner:   ${user.name}
161Root:    ${scm.p4-ws-local-path}
162View:
163            ${scm.p4-ws-server-path}/... //${scm.p4-workspace-name}/...
164</echo>
165    </target>
166	
167    <!-- ***********************************************************************
168    * target: -p4-apply-workspace-spec
169    ************************************************************************ -->
170    <target name="-p4-apply-workspace-spec">
171        <exec executable="${scm.p4-executable}"
172              input="${p4-workspace-spec-file}"
173              failonerror="true">
174            <arg value="client"/>
175            <arg value="-i"/>
176        </exec>
177	</target>
178
179    <!-- ***********************************************************************
180    * target: -p4-delete-workspace-spec
181    ************************************************************************ -->
182    <target name="-p4-delete-workspace-spec">
183        <delete file="${p4-workspace-spec-file}"/>
184	</target>
185	
186    <!-- ***********************************************************************
187    * target: -p4-sync-workspace
188    ************************************************************************ -->
189	<target name="-p4-sync-workspace">
190		<mkdir dir="${scm.p4-ws-local-path}"/>
191		
192        <exec executable="${scm.p4-executable}"
193              failonerror="true">
194        	<arg value="-c"/>
195        	<arg value="${scm.p4-workspace-name}"/>
196            <arg value="sync"/>
197            <arg value="-p"/>
198        	<arg value="${scm.p4-ws-server-path}/...@${scm.p4-ws-version}"/>
199        </exec>
200	</target>
201	
202    <!-- ***********************************************************************
203    * target: -p4-delete-workspace
204    ************************************************************************ -->
205    <target name="-p4-delete-workspace">
206        <exec executable="${scm.p4-executable}"
207              failonerror="true">
208            <arg value="client"/>
209            <arg value="-d"/>
210            <arg value="${scm.p4-workspace-name}"/>
211        </exec>
212    </target>
213</project>