forked from BroadleafCommerce/LegacyDemoSite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
74 lines (60 loc) · 3.36 KB
/
build.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
65
66
67
68
69
70
71
72
73
74
<?xml version="1.0" encoding="UTF-8"?>
<project name="!BroadleafDemoTools" default="change-identifier" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<target name="change-identifier">
<input message="Enter in new maven group. NOTE: This should be 2 letter-only strings separated by a dot. Also
note that this may only be run once." defaultvalue="com.mycompany" addproperty="maven-group" />
<propertyregex property="maven-group-clean"
input="${maven-group}"
regexp="([^A-Za-z\.])*"
replace=""
global="true" />
<propertyregex property="company-name"
input="${maven-group-clean}"
regexp="[\w]+\.([^\.]*)"
select="\1"
casesensitive="false" />
<propertyregex property="company-tld"
input="${maven-group-clean}"
regexp="([\w]+)*"
select="\0"
casesensitive="false" />
<fail message="Bad input">
<condition>
<not>
<isset property="company-name" />
</not>
</condition>
</fail>
<input message="New maven-group: ${maven-group}, new company-name: ${company-name} -- Continue?" addproperty="continue" validargs="y,n" defaultvalue="y" />
<if>
<equals arg1="${continue}" arg2="y" />
<then>
<echo message="${maven-group}" />
<echo message="${company-name}" />
<!-- Move the required files / directories to their new homes -->
<move file="admin/src/main/resources/com/mycompany/gwt/mycompanyAdmin.gwt.xml" tofile="admin/src/main/resources/${company-tld}/${company-name}/gwt/${company-name}Admin.gwt.xml" />
<move file="admin/src/main/resources/com/mycompany" tofile="admin/src/main/resources/${company-tld}/${company-name}" />
<move file="site/src/main/java/com/mycompany" tofile="site/src/main/java/${company-tld}/${company-name}" />
<move file="admin/src/main/java/com/mycompany" tofile="admin/src/main/java/${company-tld}/${company-name}" />
<!-- Replace the appropriate tokens -->
<replace file="pom.xml" token="com.mycompany" value="${maven-group}" summary="yes" excludes="target/" />
<replace dir="admin" token="com.mycompany.gwt.mycompanyAdmin" value="${maven-group}.gwt.${company-name}Admin" summary="yes" excludes="target/" />
<replace dir="admin" token="mycompany-admin" value="${company-name}-admin" summary="yes" excludes="target/" />
<replace dir="admin" token="com.mycompany" value="${maven-group}" summary="yes" excludes="target/" />
<replace dir="core" token="com.mycompany" value="${maven-group}" summary="yes" excludes="target/" />
<replace dir="site" token="com.mycompany" value="${maven-group}" summary="yes" excludes="target/" />
<replace dir="site" token="mycompany-site" value="${company-name}-site" summary="yes" excludes="target/" />
<replace dir="site" token="target/mycompany" value="target/${company-name}" summary="yes" excludes="target/" />
<replace file="site/src/main/webapp/WEB-INF/web.xml" token="mycompany" value="${company-name}" summary="yes" excludes="target/" />
<replace file="site/pom.xml" token="mycompany" value="${company-name}" summary="yes" excludes="target/" />
</then>
</if>
</target>
</project>