-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateProject.xml
64 lines (54 loc) · 2.3 KB
/
createProject.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?>
<project name="createProject" basedir="." default="create">
<description>
Author : Alessandro Franzi
Date : 21/05/2011
Description : Creates a new Project from templateProject folder
</description>
<!-- Import the common targets -->
<import file="common-config.xml"/>
<!-- Internal Variables-->
<property name="MainProject.basedir" location="."/>
<property name="configurationFile" value="AllStubs.conf" />
<!-- Import configuration file as property file and filter file-->
<filter filtersfile="${configurationFile}"/>
<property file="${configurationFile}" />
<!-- Definisco un filtro per il nome del progetto recuperandolo dalla variabile passata come argomento 1 allo script ant-->
<filter token="projectName" value="${projectName}" />
<property name="pathProject" value="${projectDir}/${projectName}" />
<target name="checkIfProjectAlreadyExists" >
<antcall target="checkParameter">
</antcall>
<if>
<available file="${pathProject}" type="dir"/>
<then>
<fail message="AllStubs - the project ${projectName} already exists into the folder ${pathProject}"/>
</then>
<else>
<echo message="Creating project ${projectName}" />
</else>
</if>
</target>
<target name="create" description="Create project" depends="checkIfProjectAlreadyExists">
<!-- Creo la cartella del progetto-->
<mkdir dir="${pathProject}" />
<!-- copio i file di template nella cartella del progetto appena creata -->
<copy todir="${pathProject}" overwrite="yes" filtering="true">
<fileset dir="${templateDir}">
</fileset>
</copy>
<!-- aggiungo il nome del progetto nel file contenente la lista dei progetti-->
<echo file="${projectsListFile}" append="yes">${line.separator}${projectName}</echo>
<echo message="AllStubs - the project ${projectName} has been created!" />
<echo message="Remember to edit ./${pathProject}/endpoint.list file that contains web service references" />
<echo message="Remember to edit ./${pathProject}/project.conf file that contains project configurations" />
</target>
<target name="checkParameter" >
<if>
<equals arg1="${projectName}" arg2="$${projectName}" />
<then>
<fail message="AllStubs - Usage: ant -f buildStub.xml -DprojectName=[yourProjectName]"/>
</then>
</if>
</target>
</project>